Commit graph

4655 commits

Author SHA1 Message Date
沐目
a6e8aec7f4 fix: destroy both stdin and stdout on shutdown, guard against duplicate signals
- Close stdout in addition to stdin to prevent hanging writes during shutdown
- Add shuttingDown guard to ensure cleanup runs only once

Made-with: Cursor
2026-03-19 11:53:13 +08:00
沐目
2e6ab6562b fix: handle SIGTERM/SIGINT in ACP mode for graceful shutdown (#1884)
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
2026-03-19 11:46:57 +08:00
沐目
692e063cd7 fix: address PR review feedback
- 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
2026-03-19 11:07:29 +08:00
沐目
f231830b9f fix: improve ACP exit diagnostics and add onDisconnected callback
- 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
2026-03-19 10:41:35 +08:00
沐目
75b94b63eb fix: clean up ACP connection state when child process exits (#1780)
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
2026-03-19 10:37:52 +08:00
tanzhenxin
bbea114737
Merge pull request #1912 from QwenLM/feature/arena-agent-collaboration
feat(arena): Add agent collaboration arena with multi-model competitive execution
2026-03-18 19:36:47 +08:00
tanzhenxin
fe304a0c32 Merge branch 'main' into feature/arena-agent-collaboration 2026-03-18 19:20:22 +08:00
tanzhenxin
3f6cd4ef7a
Merge pull request #2458 from QwenLM/refactor/error-handling-quota-detection
refactor(core): improve error handling and quota detection
2026-03-18 19:15:53 +08:00
tanzhenxin
63da2bb926
Merge pull request #2434 from QwenLM/feat/concurrent-task-execution
feat(core): execute task tools concurrently for improved performance
2026-03-18 19:08:53 +08:00
tanzhenxin
ebed4ddd36
Merge pull request #2446 from QwenLM/refactor/centralize-tool-output-truncation
fix(core): add truncation support for MCP tool output
2026-03-18 19:05:44 +08:00
tanzhenxin
ddee359003 fix(core): correct error property in test from code to status
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>
2026-03-18 19:00:44 +08:00
Mingholy
d47e0e9f3d
Merge pull request #2448 from QwenLM/fix-sdk-message-event
Fix: Ensure message_start and message_stop events are paired in SDK streaming
2026-03-18 18:56:23 +08:00
mingholy.lmh
79083ffd50 Fix SDK message event pairing and improve content block handling
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-18 18:10:23 +08:00
mingholy.lmh
eea92fc8db fix: ensure message_start and message_stop are always paired in SDK stream events
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-18 18:10:23 +08:00
DennisYu07
4c0e4a9611
Merge pull request #2352 from QwenLM/feat/hooks-plugin
feat(hooks): implement hooks extension mechanism
2026-03-18 17:29:10 +08:00
tanzhenxin
f67e28b4be docs(arena): add Agent Arena documentation
Add comprehensive documentation for the Agent Arena feature, covering
usage, configuration, best practices, troubleshooting, and limitations.
Update navigation metadata to include the new page.

This enables users to discover and learn about the multi-model comparison
capability for competitive task execution.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-18 16:26:59 +08:00
DennisYu07
257934f1e9 resolve comment 2026-03-18 01:25:11 -07:00
tanzhenxin
d0923ef972 refactor(core): improve error handling and quota detection
- 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>
2026-03-18 16:07:35 +08:00
DennisYu07
9a05f96929 remove deplicate function and add test 2026-03-18 01:00:12 -07:00
tanzhenxin
d1b761adf2
Merge pull request #2425 from kkhomej33-netizen/fix/ctrl-r-command-search-order
Some checks failed
Qwen Code CI / Test-3 (push) Has been skipped
Qwen Code CI / Test-4 (push) Has been skipped
Qwen Code CI / Lint (push) Failing after 24s
Qwen Code CI / CodeQL (push) Failing after 24s
Qwen Code CI / Test (push) Has been skipped
Qwen Code CI / Test-1 (push) Has been skipped
Qwen Code CI / Test-2 (push) Has been skipped
Qwen Code CI / Test-5 (push) Has been skipped
Qwen Code CI / Test-6 (push) Has been skipped
Qwen Code CI / Test-7 (push) Has been skipped
Qwen Code CI / Test-8 (push) Has been skipped
E2E Tests / E2E Test (Linux) - sandbox:docker (push) Failing after 5s
E2E Tests / E2E Test (Linux) - sandbox:none (push) Failing after 6s
Qwen Code CI / Post Coverage Comment (push) Has been skipped
E2E Tests / E2E Test - macOS (push) Has been cancelled
fix(cli): show newest-first history for Ctrl+R command search
2026-03-18 13:51:28 +08:00
tanzhenxin
080271031d
Merge pull request #2400 from QwenLM/feat/system-prompt-sdk
feat: add system prompt customization options in SDK and CLI
2026-03-18 11:29:21 +08:00
tanzhenxin
a60fadd822
Merge pull request #2403 from simon100500/fix/duplicate-finish-chunk-tool-calls
fix(pipeline): handle duplicate finish_reason chunks from OpenRouter
2026-03-18 11:20:12 +08:00
tanzhenxin
56bc794553
Merge pull request #2451 from QwenLM/chore/bump-version-0.13.0
chore: bump version to 0.13.0
2026-03-18 11:19:48 +08:00
tanzhenxin
22f0437369 chore: bump version to 0.13.0
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-18 10:41:32 +08:00
tanzhenxin
61347577ce refactor(core): centralize tool output truncation logic
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

- Add truncateToolOutput helper in truncation.ts to centralize threshold reading, file saving, and telemetry logging

- Refactor shell.ts to use the new helper, removing duplicate code

- Add truncation support for MCP tool output while preserving non-text content (images, audio, resources)

- Refactor getDisplayFromParts to work on transformed Part[] instead of raw MCP response

This reduces code duplication and ensures consistent truncation behavior across shell and MCP tools.
2026-03-17 20:24:20 +08:00
qwen-code-ci-bot
ac30c98a26
chore: bump version to 0.12.6 (#2442)
Some checks failed
Qwen Code CI / Lint (push) Failing after 5s
Qwen Code CI / CodeQL (push) Failing after 5s
Qwen Code CI / Test (push) Has been skipped
Qwen Code CI / Test-1 (push) Has been skipped
Qwen Code CI / Test-2 (push) Has been skipped
Qwen Code CI / Test-3 (push) Has been skipped
Qwen Code CI / Test-4 (push) Has been skipped
Qwen Code CI / Test-5 (push) Has been skipped
Qwen Code CI / Test-6 (push) Has been skipped
Qwen Code CI / Test-7 (push) Has been skipped
Qwen Code CI / Test-8 (push) Has been skipped
E2E Tests / E2E Test (Linux) - sandbox:none (push) Failing after 3s
E2E Tests / E2E Test (Linux) - sandbox:docker (push) Failing after 4s
Qwen Code CI / Post Coverage Comment (push) Has been skipped
E2E Tests / E2E Test - macOS (push) Has been cancelled
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-17 19:00:26 +08:00
Mingholy
de29a8d987
Merge pull request #2438 from QwenLM/fix-max-token-limit
fix: improve max_tokens handling with conservative defaults
2026-03-17 18:45:48 +08:00
mingholy.lmh
f300e3ab32 fix: respect user-configured max_tokens for unknown Anthropic models
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-17 18:16:21 +08:00
mingholy.lmh
3a22ba9659 test: fix test expectations for new DEFAULT_OUTPUT_TOKEN_LIMIT (32000)
- Update anthropic tests: 32768 → 32000
- Update dashscope tests: 32768 → 32000
- Update unknown model test to respect user config (40000 preserved)

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-17 18:10:59 +08:00
mingholy.lmh
ec292ec581 feat: distinguish known/unknown models for output token limit handling
- Add hasExplicitOutputLimit() to detect models with defined output limits
- For known models: cap user max_tokens to model limit (avoid API errors)
- For unknown models (deployment aliases, self-hosted): respect user config
- Update tests to cover new behavior

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-17 18:04:33 +08:00
mingholy.lmh
45495e44b1 chore: reduce DEFAULT_OUTPUT_TOKEN_LIMIT from 32768 to 32000 for legacy model support
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-17 17:47:26 +08:00
tanzhenxin
78faa365cb feat(tools): allow read-file access to OS temp directory
- Add os.tmpdir() to allowed paths in read-file tool
- Add tests for reading files from OS temp directory
- Add terminal capture scenario for PR review testing

This supports the PR review workflow which saves context to temp files.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-17 17:13:23 +08:00
mingholy.lmh
4f58306a15 fix: improve max_tokens handling with conservative defaults
- Increase DEFAULT_OUTPUT_TOKEN_LIMIT from 16K to 32K
- Remove auto-detection from modelsConfig, apply at provider level
- Use conservative default (min of model limit and 32K) when user hasn't configured max_tokens
- Respect user configuration but cap at model's max output limit to avoid API errors

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-17 17:01:41 +08:00
tanzhenxin
1a977b62f3 refactor(skills): improve PR review workflow for better agent coordination
- Checkout PR branch instead of remote viewing for full file access
- Save PR context to temp file to avoid repeating in agent prompts
- Add guidance to prevent 4x diff duplication across agents
- Include environment restoration step after review

This enables agents to read files directly and use git diff against base branch,
improving review quality and reducing prompt bloat.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-17 16:50:25 +08:00
tanzhenxin
e133627e8a feat(core): execute task tools concurrently for improved performance
Task tools spawn independent sub-agents with no shared mutable state,
making them safe to run in parallel. This change executes all task
tools concurrently while keeping other tools sequential to preserve
any implicit ordering the model may rely on.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-17 15:45:17 +08:00
tanzhenxin
12293033b4 refactor(agents): remove outputFile from tool result events
Remove unused outputFile property from AgentToolResultEvent and its
associated test case. This property is not needed for agent tool
result handling.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-17 14:29:02 +08:00
DragonnZhang
7886ec6c8d fix(keypress): handle unsupported Kitty CSI-u keys and recover plain text
- Add helper functions for better code organization (createPrintableKey,
  getCompleteCsiSequenceLength, parsePlainTextPrefix)
- Drop unsupported Kitty CSI-u keys without blocking subsequent input
- Recover plain text that arrives in same chunk after unsupported CSI-u keys
- Add comprehensive tests for edge cases (CAPS_LOCK, event metadata variants)

Improves robustness of Kitty keyboard protocol parsing by gracefully
handling unsupported key codes and ensuring plain text input is not lost.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-17 14:02:41 +08:00
tanzhenxin
edd8388b27 Merge branch 'main' into feature/arena-agent-collaboration 2026-03-17 14:00:47 +08:00
tanzhenxin
dbfa5b3e8e
Merge pull request #2423 from QwenLM/test/shell-and-encoding-utilities
Some checks failed
Qwen Code CI / Lint (push) Failing after 3s
Qwen Code CI / CodeQL (push) Failing after 3s
Qwen Code CI / Test (push) Has been skipped
Qwen Code CI / Test-1 (push) Has been skipped
Qwen Code CI / Test-2 (push) Has been skipped
Qwen Code CI / Test-3 (push) Has been skipped
Qwen Code CI / Test-4 (push) Has been skipped
Qwen Code CI / Test-5 (push) Has been skipped
Qwen Code CI / Test-6 (push) Has been skipped
Qwen Code CI / Test-7 (push) Has been skipped
Qwen Code CI / Test-8 (push) Has been skipped
E2E Tests / E2E Test (Linux) - sandbox:docker (push) Failing after 4s
E2E Tests / E2E Test (Linux) - sandbox:none (push) Failing after 3s
Qwen Code CI / Post Coverage Comment (push) Has been skipped
E2E Tests / E2E Test - macOS (push) Has been cancelled
fix(shell): resolve Windows encoding issues for non-ASCII output
2026-03-16 23:07:40 +08:00
tanzhenxin
c3f5dd353d docs(tools): document file encoding and platform-specific behavior
Add documentation for encoding detection, default encoding settings,
CRLF handling for batch files, and UTF-8 BOM for PowerShell scripts on
Windows.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 23:03:50 +08:00
tanzhenxin
17939baa66 feat(core): auto-detect UTF-8 BOM for PowerShell scripts on Windows
- Add needsUtf8Bom() to detect when UTF-8 BOM is needed based on file
  extension and system code page
- PowerShell 5.1 on non-UTF-8 Windows systems (e.g. GBK) requires BOM
  to read scripts correctly
- Remove default UTF8 encoding; undefined now triggers auto-detection
- Add tests for needsUtf8Bom() covering Windows/non-Windows scenarios

This ensures PowerShell scripts are written with UTF-8 BOM on systems
that need it, fixing character encoding issues for non-ASCII content.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 22:44:53 +08:00
zach
46b9c75f83 fix(cli): show newest-first history for Ctrl+R command search 2026-03-16 14:16:03 +00:00
tanzhenxin
82e0064871 refactor(core): use dynamic terminal dimensions for replay
- Remove hardcoded REPLAY_TERMINAL_COLS/ROWS/SCROLLBACK constants
- Pass actual terminal dimensions to replayTerminalOutput()
- Increase scrollback buffer to 10000 for better output capture

This ensures terminal replay uses the actual terminal size instead of
fixed dimensions, improving output accuracy.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 21:16:20 +08:00
tanzhenxin
922fca51af test(services): simplify os module mock in fileSystemService tests
Refactor the vi.mock for 'os' to use a simpler direct mock object
instead of the importOriginal pattern, making the test setup more concise.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 20:35:48 +08:00
tanzhenxin
9b1bd731d7 refactor(core): improve platform-specific encoding and shell utilities
- Make CRLF conversion for .bat/.cmd files Windows-only
- Extract PowerShell UTF-8 prefix into reusable function
- Replace custom UTF-8 validation with Node.js built-in isUtf8()

This ensures .bat/.cmd files are only converted on Windows where cmd.exe
actually requires CRLF, and reduces code duplication for shell encoding.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 20:29:21 +08:00
tanzhenxin
08c1ce94c0 chore(shell): remove Codex CLI reference from comment
This removes an unnecessary external reference from the codebase.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 19:21:10 +08:00
tanzhenxin
aa8afbad9d test(encoding): remove Windows encoding e2e tests
This removes the Windows-specific encoding integration tests that are
no longer needed after consolidating the encoding utilities.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 19:10:23 +08:00
qwen-code-ci-bot
bcbd82d2d4
chore: bump version to 0.12.5 (#2422)
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 19:05:05 +08:00
tanzhenxin
d8dab9acd7 docs(encoding): clarify detectEncodingFromBuffer responsibility
Update JSDoc to make clear that detectEncodingFromBuffer only performs
chardet statistical detection and returns null on failure. Callers like
getCachedEncodingForBuffer are responsible for providing fallback logic.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 18:57:01 +08:00
tanzhenxin
f93e5f0d46 refactor(encoding): consolidate system encoding fallback logic
Move system encoding fallback from detectEncodingFromBuffer into
getCachedEncodingForBuffer for clearer responsibility. Remove unused
WINDOWS_UTF8_CODE_PAGE export and inline the value.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 18:53:51 +08:00