- Close stdout in addition to stdin to prevent hanging writes during shutdown
- Add shuttingDown guard to ensure cleanup runs only once
Made-with: Cursor
The ACP process was ignoring SIGTERM because signal handlers registered
elsewhere in the CLI startup path (e.g., stdin raw mode restoration)
override Node.js's default exit behavior. This caused the process to
remain alive after the IDE sends SIGTERM, leading to zombie connections
and exit code 143 errors in JetBrains IntelliJ IDEA.
Add explicit SIGTERM/SIGINT handlers in runAcpAgent() that destroy
stdin, which closes the ndjson stream and resolves connection.closed,
allowing the process to exit gracefully.
Made-with: Cursor
- Add exitCode fallback in startup failure message to handle edge case
where exit event hasn't fired yet
- Add guard check in exit handler to avoid redundant cleanup if
disconnect() already ran
- Add JSDoc for onDisconnected callback
- Add comment explaining exit code 143 (SIGTERM) in test
Made-with: Cursor
- Record lastExitCode/lastExitSignal for better error messages on startup failure
- Reset exit info on reconnect to avoid stale data
- Add onDisconnected callback so upper layers can react to process exit
- Add clarifying comment on ensureConnection defense-in-depth checks
- Expand tests: onDisconnected contract, disconnect kill verification, exit info init
Made-with: Cursor
When the ACP child process exits unexpectedly (e.g., user cancels execution),
the connection state (sdkConnection, sessionId, child) was not being cleaned up.
This caused subsequent message sends to fail with cryptic errors instead of
a clear "Not connected" message.
Changes:
- Clear sdkConnection/sessionId/child in the exit handler
- Check child.exitCode in isConnected to detect spontaneous exits
- Add isConnected check to ensureConnection as defense-in-depth
- Add unit tests for isConnected, ensureConnection, and disconnect cleanup
Made-with: Cursor
* feat(vscode-ide-companion): add Tab key fill-only behavior for completions
- Separate Tab and Enter key handling in CompletionMenu
- Tab now inserts completion text without executing (useful for slash commands)
- Enter/click continues to select and execute immediately
- Allow users to append arguments after Tab-filling slash commands
* feat(vscode-ide-companion): add Tab key fill-only behavior for completions
- Separate Tab and Enter key handling in CompletionMenu
- Tab now inserts completion text without executing (useful for slash commands)
- Enter/click continues to select and execute immediately
- Allow users to append arguments after Tab-filling slash commands
Co-authored-by: Mingholy <14246397+Mingholy@users.noreply.github.com>
* feat: add command selection behavior logic and tests
Co-developed-by: Aone Copilot <noreply@alibaba-inc.com>
* feat(vscode-ide-companion): add Tab key completion fill behavior with tests
- Add onCompletionFill prop to InputForm for Tab key handling
- Distinguish Tab (fill) and Enter (select) completion behaviors
- Add keyboard handling tests for completion items
- Remove 'skills' command from non-interactive CLI allowed list
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
* refactor: add itemId variable for command handling in App component
Co-developed-by: Aone Copilot <noreply@alibaba-inc.com>
* refactor: remove unused command selection behavior utils and tests
---------
Co-authored-by: Mingholy <14246397+Mingholy@users.noreply.github.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This aligns the test with the updated error handling that uses `status` instead of `code` for HTTP status codes.
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Add cachedContentTokenCount tracking in uiTelemetry service
- Collect cached_content_token_count from streaming usage metadata
- Use cached tokens instead of estimated overhead when available
- Fix messages token calculation to avoid 'messages = 0' issue
This improves context window display accuracy when using providers
that support prefix caching (e.g., DashScope).
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Move getErrorStatus from retry.ts to errors.ts for better organization
- Add getErrorType utility to extract error class/category names
- Enhance getErrorMessage to include cause chain for better debugging
- Refactor ApiErrorEvent to use options object pattern (more readable)
- Rename 'error' to 'error_message' in ApiErrorEvent for clarity
- Make isQwenQuotaExceededError more precise: requires status=429,
code='insufficient_quota', and 'free allocated quota exceeded' message
- Update all tests to match new error detection behavior
This improves error telemetry and makes quota detection more reliable.
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>