Commit graph

4562 commits

Author SHA1 Message Date
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
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
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
tanzhenxin
e9facac111 test(encoding): replace manual Windows test scripts with automated e2e tests
Add integration-tests/windows-encoding.test.ts with automated tests for:
- ASCII shell output
- PowerShell CJK output via UTF-8 prefix
- GBK directory listings and file content
- UTF-8 file round-trip with CRLF preservation
- GBK file edit preserving encoding

Remove obsolete manual test scripts from test-shell/ and test-windows-encoding/.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 18:49:14 +08:00
tanzhenxin
89e452c1a7 test(encoding): simplify Windows encoding test plan
Reduce test count from 8 to 7, remove script dependencies, and use
system-created test files instead. Tests now focus on real-world
scenarios: GBK dir listings, file content, PowerShell UTF-8 prefix,
and late CJK detection after ASCII output.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 18:24:58 +08:00
tanzhenxin
3dd0bacb8d fix(shell): force UTF-8 output for PowerShell on Windows
- Prefix PowerShell commands with [Console]::OutputEncoding=UTF8
- Re-detect encoding on full buffer after streaming completes
- Move system encoding fallback into detectEncodingFromBuffer

This ensures CJK and other non-ASCII characters are correctly decoded
on Windows systems with non-UTF-8 system codepages (e.g., GBK/CP936).

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 17:39:47 +08:00
tanzhenxin
21014a5a44 test(encoding): add Windows encoding test plan and scripts
Add comprehensive test plan and scripts for verifying encoding detection
on Windows systems with non-UTF-8 codepages (e.g., GBK/CP936).

This provides manual test cases for output decoding, file round-trips,
PTY behavior, and edge cases like large output with late CJK content.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 16:25:09 +08:00
tanzhenxin
9b822958dc refactor(encoding): try UTF-8 first in buffer encoding detection
- Rename outputEncoding to detectedEncoding for clarity
- Add isValidUtf8 helper using TextDecoder in fatal mode
- Restructure detection: UTF-8 → chardet → system encoding
- Update tests to use non-UTF-8 bytes for accurate testing

This prevents misclassifying UTF-8 output as legacy codepages on systems
where the system encoding (e.g., GBK) could also decode those bytes.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 16:15:06 +08:00
tanzhenxin
dca3ea1c95 refactor(shell): remove Windows encoding wrapper logic
Remove wrapCommandForWindowsEncoding and forceUtf8Output parameter,
relying solely on getCachedEncodingForBuffer for encoding detection.

This simplifies the shell execution flow by removing the chcp 65001
command prefixing approach.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 15:32:35 +08:00
tanzhenxin
7f915be881 fix(shell): ensure CRLF line endings for .bat/.cmd files
- Add automatic LF to CRLF conversion when writing .bat/.cmd files
- Handle null encoding detection gracefully in shellExecutionService
- Add comprehensive tests for CRLF conversion edge cases

This ensures Windows batch files work correctly, as cmd.exe requires
CRLF line endings for proper parsing of multi-line constructs.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 14:29:31 +08:00
tanzhenxin
15b5f0224b fix(shell): force UTF-8 output decoding after codepage switch
Return forceUtf8Output flag from wrapCommandForWindowsEncoding to
signal that output should be decoded as UTF-8 when we've switched
the codepage to 65001. This ensures consistent encoding for both
command input and output on Windows with non-UTF-8 system codepage.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 12:45:26 +08:00
tanzhenxin
f8f189ebc2 fix(shell): always switch codepage on Windows for consistency
Simplify wrapCommandForWindowsEncoding to always prefix with chcp 65001
on Windows with non-UTF-8 codepage, rather than only for non-ASCII
commands. This ensures script files written by qwen-code are also
interpreted correctly by cmd.exe.

Add WINDOWS_UTF8_CODE_PAGE constant and update test script for
PowerShell 5.1 compatibility.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 12:37:18 +08:00
tanzhenxin
b917cf8e3c fix(shell): resolve Windows GBK encoding for non-ASCII commands
Add wrapCommandForWindowsEncoding() to prefix non-ASCII commands with
chcp 65001 on Windows with non-UTF-8 codepages. Fix CP936 mapping from
gb2312 to gbk (GBK is the correct superset). Update Windows encoding
test scripts to demonstrate the fix.

This ensures Chinese and other non-ASCII characters display correctly
when running commands on Windows systems with GBK/CP936 codepage.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 12:10:29 +08:00
tanzhenxin
810ea025e1 test: add shell and Windows encoding test utilities
- Add Python scripts for generating large text output (2000 lines)
- Add Chinese progress bar shell script for testing terminal output
- Add Windows GBK encoding reproduction tests for qwen-code

