Commit graph

4311 commits

Author SHA1 Message Date
jinye
1557d93043
feat(cli): support tools.sandboxImage in settings (#3146)
Co-authored-by: jinye.djy <jinye.djy@alibaba-inc.com>
2026-04-13 09:43:34 +08:00
feyclaw
116796b2a4
feat(channels): add voice message support in TelegramAdapter (#3150)
Add handler for message:voice in Telegram channel adapter.
Voice messages are downloaded via Telegram Bot API and passed as
audio attachments in the Envelope, matching the existing pattern
for document handling.

This enables users to send voice messages through Telegram which
can then be processed by the model or transcription skills.

Co-authored-by: Teafey <Teafey@users.noreply.github.com>
2026-04-13 09:39:40 +08:00
Shaojin Wen
7614c8c58e
fix(followup): fix follow-up suggestions not working on OpenAI-compatible providers (#3151)
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(followup): fix follow-up suggestions not working on OpenAI-compatible providers

- Respect request.model in pipeline so fastModel setting takes effect
- Skip empty tools array to avoid 400 errors from providers
- Override enable_thinking/reasoning from extra_body when thinking is
  explicitly disabled for suggestion generation
- Filter thought parts from response text in both forkedQuery and
  baseLlm paths to prevent thinking content leaking into suggestions
- Add debug logging (tag: FOLLOWUP) for suggestion generation diagnostics

* fix(followup): validate fastModel belongs to current authType

When the configured fastModel is from a different auth type/provider
than the main model, the API call silently fails because the current
content generator rejects unknown model IDs. Fall back to the main
model in that case so suggestion generation stays functional.

Reported by @yiliang114 in #3151.
2026-04-12 16:07:00 +08:00
John London
fea61e1788
fix(core): handle empty OAuth refresh response body (#3123)
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(core): handle empty OAuth refresh response body

When Qwen's OAuth server returns 200 with an empty body (e.g., stale
refresh token), response.json() throws 'Expecting value: line 1 column 1
(char 0)' instead of a usable error message. This forces users to
re-authenticate with no indication of what went wrong.

Fix: read response.text() first, then JSON.parse with a try/catch that
clears credentials and provides a clear error message.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(core): address review feedback on OAuth refresh error handling

- Don't clear credentials on malformed 200 responses (treat as retryable)
- Clear credentials on explicit 400/401 auth-invalid responses
- Add text() to all refresh-path test mocks
- Add regression tests for malformed 200 and 401 responses

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

---------

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-12 11:08:23 +08:00
易良
19f2d292f9
fix(core): fall back to CLI confirmation when IDE diff open fails (#3031)
* refactor: centralize IDE diff interaction in CoreToolScheduler

- Move openDiff/confirmation handling from edit.ts and write-file.ts into
  CoreToolScheduler.openIdeDiffIfEnabled(), called after permission hooks
- Use structuredClone in buildInvocation to prevent params mutation leaking
  to LLM history (fixes #2709 token waste)
- Use confirmationDetails as single data source for IDE diff content,
  only rely on ModifyContext.createUpdatedParams() for parameter transform
- Skip inline modify when IDE content unchanged, preserving original tool
  params for multi-edit-on-same-file scenarios (mitigates #2702)
- Remove ideConfirmation field from ToolEditConfirmationDetails
- Remove dead resolveIdeDiffForOutcome from ACP Session.ts
- Fix memory tool scope fallback in createUpdatedParams

Closes #2709
Closes #2673

* fix(core): fall back to CLI confirmation when IDE diff open fails

* fix(core): narrow IDE diff error handling scope

---------

Co-authored-by: 胡玮文 <huweiwen.hww@alibaba-inc.com>
Co-authored-by: tanzhenxin <tanzhenxing1987@gmail.com>
2026-04-12 10:39:56 +08:00
tanzhenxin
56392c7397
fix: lazy-load channel plugins to eliminate DEP0040 startup warning (#3134)
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: lazy-load channel plugins to eliminate DEP0040 startup warning

Channel plugins (telegram/weixin/dingtalk) were eagerly imported at
module load time via channel-registry.ts, which transitively loaded
grammy → node-fetch@2 → whatwg-url@5 → require("punycode"), triggering
the DEP0040 deprecation warning on every CLI invocation (Node 22+).

Switch to dynamic import() so plugins are only loaded when a user
actually runs `qwen channel` subcommands.

* fix(channels): use cached promise in ensureBuiltins to prevent race condition

Replace boolean flag with a cached promise so concurrent callers
properly await the same initialization instead of seeing an empty
registry.
2026-04-11 17:04:43 +08:00
tanzhenxin
7219469285
fix(channels): apply proxy settings to channel start command (#3136)
`qwen channel start` never calls `loadCliConfig`, so the proxy
configured via `--proxy` or `HTTPS_PROXY`/`HTTP_PROXY` env vars
was not applied. This caused Telegram's `getMe` (and all other
channel HTTP traffic) to bypass the proxy entirely.

The fix has two parts:

1. Resolve proxy in `start.ts` bootstrap and call
   `setGlobalDispatcher(new ProxyAgent(...))` for native fetch()
   calls (file downloads, other channels). This mirrors the same
   pattern used by Config constructor in the main CLI path.

2. Thread the proxy URL through `ChannelBaseOptions` so adapters
   can configure their own HTTP clients. TelegramAdapter passes
   an `HttpsProxyAgent` to grammy's `baseFetchConfig.agent` since
   grammy uses node-fetch which ignores undici's global dispatcher.

Fixes #3122
2026-04-11 16:44:14 +08:00
tanzhenxin
e216ab35fc
fix(core): cap recursive file crawler at 100k entries to prevent OOM (#3138)
When the @ autocomplete triggers RecursiveFileSearch, the crawler
materialises the entire project tree into memory with no upper bound.
For very large workspaces (missing .gitignore, huge node_modules, home
directory as cwd) this pushes Node.js past its heap limit and crashes.

- Add `maxFiles` option to CrawlOptions; use fdir's withMaxFiles() to
  stop traversal early instead of post-hoc truncation
- Apply file-level ignore patterns during crawl via fdir filter() so
  ignored files don't consume the maxFiles budget
- Include maxFiles in the crawl cache key for correctness
- Set MAX_CRAWL_FILES = 100 000 in RecursiveFileSearch (caps peak
  memory at ~50 MB for the file list)

Fixes #3130
2026-04-11 16:44:02 +08:00
Shaojin Wen
61ad9db9c1
feat(cli): queue input editing — pop queued messages for editing via ↑/ESC (#2871)
* feat(cli): add queue input editing via Up arrow key

Allow users to edit queued messages by pressing the Up arrow key when
the cursor is at the top of the input. All queued messages are popped
into the input field for revision before resubmission, reducing wasted
turns from incorrect queued instructions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: add missing mocks for InputPrompt tests and attachment mode guard

- Add popAllQueuedMessages mock and messageQueue to UIState/UIActions
  mocks in InputPrompt.test.tsx to fix 25 test failures
- Add !isAttachmentMode guard to prevent queue pop from conflicting
  with attachment navigation
- Add single-message popAllMessages test case

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address Copilot review - restrict to Up arrow, add tests, update docs

- Only trigger queue pop on NAVIGATION_UP (arrow key), not HISTORY_UP
  (Ctrl+P), preserving existing Ctrl+P history navigation behavior
- Update AsyncMessageQueue class docs to describe popLast() LIFO semantics
- Add InputPrompt tests: Up arrow pops queue, Up arrow falls back to
  history when queue empty, Ctrl+P not intercepted by queue pop

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: update fileoverview docs and make popAllMessages atomic via ref

- Update @fileoverview to describe FIFO+LIFO capability instead of
  "Simple FIFO queue"
- Use queueRef to make popAllMessages atomic, preventing duplicate
  pops from key auto-repeat before React re-renders

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: sync queueRef in addMessage/clearQueue and fall through on null pop

- Update queueRef inside addMessage setter and clearQueue to keep ref
  in sync between renders, preventing stale reads after clearQueue
- When popAllQueuedMessages returns null (queue already cleared), fall
  through to normal history navigation instead of consuming the key

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: remove dead popLast() and align popAllMessages separator to \n\n

- Remove unused AsyncMessageQueue.popLast() (no production callers)
- Change popAllMessages join separator from \n to \n\n for consistency
  with getQueuedMessagesText and auto-submit behavior

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: use hook's drainQueue for mid-turn drain to prevent double-consumption race

The midTurnDrainRef previously used a separate messageQueueRef (synced
from React state), while popAllMessages uses the hook's internal
queueRef. If a tool completed between popAllMessages clearing queueRef
and React re-rendering, midTurnDrainRef would read stale data and
consume the same messages a second time.

Switching to the hook's drainQueue makes both paths read from the same
synchronous ref, eliminating the window for double consumption.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: add missing popAllMessages mock and prepend branch test

Add popAllMessages to useMessageQueue mock in AppContainer tests.
Add test for prepending queued messages before existing input text.

* feat: add ESC trigger, cursor preservation, and progressive hint

- ESC pops queued messages before double-ESC clear logic
- Cursor stays at user's editing position after pop via moveToOffset
- Extract popQueueIntoInput helper to share logic between Up and ESC
- QueuedMessageDisplay hint hides after 3 empty→non-empty transitions

* test: add null-pop fallthrough test for queue race condition

Verify that when React state shows non-empty queue but the ref is
already drained (popAllQueuedMessages returns null), Up arrow falls
through to normal history navigation instead of getting stuck.

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 14:38:32 +08:00
tanzhenxin
57213e9ce6
fix: use latest assistant token count on resume instead of stale compression checkpoint (#3109)
* fix: use latest assistant token count on resume instead of stale compression checkpoint

When resuming a session that had /compress followed by more messages,
getResumePromptTokenCount would return the compression checkpoint's
newTokenCount instead of the more recent assistant message's
totalTokenCount. This caused the status line to show a stale context
usage value until the first new API call.

Fixes #3107

* fix: simplify getResumePromptTokenCount with early returns and zero-guard

Restructure to return early for both branches (assistant usage and
compression checkpoint) instead of accumulating a fallback. Skip
zero/placeholder assistant usage so it doesn't override a valid
compression checkpoint. Add tests for the two key scenarios.
2026-04-11 13:02:50 +08:00
tanzhenxin
285a627886
fix(input): preserve tab characters in pasted content (#3045)
* fix(input): preserve tab characters in pasted content

Tab-separated data pasted from spreadsheets (e.g. Excel) was silently
lost through three interception layers: stripUnsafeCharacters filtered
tab as a C0 control char, TextInput consumed tab for autocomplete, and
InputPrompt consumed tab for suggestion acceptance.

- Add tab (0x09) to the preserve list in stripUnsafeCharacters
- Skip tab→autocomplete interception when key.paste is true
- Skip tab→suggestion-accept in InputPrompt when key.paste is true

* test: skip flaky AskUserQuestionDialog test on Windows

The "shows unanswered questions as (not answered) in Submit tab" test
fails intermittently on Windows CI due to arrow key navigation timing
issues in the ink test renderer.
2026-04-11 13:02:39 +08:00
tanzhenxin
6f693f1b71
fix(cli): check NEWLINE before SUBMIT in TextInput to fix multiline input (#3068) (#3094)
The `|| key.name === 'return'` fallback in TextInput matched every Return
keypress (Shift+Enter, Ctrl+Enter, etc.) and routed them all to the submit
path, making the NEWLINE handler dead code. Multiline inputs like the agent
creation description step could not insert newlines via keyboard.

Reorder checks so NEWLINE is evaluated first in multiline mode, and restrict
the broad return fallback to single-line inputs only.
2026-04-11 13:02:28 +08:00
Shaojin Wen
2ac099caaf
fix: prevent statusline script from corrupting settings.json (#3091)
* fix: prevent statusline script from corrupting settings.json

Some models generate shell commands with complex quoting (e.g. single-quote
escaping like '\'') that break JSON syntax when written to settings.json,
causing qwen-code to fail to start with a FatalConfigError.

This adds four layers of defense:

1. **Agent prompt** (builtin-agents.ts): Require commands using jq/pipes/quotes
   to be saved as script files instead of inline in settings.json. Mark examples
   as script-only to prevent models from copying them inline.

2. **Write validation** (commentJson.ts): Validate JSON output before writing
   to disk in updateSettingsFilePreservingFormat.

3. **Startup recovery** (settings.ts): When settings.json has invalid JSON,
   try .orig backup first, then degrade gracefully to empty settings instead
   of crashing. Rename corrupted file to .corrupted for manual recovery.
   Show warning to user via migrationWarnings.

4. **Test update** (settings.test.ts): Update test to verify graceful
   degradation behavior instead of expecting FatalConfigError.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address review comments on statusline JSON corruption fix

1. Backup recovery now surfaces warning via migrationWarnings (reviewer: P2 correctness)
2. Corrupted file uses timestamped suffix to avoid overwriting (reviewer: P2 robustness)
3. Remove misleading underscore prefix on used catch variable (reviewer: P2 code quality)
4. updateSettingsFilePreservingFormat returns boolean (reviewer: P2 correctness)
5. Add 3 new tests: backup recovery, both-corrupted, rename-failure (reviewer: P2 testing)
6. Consistent shebang lines in agent prompt examples (reviewer: P3 nit)
7. Improve catch block error message for backup recovery (reviewer: P2 correctness)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: warningMsg says "renamed" even when rename fails

Move warningMsg construction after renameSync so the message accurately
reflects the outcome: "renamed to X" on success, "fix manually" on failure.
Add assertion to rename-failure test verifying the fallback message.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 11:55:18 +08:00
Shaojin Wen
ec1787b846
fix(cli): improve markdown table rendering in terminal (#2914)
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(cli): improve markdown table rendering in terminal

* fix(cli): restore theme colors and inline markdown rendering in tables

Improvements over previous commit:
- Restore theme.border.default color for table borders
- Restore theme.text.link color + bold for table headers
- Add renderMarkdownToAnsi() to render **bold**, `code`, *italic*,
  ~~strikethrough~~, <u>underline</u>, [links](url), and bare URLs
  as ANSI-styled text in table cells (mirrors RenderInline behavior)
- Use raw ANSI escape codes instead of chalk (chalk.level=0 in tests)
- Remove dead code: INLINE_MARKDOWN_REGEX, hasInlineMarkdown,
  ANSI_BOLD_START/END constants, unused vi/beforeEach in tests
- Update 8 snapshots to reflect themed output

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(cli): address Copilot review comments on table rendering

- renderRowLines: normalize cells to exactly colCount (pad/truncate)
  to prevent undefined access when row has fewer cells than headers
- calculateMaxRowLines: iterate colCount instead of row.length to
  prevent undefined columnWidths access for extra cells
- tableSeparatorRegex: add (?=.*\|) lookahead to require at least one
  pipe character, preventing `---` (horizontal rule) from being
  mis-parsed as a table separator
- Add test: horizontal rule after pipe line is not a table separator

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(cli): address Copilot round-2 review on table rendering

- idealWidths: use getRenderedWidth() (markdown→ANSI→stripAnsi→stringWidth)
  instead of getPlainTextLength() so link URLs are accounted for in
  column width calculation
- calculateMaxRowLines: use getFormattedCellText() (same as renderRowLines)
  so vertical fallback decision matches actual rendered row height
- renderVerticalFormat: normalize row to colCount (pad/truncate) for
  consistency with horizontal format
- renderVerticalFormat: render markdown in labels via renderMarkdownToAnsi()
  instead of showing raw syntax
- Remove unused getCellPlainText helper and getPlainTextLength import

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(cli): address Copilot round-3 review on table rendering

- Early return empty <Box /> when headers is empty (colCount === 0)
  to prevent malformed border output
- Always apply theme.text.link color to header cells regardless of
  ANSI content, matching original Ink implementation behavior
- Validate separator column count matches header column count before
  entering table mode, preventing mismatched separators like
  `| A | B |` followed by `|---|` from creating invalid tables
- Add test for column count mismatch detection
- Update 2 snapshots for consistent header link color

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(cli): address Copilot round-4 review on table rendering

- getMinWordWidth: use renderMarkdownToAnsi output so link URLs are
  included as unbreakable tokens in minimum column width calculation
- Remove now-unused stripInlineMarkdown function
- Header alignment: respect explicit alignment markers from separator;
  only default to center when no alignment is specified for the column
- Header color nesting: re-apply theme.text.link color after inner
  foreground resets (from inline code/links) to match Ink's nested
  color behavior where parent color is restored after child resets
- Add getColorCode() helper for extracting raw ANSI color escape

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(cli): address Copilot round-5 review on table rendering

- Apply theme.text.primary color to non-header cells and re-apply
  after inner foreground resets, matching header recolor behavior
- Use nullish coalescing (??) for vertical format labels so empty
  header strings are preserved instead of replaced with Column N

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(cli): re-apply cell color after full ANSI reset (\x1b[0m)

Add recolorAfterResets() helper that handles both \x1b[39m (foreground
reset) and \x1b[0m (full SGR reset). Applies to both header and body
cells so mixed ANSI content keeps consistent theme coloring.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(cli): apply recolorAfterResets to vertical format labels

Vertical fallback labels with inline markdown (code, URLs) now
re-apply link color after SGR resets, consistent with horizontal
header/body cell behavior.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(cli): apply primary color to vertical format values

Vertical fallback values now get theme.text.primary color with
recolorAfterResets, consistent with horizontal body cell styling.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(cli): preserve internal blank lines in wrapped cell content

wrapText now only trims trailing empty lines (wrap-ansi artifacts)
instead of filtering all empty lines, preserving intentional blank
lines within multi-paragraph cell content.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(cli): validate hex colors and deduplicate applyColor/getColorCode

- Add HEX_COLOR_RE validation; invalid hex like #ff00 or #gg0000
  now returns unchanged text instead of producing NaN in ANSI escapes
- Refactor applyColor to delegate to getColorCode, eliminating
  duplicated hex parsing logic

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(cli): precompute cell metrics and fix column width overflow

- Precompute per-cell rendered text, visible width, and min word width
  once via computeMetrics(), eliminating repeated renderMarkdownToAnsi
  calls across width calculation, max-row-lines check, and rendering
- Add post-pass in totalMin > availableWidth branch: shave wider
  columns until sum(columnWidths) <= availableWidth, preventing
  MIN_COLUMN_WIDTH floor from causing unnecessary vertical fallback
- Remove now-unused getMinWordWidth standalone function

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 11:10:01 +08:00
Lassana siby
9a636ef812
feat(i18n): add French (fr-FR) locale support (#3126)
* feat(i18n): add French (fr) locale translations

* fix translation key mismatch for 'Models: Qwen latest models'

fix translation key mismatch for 'Models: Qwen latest models'

Add missing trailing \n to the English lookup key so the French
translation is correctly matched by the i18n system.

Suggested by @wenshao in code review.

Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>

* fix(i18n): fix translation key mismatch for 'Models: Qwen latest models'

* fix(schema): add fr to settings.schema.json language enum

* fix(i18n): remove duplicate key 'Models: Qwen latest models' in fr.js

---------

Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>
2026-04-11 11:07:01 +08:00
易良
81ccbb976c
fix(cli): prioritize slash command completions (#3104) 2026-04-11 11:04:58 +08:00
Shaojin Wen
4c67670ef0
feat: show description for active setting in /settings dialog (#3116)
* feat: show description for active setting in /settings dialog

Display the schema description of the currently highlighted setting
below the settings list, so users can understand what each option does
without needing to check external documentation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: update SettingsDialog snapshots for description display

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 10:45:54 +08:00
Shaojin Wen
a7771bbb93
feat: replace text input with model picker for Fast Model in /settings (#3120)
The Fast Model setting in the settings dialog previously used a plain text
input, making it hard for users to discover available models. This replaces
it with the same model picker dialog used by `/model --fast`, adds a `▸`
visual indicator for sub-dialog settings, and supports right arrow to open
and left arrow to return.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 10:38:02 +08:00
易良
fb91acdf25
fix(vscode): force fresh ACP session on new-session action (#2874)
* fix(vscode-ide-companion/session): force fresh sessions for new chats

Ensure explicit new-session actions bypass active ACP session reuse so the VS Code sidebar clears context correctly.

Add regression coverage for the agent manager and webview new-session entry points.

* fix(vscode): remove core runtime imports from webview bundle

Replace the runtime import of `isSupportedImageMimeType` from
`@qwen-code/qwen-code-core` with a local `SUPPORTED_PASTED_IMAGE_MIME_TYPES`
set in the vscode-ide-companion package. The webview is bundled for a
browser environment where Node.js-only core modules are unavailable,
so keeping the MIME list local avoids esbuild failures during development.

Added tests to verify the local list stays aligned with core and that
the webview bundle does not contain core runtime imports.

* fix(vscode): reset context usage display on new session (#2847)

The webview context-usage bar did not clear when the user started a new
session because the old code always fell back to DEFAULT_TOKEN_LIMIT,
producing a stale percentage even after usageStats and modelInfo were
both cleared.

Key changes:
- Extract `knownTokenLimit()` in core/tokenLimits.ts that returns
  `undefined` for unrecognized models instead of a default, keeping
  `tokenLimit()` behavior unchanged.
- In acpModelInfo.ts, derive `_meta.contextLimit` from the known-model
  table when the ACP payload omits a numeric limit.
- Extract `computeContextUsage()` into its own module, which returns
  `null` when no trusted numeric limit is available — the UI then
  correctly hides the context bar.
- Remove the `@qwen-code/qwen-code-core` runtime import from App.tsx
  so the webview bundle stays free of Node-only dependencies.

Closes #2847

* fix(vscode-ide-companion/webview): reset state on new session

* test(vscode-ide-companion/webview): cover stale conversation reset

* fix(vscode): remove webview token limit runtime import

* fix(vscode): fully reset state for explicit new session

* fix(vscode-ide-companion/webview): clear residual state on new session

---------

Co-authored-by: tanzhenxin <tanzhenxing1987@gmail.com>
2026-04-11 10:16:16 +08:00
apophis
505be40f82
feat(cli): add CJK word segmentation with Intl.Segmenter (#2942) 2026-04-11 10:05:42 +08:00
易良
55bcec70d0
chore: bump version to 0.14.3 (#3112)
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
2026-04-10 21:08:34 +08:00
Shaojin Wen
520f1e2420
fix: add --fast hint to /model description for discoverability (#3086)
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
Add "(--fast for suggestion model)" to the /model command description
so users can discover the feature from the command list, since --fast
completion no longer appears on empty input.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 13:49:28 +08:00
易良
d8e06f5c91
fix: persist ProceedAlways permission outcome in compact mode (#3069)
Compact mode confirmation dialog uses ProceedAlways for "Allow always"
option, but persistPermissionOutcome() only handled ProceedAlwaysProject
and ProceedAlwaysUser, causing the permission to never be saved.

Now ProceedAlways is treated as project scope (same as ProceedAlwaysProject).
2026-04-10 13:45:34 +08:00
pomelo
cf81ac47ff
Merge pull request #3042 from YuchenLiang00/fix/context-command-detail-missing
fix(cli): add 'detail' subcommand to /context command
2026-04-10 12:12:07 +08:00
Shaojin Wen
5482044e59
fix: improve /model --fast description clarity and prevent accidental activation (#3077)
Replace vague "background tasks" with specific "prompt suggestions and speculative
execution" in the --fast flag description across all i18n locales, docs, and VS Code
schema. Update example model name from qwen3.5-flash to qwen3-coder-flash. Also fix
completion logic to require a non-empty partial arg before suggesting --fast, preventing
Tab+Enter from accidentally entering fast model mode.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 12:09:46 +08:00
Shaojin Wen
746f67f436
refactor: rename verboseMode to compactMode for better UX clarity (#3075)
The "Compact Mode" label is more intuitive than "Verbose Mode" for users,
as it directly describes the default compact view experience. This change
inverts the boolean semantics (compactMode=false means show full output)
and exposes the setting in the /settings dialog (showInDialog: true).

- Rename ui.verboseMode → ui.compactMode with inverted default (false)
- Rename VerboseModeContext → CompactModeContext (file and exports)
- Rename TOGGLE_VERBOSE_MODE → TOGGLE_COMPACT_MODE in key bindings
- Update all consumer components with inverted logic
- Update i18n keys across 6 locales (verbose → compact)
- Update VS Code settings schema
- Add ui.compactMode documentation to settings.md
- Fix Ctrl+O description in keyboard-shortcuts.md
2026-04-10 11:55:50 +08:00
tanzhenxin
98a0f78c4b
fix(weixin): add missing iLink headers to QR code login and clean up error output (#3044)
PR #2943 fixed headers in buildHeaders() but the login flow in
waitForLogin() still used a hardcoded incomplete header object.
Reuse the shared buildHeaders() so all endpoints send consistent
iLink-App-Id and iLink-App-ClientVersion headers.

Also wrap channel.connect() in startSingle() with a try/catch so
configuration errors print a clean message instead of dumping the
yargs help text and a stack trace.
2026-04-10 11:36:02 +08:00
克竟
5947512a79 fix: prevent Shift+Tab from accepting prompt placeholder suggestion (#3051)
Add !key.shift guard to the Tab key handler for prompt suggestion
acceptance, so Shift+Tab only toggles approval mode without inserting
the placeholder text into the input.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 20:18:09 +08:00
Edenman
4d2d4432d5
Merge pull request #2923 from QwenLM/feature/status-line-customization
Some checks are pending
Qwen Code CI / Post Coverage Comment (push) Blocked by required conditions
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 / 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
feat(ui): add customizable status line with /statusline command
2026-04-09 19:23:08 +08:00
qqqys
8119b90433
Merge pull request #2932 from QwenLM/feat/review-skill-improvements
feat(review): enhance /review with deterministic analysis, autofix, and security hardening
2026-04-09 19:14:03 +08:00
jinye
ea9c3196a6
fix: handle shadow repo init outside git repos (#3041)
Co-authored-by: jinye.djy <jinye.djy@alibaba-inc.com>
2026-04-09 18:54:23 +08:00
wenshao
f25fc047f1 test: add comprehensive tests for useStatusLine hook and statuslineCommand
Cover config validation, command execution with exec options, stdin JSON
payload, stale generation rejection, debouncing, config removal, cleanup
on unmount, EPIPE handling, command hot-reload, all state change triggers
(token count, model, branch, vim toggle, file lines), and process management.
2026-04-09 15:50:41 +08:00
wenshao
36aadd7fa1 fix: restore i18n keys for 'Press Ctrl+O to show full tool output'
The previous commit reverted the code to use the original i18n key
but the locale files still had the renamed key, causing translations
to not resolve.
2026-04-09 15:07:33 +08:00
wenshao
55116f86e3 fix: revert verbose mode hint to original descriptive text
Restore "Press Ctrl+O to show full tool output" which is clearer
than "toggle verbose mode" per PR review feedback.
2026-04-09 14:42:33 +08:00
zhangxy-zju
9c0bbfba6c
feat(plan): add "Yes, restore previous mode" option when exiting plan mode (#3008)
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
* feat(plan): add "Yes, restore previous mode" option when exiting plan mode

When exiting plan mode, users previously had no way to restore their
original approval mode (e.g. YOLO). Add a new default option that
restores the pre-plan approval mode, with a dynamic label showing
which mode will be restored.

Closes #3002

* test: add fallback test for RestorePrevious when no prePlanMode recorded

* fix: handle RestorePrevious in telemetry and ACP mode notification

- Add RestorePrevious to telemetry decision mapping as ACCEPT
- Fix sendCurrentModeUpdateNotification to read actual mode for
  RestorePrevious instead of defaulting to 'default'

* test: add plan confirmation tests for RestorePrevious in permissionUtils
2026-04-09 14:25:38 +08:00
易良
1356c05e3f
fix(permissions): match env-prefixed shell commands against saved permission rules (#2850)
* fix(permissions): match env-prefixed shell commands

Fixes #2846

* fix(core): improve shell command parsing for env vars and multiline commands

- Add dotAll flag to matchesCommandPattern for matching commands with embedded newlines
- Support newline operators in SHELL_OPERATORS for splitCompoundCommand
- Refactor getCommandRoot to skip leading VAR=value assignments
- Add test coverage for multiline commands and env var prefixed commands

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(permissions): tighten shell command parsing

Handle env-prefixed commands and quoted Windows paths consistently.

Keep newline splitting heredoc-aware and avoid false heredoc detection in comments or arithmetic expressions.

* refactor(permissions): simplify fix by reverting splitCompoundCommand rewrite

Remove ~350 lines of heredoc/comment/arithmetic parsing from
splitCompoundCommand that were not needed to fix #2846. Revert to
the original main version, keeping only the core env-var stripping
logic in matchesCommandPattern and getCommandRoot.

This addresses both reviewer concerns:
- heredoc breakage: no longer an issue since splitCompoundCommand is unchanged
- Windows quoted paths: handled correctly by shell-quote parse in getCommandRoot

---------

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-09 14:25:04 +08:00
pikachu
3e8b3c688f
fix(cli): serialize subagent confirmation focus to prevent concurrent input conflicts (#2930)
* fix: serialize subagent confirmation focus to prevent concurrent input conflicts

When multiple subagents run in parallel and each triggers a confirmation
prompt, all prompts previously received keyboard focus simultaneously,
causing a single keypress to be dispatched to every active confirmation.

This change introduces a first-come-first-served focus lock mechanism:
- Track subagents with pending confirmations via a type guard
- Use a useRef-based lock so only one confirmation is focused at a time
- Automatically promote focus to the next pending subagent on resolution
- Show a waiting indicator on non-focused confirmations

Fixes #2929

* fix(cli): use dedicated prop for subagent approval waiting state

---------

Co-authored-by: 思晗 <housihan.hsh@alibaba-inc.com>
2026-04-09 14:24:59 +08:00
顾盼
44c596cd14
feat: add wasm build config (#2985) 2026-04-09 14:21:00 +08:00
胡玮文
32e7b632b8
refactor: centralize IDE diff interaction in CoreToolScheduler (#2728)
- Move openDiff/confirmation handling from edit.ts and write-file.ts into
  CoreToolScheduler.openIdeDiffIfEnabled(), called after permission hooks
- Use structuredClone in buildInvocation to prevent params mutation leaking
  to LLM history (fixes #2709 token waste)
- Use confirmationDetails as single data source for IDE diff content,
  only rely on ModifyContext.createUpdatedParams() for parameter transform
- Skip inline modify when IDE content unchanged, preserving original tool
  params for multi-edit-on-same-file scenarios (mitigates #2702)
- Remove ideConfirmation field from ToolEditConfirmationDetails
- Remove dead resolveIdeDiffForOutcome from ACP Session.ts
- Fix memory tool scope fallback in createUpdatedParams

Closes #2709
Closes #2673
2026-04-09 14:20:48 +08:00
Shaojin Wen
d22b7e61ee
test: add tests for confirmation-bus, prompt-registry, and cli/core modules (#2272)
* test: add tests for confirmation-bus, prompt-registry, and cli/core modules

Add 42 new tests covering previously untested core modules:
- MessageBus: publish, subscribe/unsubscribe, request-response pattern (13 tests)
- PromptRegistry: register, dedup, query by server, clear, remove (11 tests)
- performInitialAuth: success, failure, no authType cases (3 tests)
- validateTheme: found, not found, no config cases (4 tests)
- initializeApp: i18n, auth, theme, IDE mode, auth dialog logic (11 tests)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: improve test quality - copyright headers, env safety, cleanup

- Fix copyright headers from Google LLC to Qwen Code in all 5 test files
- Use vi.stubEnv() instead of manual process.env mutation in initializer test
- Add removeAllListeners() cleanup in message-bus debug test
- Add void prefix to un-awaited publish() calls in message-bus test
- Verify invoke reference preserved after prompt rename in prompt-registry test

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test(message-bus): add AbortSignal coverage for request()

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 13:54:59 +08:00
YuchenLiang00
84f80201c7 fix(cli): add 'detail' subcommand to /context command
The /context command was missing the subcommand autocomplete feature
that other commands like /stats have. Now users can type '/context '
and see 'detail' as a suggestion in the dropdown.

- Added 'detail' subCommand to contextCommand with its own description
- Subcommand delegates to main action with 'detail' arg
- Added missing translation key for full description in zh.js
- Updated commands.md documentation

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-09 11:00:04 +08:00
tanzhenxin
e0aeee5414
chore: remove outdated pr-review skill (#3028)
* chore: remove outdated pr-review skill

The .qwen/skills/pr-review skill is outdated and no longer needed.
Also removes the dangling reference from terminal-capture skill.

* chore: add token-stats script to e2e-testing skill

* fix(test): remove flaky AskUserQuestionDialog Submit tab test

The "shows Submit tab for multiple questions" test fails on macOS CI
due to terminal width truncation causing "Submit answers" to render
as just "Submit".
2026-04-09 10:54:10 +08:00
qqqys
a0d08aa68d
fix(webui): fix chat input scrollbar not draggable in VS Code plugin (#2883) (#3038)
The gradient overlay div at the bottom of the chat input was intercepting
mouse events, preventing users from dragging the scrollbar. Add
pointer-events-none to the overlay and pointer-events-auto to the inner
content to allow scrollbar interaction while preserving the gradient effect.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-04-09 10:53:39 +08:00
tanzhenxin
af6c93daff
Merge pull request #2948 from QwenLM/fix-grep-permission
fix(core): add getDefaultPermission and allowExternalPaths to ripGrep tool
2026-04-09 10:51:08 +08:00
wenshao
76a66a2671 fix(review): comments array entries MUST have line numbers
LLM was putting findings in the comments array WITHOUT line numbers,
creating orphaned PR comments. Clarified: comments array entries MUST
have a valid line. Findings without a mappable diff line go in body.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 09:31:42 +08:00
wenshao
d510a77a28 fix(review): promote most-violated rules to top of prompt
Two rules repeatedly violated by LLMs despite being documented:
1. Language matching (Chinese output on English PRs)
2. Create Review API (falling back to individual gh api comments)

Moved both to a "Critical rules" section at the very top of the
prompt, before the design philosophy. Early placement = higher
attention from the LLM.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 09:27:27 +08:00
wenshao
88773194fa fix(review): add model attribution to zero-findings LGTM approval
The APPROVE path for zero findings was missing the model footer.
Added YOUR_MODEL_ID to the body.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 08:53:46 +08:00
wenshao
6de5c9e530 Merge remote-tracking branch 'origin/main' into feat/review-skill-improvements 2026-04-09 08:52:01 +08:00
wenshao
6014a61d39 fix(review): prevent YOUR_MODEL_ID from replacing explanatory text
replaceAll('YOUR_MODEL_ID', modelId) was also replacing the instruction
"The variable YOUR_MODEL_ID is declared..." → nonsensical text.
Removed the literal reference from the instruction line.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 02:39:52 +08:00
wenshao
df3cfd1e83 fix(review): prepend YOUR_MODEL_ID declaration for model attribution
Some models (e.g., glm-5.1) ignore the {{model}} template in code
blocks and write their own footer without the model name. Fix:

1. BundledSkillLoader prepends YOUR_MODEL_ID="glm-5.1" as a top-level
   declaration at the start of the skill body — impossible to miss
2. SKILL.md references YOUR_MODEL_ID in footer instructions
3. Empty model → empty string (no "unknown" — prefer omission)
4. YOUR_MODEL_ID declaration only prepended when model is available

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 02:38:17 +08:00