@defai.digital/automatosx 6.2.6 → 6.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,82 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [6.2.8] - 2025-10-31
6
+
7
+ ### 🔧 Fixes
8
+
9
+ **Provider Error Handler Timer Race Condition (Bug #35)**
10
+
11
+ Through systematic heavy-thinking analysis of provider timer cleanup patterns:
12
+
13
+ - **Bug #35 (MEDIUM)**: Missing cleanup() call in child process error handlers across all CLI providers
14
+ - **Files affected**:
15
+ - `src/providers/openai-provider.ts` (2 locations: lines 360, 760)
16
+ - `src/providers/claude-provider.ts` (line 445)
17
+ - `src/providers/gemini-provider.ts` (line 399)
18
+ - **Problem**: Error handlers call `cleanupAbortListener()` but NOT `cleanup()`, leaving timers running
19
+ - **Impact**: Race condition - if child.on('error') fires, mainTimeout continues and can create orphaned nestedKillTimeout
20
+ - **Root Cause**: Inconsistent cleanup pattern - close/timeout/abort handlers all call cleanup(), but error handler doesn't
21
+ - **Fix**: Added `cleanup()` call before `cleanupAbortListener()` in all error handlers (matching close handler pattern)
22
+ - **Scenario**: Between error event and close event, timers fire and create nested timers that aren't cleaned until close
23
+
24
+ ### 🔍 Analysis Methodology
25
+
26
+ - **Heavy-thinking provider analysis**: Systematically checked all child.on('error') handlers in CLI providers
27
+ - **Pattern comparison**: Verified cleanup() is called in close, timeout, and abort handlers
28
+ - **Verified vulnerable operations**: All 3 CLI providers (OpenAI, Claude, Gemini) had same bug
29
+ - **Fixed**: 4 total error handler locations across 3 provider files
30
+
31
+ ### 📊 Impact
32
+
33
+ - **Users affected**: Users experiencing provider CLI process errors during execution
34
+ - **Severity**: Medium (timers eventually cleaned in close handler, but race condition window exists)
35
+ - **Breaking changes**: None
36
+ - **Migration**: None required - automatic cleanup improvement
37
+
38
+ ### ✅ Testing
39
+
40
+ - All 2,281 unit tests passing
41
+ - TypeScript compilation successful
42
+ - Build successful
43
+
44
+ ## [6.2.7] - 2025-10-31
45
+
46
+ ### 🔧 Fixes
47
+
48
+ **Timer Cleanup Memory Leak (Bug #34)**
49
+
50
+ Through systematic timer analysis across all setTimeout/setInterval operations:
51
+
52
+ - **Bug #34 (LOW)**: Missing timer cleanup in prompt timeout handler (`src/core/prompt-manager.ts:238`)
53
+ - **Problem**: When main timeout fires, the warning timer (`warningHandle`) is not cleared
54
+ - **Impact**: Memory leak - warning timer continues running even after prompt resolved
55
+ - **Root Cause**: `handleTimeout()` clears readline and resolves promise, but forgets to clear `warningHandle`
56
+ - **Fix**: Added `clearTimeout(warningHandle)` in `handleTimeout()` before resolving (lines 242-244)
57
+ - **Pattern**: Symmetric cleanup - both answer callback and timeout handler now clear both timers
58
+
59
+ ### 🔍 Analysis Methodology
60
+
61
+ - **Heavy-thinking timer analysis**: Systematically checked all setTimeout/setInterval in `src/core/`
62
+ - **Verified safe operations**:
63
+ - db-connection-pool.ts queue timeouts (properly cleared in processWaitQueue)
64
+ - session-manager.ts save debouncing (clears before setting new)
65
+ - All setInterval operations have corresponding clear in destroy/close methods
66
+ - **Fixed vulnerable operation**: prompt-manager.ts dual-timeout handling
67
+
68
+ ### 📊 Impact
69
+
70
+ - **Users affected**: Users with interactive prompts that timeout (edge case)
71
+ - **Severity**: Low (timer eventually completes, but wastes resources)
72
+ - **Breaking changes**: None
73
+ - **Migration**: None required - automatic cleanup improvement
74
+
75
+ ### ✅ Testing
76
+
77
+ - All 2,281 unit tests passing
78
+ - TypeScript compilation successful
79
+ - Build successful
80
+
5
81
  ## [6.2.6] - 2025-10-31
6
82
 
7
83
  ### 🔧 Fixes
package/dist/index.js CHANGED
@@ -4363,6 +4363,7 @@ Details: ${errorMsg}`
4363
4363
  }
4364
4364
  });
4365
4365
  child.on("error", (error) => {
4366
+ cleanup();
4366
4367
  cleanupAbortListener();
4367
4368
  if (hasTimedOut) {
4368
4369
  return;
@@ -5018,6 +5019,7 @@ This is a placeholder response. Set AUTOMATOSX_MOCK_PROVIDERS=false to use real
5018
5019
  }
5019
5020
  });
5020
5021
  child.on("error", (error) => {
5022
+ cleanup();
5021
5023
  cleanupAbortListener();
5022
5024
  if (!hasTimedOut) {
5023
5025
  reject(ProviderError.executionError(this.config.name, error));
@@ -5510,6 +5512,7 @@ This is a placeholder response. Set AUTOMATOSX_MOCK_PROVIDERS=false to use real
5510
5512
  }
5511
5513
  });
5512
5514
  child.on("error", (error) => {
5515
+ cleanup();
5513
5516
  cleanupAbortListener();
5514
5517
  if (!hasTimedOut) {
5515
5518
  reject(new Error(`Failed to spawn OpenAI CLI: ${error.message}`));
@@ -5779,6 +5782,7 @@ This is a placeholder streaming response.`;
5779
5782
  }
5780
5783
  });
5781
5784
  child.on("error", (error) => {
5785
+ cleanup();
5782
5786
  cleanupAbortListener();
5783
5787
  if (!hasTimedOut) {
5784
5788
  reject(new Error(`Failed to spawn OpenAI CLI: ${error.message}`));
@@ -23366,6 +23370,9 @@ ${this.config.locale === "zh" ? "\u8ACB\u9078\u64C7" : "Select"}${defaultDisplay
23366
23370
  const handleTimeout = () => {
23367
23371
  if (!resolved) {
23368
23372
  resolved = true;
23373
+ if (warningHandle) {
23374
+ clearTimeout(warningHandle);
23375
+ }
23369
23376
  console.log(`
23370
23377
  ${template.timedOut}`);
23371
23378
  rl.close();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defai.digital/automatosx",
3
- "version": "6.2.6",
3
+ "version": "6.2.8",
4
4
  "description": "AI Agent Orchestration Platform",
5
5
  "type": "module",
6
6
  "publishConfig": {