These utilities help debug shell output handling and Windows encoding issues.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-16 11:45:23 +08:00
顾盼
0995224848
Merge pull request #2407 from QwenLM/fix/remove-plan-file
fix:remove redundant plan files
2026-03-16 10:31:26 +08:00
LaZzyMan
f59b044a72 fix: remove plan file 2026-03-16 10:03:19 +08:00
tanzhenxin
58bee3dec9
Merge pull request #2388 from QwenLM/fix/remove-enableToolOutputTruncation-setting
fix(core): improve shell tool truncation, simplify tool output handling, and remove summarization
2026-03-16 09:51:37 +08:00
tanzhenxin
d0a4dcc89c
Merge pull request #2374 from QwenLM/fix/vscode-session-race-conditions
fix(vscode): prevent race conditions in prompt cancellation and streaming
2026-03-16 09:51:20 +08:00
tanzhenxin
e22a29c6a4
Merge pull request #2389 from QwenLM/fix/rapid-pty-output-capture
fix(core): correctly capture rapid pty outputs in interactive shell mode
2026-03-16 09:50:33 +08:00
pomelo
15424f263b
Merge pull request #2367 from QwenLM/refactor/send-message-type
fix(core): strip orphaned user entries before retry to prevent API errors
2026-03-16 09:43:59 +08:00
tanzhenxin
110fcd7b7b
Merge pull request #2280 from xuewenjie123/fix/hooks-json-schema-type
Some checks are pending
Qwen Code CI / Lint (push) Waiting to run
Qwen Code CI / Test (push) Blocked by required conditions
Qwen Code CI / Test-1 (push) Blocked by required conditions
Qwen Code CI / Test-2 (push) Blocked by required conditions
Qwen Code CI / Test-3 (push) Blocked by required conditions
Qwen Code CI / Test-4 (push) Blocked by required conditions
Qwen Code CI / Test-5 (push) Blocked by required conditions
Qwen Code CI / Test-6 (push) Blocked by required conditions
Qwen Code CI / Test-7 (push) Blocked by required conditions
Qwen Code CI / Test-8 (push) Blocked by required conditions
Qwen Code CI / Post Coverage Comment (push) Blocked by required conditions
Qwen Code CI / CodeQL (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:docker (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none (push) Waiting to run
E2E Tests / E2E Test - macOS (push) Waiting to run
fix: correct hooks JSON schema type definition
2026-03-15 22:44:01 +08:00
tanzhenxin
06d8a01532
Merge pull request #2391 from kkhomej33-netizen/fix/macos-pty-sandbox-rules
fix(cli): allow /dev/ptmx and /dev/ttys* in macOS permissive sandbox
2026-03-15 22:33:40 +08:00
tanzhenxin
fb44b76abd
Merge pull request #2157 from QwenLM/zth/keep-rejected-plan-content-visible
Some checks are pending
Qwen Code CI / CodeQL (push) Waiting to run
Qwen Code CI / Lint (push) Waiting to run
Qwen Code CI / Test (push) Blocked by required conditions
Qwen Code CI / Test-1 (push) Blocked by required conditions
Qwen Code CI / Test-2 (push) Blocked by required conditions
Qwen Code CI / Test-3 (push) Blocked by required conditions
Qwen Code CI / Test-4 (push) Blocked by required conditions
Qwen Code CI / Test-5 (push) Blocked by required conditions
Qwen Code CI / Test-6 (push) Blocked by required conditions
Qwen Code CI / Test-7 (push) Blocked by required conditions
Qwen Code CI / Test-8 (push) Blocked by required conditions
Qwen Code CI / Post Coverage Comment (push) Blocked by required conditions
E2E Tests / E2E Test (Linux) - sandbox:docker (push) Waiting to run
E2E Tests / E2E Test (Linux) - sandbox:none (push) Waiting to run
E2E Tests / E2E Test - macOS (push) Waiting to run
Keep rejected plan content visible in plan mode
2026-03-15 22:11:57 +08:00
tanzhenxin
2719540fab
Merge pull request #2024 from drewd789/fix/pdf-session-corruption
fix(core): reject PDF files to prevent session corruption (fixes #2020)
2026-03-15 22:06:41 +08:00
tanzhenxin
33c6d9cbf3
Merge pull request #2286 from LaZzyMan/fix/extension-install-symlink-windows
fix(extension): disable symlinks on Windows during git clone to fix install failure
2026-03-15 21:55:44 +08:00
tanzhenxin
7ee65e1738 fix(fileUtils): remove error field from skipped file result
When a file is skipped because the model doesn't support a modality,
it should not be treated as an error. The error field was incorrectly
being set alongside the informational message.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 21:44:28 +08:00
tanzhenxin
fdad1980d7 fix(test): add missing getContentGeneratorConfig mock to tests
Adds the required getContentGeneratorConfig mock to read-file.test.ts
and pathReader.test.ts to fix failing tests that depend on content
generator configuration.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 21:41:20 +08:00
tanzhenxin
5c31341205 Merge remote main into fix/pdf-session-corruption
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 21:24:57 +08:00
tanzhenxin
6997636ba4 fix(fileUtils): use config modalities instead of model-based defaults
This fixes session corruption issues where the modality check was based on
the model name rather than the actual resolved config, causing inconsistent
behavior when the config's modalities differed from the defaults.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 21:22:57 +08:00
tanzhenxin
59c1765ec5
Merge pull request #2001 from hs-ye/docs/subagent-limits
Docs/subagent system prompt limits
2026-03-15 21:15:53 +08:00
tanzhenxin
344839c0c4
Merge pull request #2397 from QwenLM/codex/add-qwen-doc-skills
feat(skills): add docs audit and update helpers
2026-03-15 20:59:02 +08:00
tanzhenxin
1852a73a3f fix(subagents): change limits from hard errors to soft warnings
- Increase description warning threshold from 500 to 1,000 characters
- Change system prompt 10,000 char limit from error to warning
- Remove intermediate 5,000 char warning threshold for system prompts
- Update documentation to reflect soft warning behavior

This provides more flexibility for users while still guiding them
toward better practices.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 20:56:25 +08:00
tanzhenxin
e2affcebdd
Merge pull request #2364 from netbrah/fix/empty-choices-crash
fix(core): guard against empty choices in convertOpenAIResponseToGemini
2026-03-15 20:52:47 +08:00
DragonnZhang
a8bc25beb9 feat(skills): add docs audit and update helpers 2026-03-15 20:40:31 +08:00
tanzhenxin
2898e9e60e refactor(core): move candidates assignment inside choice check
Restructures the convertOpenAIResponseToGemini method to set
response.candidates within the choice conditional block, making
the empty choices handling more explicit and the control flow clearer.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 20:37:59 +08:00
tanzhenxin
8161ac4523 fix(hooks): correct JSON schema type for hooks configuration
- Add 'array' type support to SettingItemDefinition
- Change hooks field from object to array type
- Add additionalProperties constraint for env fields
- Fix additionalProperties generation to only apply for object types

This ensures the hooks configuration schema correctly represents hooks as an array
and properly validates environment variable objects.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 20:32:56 +08:00
tanzhenxin
b83e9ea393
Merge pull request #2333 from chen893/fix/slash-command-i18n
fix(i18n): localize slash command descriptions
2026-03-15 20:12:15 +08:00
tanzhenxin
2391c26026
Merge pull request #2393 from QwenLM/release/v0.12.4
chore(release): bump version to 0.12.4
2026-03-15 19:59:57 +08:00
tanzhenxin
a165599b32 chore(release): bump version to 0.12.4
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 18:45:14 +08:00
tanzhenxin
00baa5085e fix(core): use terminal replay for accurate raw output capture
Replay raw PTY output through a terminal buffer to properly collapse
carriage-return progress updates (e.g., git clone progress) instead of
showing all intermediate states.

This ensures the final output reflects what a user would actually see
in their terminal, with progress bars and spinners collapsed to their
final state.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 18:09:07 +08:00
zach
487a8390b0 fix(cli): allow macOS PTY device paths in permissive sandbox 2026-03-15 08:09:35 +00:00
tanzhenxin
7be66749bf fix(core): fix mock type mismatch in shellExecutionService test
The Terminal.prototype.write mock's data parameter needed to accept
string | Uint8Array to match the actual method signature.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 14:35:25 +08:00
tanzhenxin
5a26de927c fix(test): add missing config methods to makeFakeConfig in qwen-logger tests
StartSessionEvent requires getTruncateToolOutputThreshold,
getTruncateToolOutputLines, getIdeMode, getShouldUseNodePtyShell,
and getHookSystem from the config object.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 14:28:33 +08:00
tanzhenxin
1140c10cbe fix(core): correctly capture rapid pty outputs in interactive shell mode
When PTY outputs data rapidly, the headless terminal rendering is
slower than appending buffers, and the render queue can be overrun
before finalize() races on exit. Additionally, node-pty can fire
onExit before all onData events have been delivered.

This fix:
- Captures raw output immediately before processing
- Uses setImmediate drain mechanism to flush late onData events
- Builds output from raw chunks instead of xterm buffer to avoid
  scrollback limit data loss

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-15 14:24:58 +08:00