Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
6ab42db
feat: add hybrid code mode
DragonnZhang Sep 14, 2026
fda09c0
fix(core): address hybrid code mode review feedback
DragonnZhang Sep 15, 2026
9a0cd57
chore: merge main into code mode branch
DragonnZhang Sep 15, 2026
30b2a6c
fix(code-mode): address review feedback
DragonnZhang Sep 18, 2026
6c919b7
fix(web-shell): map tool mode setting alias
DragonnZhang Sep 18, 2026
02afce8
fix(core): align code mode bindings and reported tool surfaces
DragonnZhang Sep 20, 2026
2ecf53e
merge: sync main and preserve CodeMode context tests
DragonnZhang Sep 20, 2026
4a38632
merge: preserve hybrid execution with stable tool bridge
DragonnZhang Sep 21, 2026
3239c68
fix: repair web-shell alias tests and address code-mode review feedback
qwen-code-ci-bot Sep 22, 2026
f35beb1
Merge remote-tracking branch 'origin/main' into dragon/add-codemode
qwen-code-ci-bot Sep 22, 2026
28df8ee
fix: align hybrid tool guidance with available invocation surfaces
DragonnZhang Sep 22, 2026
a7315eb
fix: address code-mode review feedback on exec binding narrowing and …
qwen-code-ci-bot Sep 22, 2026
3c69762
Merge branch 'main' into dragon/add-codemode
qwen-code-dev-bot Sep 23, 2026
34711cf
fix(core): avoid unverified agent zoom hints and clarify tool exposure
DragonnZhang Sep 23, 2026
ce7e57d
Merge remote-tracking branch 'origin/main' into dragon/add-codemode
qwen-code-ci-bot Sep 23, 2026
fa457bd
fix(core): narrow MCP nested bindings by the agent tools allowlist
qwen-code-ci-bot Sep 23, 2026
ae35809
fix(core): keep CodeModeOnly exec expansion from bypassing MCP narrowing
qwen-code-ci-bot Sep 24, 2026
4c53574
Merge branch 'main' into dragon/add-codemode
qwen-code-dev-bot Sep 24, 2026
22a9a40
fix: preserve code-mode fork boundaries and update mode guidance
DragonnZhang Sep 26, 2026
779d689
merge: refresh main OAuth discovery before publishing code-mode fixes
DragonnZhang Sep 26, 2026
b1561b7
fix: preserve nested-only fork access and legacy mode resets
DragonnZhang Sep 27, 2026
e6fbdcd
fix(core): preserve empty tool policies when syncing main
DragonnZhang Sep 28, 2026
6edd151
fix: merge main and translate current tool mode settings
DragonnZhang Sep 28, 2026
f746b88
fix(core): merge main and preserve hybrid skill lifecycle
DragonnZhang Oct 1, 2026
ed2e58c
fix(core): merge main and preserve hybrid agent permissions
DragonnZhang Oct 3, 2026
4a72ef8
fix(core): align child skill routes and merge current main
DragonnZhang Oct 4, 2026
cad9407
fix(core): retain code-mode behavior with current main
DragonnZhang Oct 5, 2026
1df2386
fix(cli): align tool mode readouts and merge main
DragonnZhang Oct 6, 2026
71ab2c9
fix(core): preserve code mode policy when merging MCP rule fixes
DragonnZhang Oct 7, 2026
68ceea7
Merge branch 'main' into dragon/add-codemode
qwen-code-dev-bot Oct 7, 2026
f669bd7
Merge branch 'main' into dragon/add-codemode
qwen-code-dev-bot Oct 7, 2026
f183ce0
fix(core): align hybrid tool visibility and prompt budgets
DragonnZhang Oct 8, 2026
71b8502
fix(core): keep nested-only allowlists from revoking hybrid direct de…
Oct 8, 2026
4a122a6
Merge branch 'main' into dragon/add-codemode
qwen-code-dev-bot Oct 8, 2026
e81694c
fix(core): align Skill listings with exec permission bounds
DragonnZhang Oct 9, 2026
5afe0ce
fix(core): preserve direct Skill activation with nested restrictions
DragonnZhang Oct 9, 2026
e1d295c
Merge branch 'main' into dragon/add-codemode
qwen-code-dev-bot Oct 9, 2026
3dd719a
fix(core): gate the code-mode skill route on exec registration (#11854)
Oct 9, 2026
10d221a
Merge remote-tracking branch 'origin/main' into dragon/add-codemode
Oct 10, 2026
9b41dc0
fix(core): close CodeModeOnly skill-listing bypass without exec (#11854)
Oct 10, 2026
7faeea6
test(cli): align OpenTUI settings region tests with tools.mode (#11854)
Oct 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: merge main and translate current tool mode settings
  • Loading branch information
DragonnZhang committed Sep 28, 2026
commit 6edd151087e14710ffa2e2b5959823f2c6f76fd0
28 changes: 0 additions & 28 deletions packages/cli/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,34 +183,6 @@ function resolveToolModeSetting(tools: Settings['tools']): {
return { mode: ToolMode.Direct };
}

function formatApprovalModeError(value: string): Error {
return new Error(
`Invalid approval mode: ${value}. Valid values are: ${APPROVAL_MODES.join(
', ',
)}`,
);
}

/**
* Normalizes an approval-mode spelling exactly the way boot accepts it:
* trimmed, lowercased, with the legacy `auto_edit`/`autoedit` aliases mapped
* to AUTO_EDIT. Throws for values boot would reject. Shared with the ACP
* daemon's reload convergence so a settings file reload agrees with boot for
* every accepted spelling.
*/
export function parseApprovalModeValue(value: string): ApprovalMode {
const normalized = value.trim().toLowerCase();
const canonical =
normalized === 'auto_edit' || normalized === 'autoedit'
? ApprovalMode.AUTO_EDIT
: normalized;
const approvalMode = APPROVAL_MODES.find((mode) => mode === canonical);
if (approvalMode === undefined) {
throw formatApprovalModeError(value);
}
return approvalMode;
}

export interface CliArgs {
query: string | undefined;
model: string | undefined;
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/tools/tool-registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import fs from 'node:fs';
import { MockTool } from '../test-utils/mock-tool.js';
import type { MediaPolicyToolDescriptor } from './tools.js';
import { CHARS_PER_TOKEN } from '../services/tokenEstimation.js';
import { ToolMode } from './code-mode.js';

import { McpClientManager } from './mcp-client-manager.js';
import {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/tools/tool-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1254,6 +1254,7 @@ export class ToolRegistry {
toolNames: string[],
codeModeAllowedNames?: ReadonlySet<string>,
): FunctionDeclaration[] {
if (toolNames.length === 0) return [];
if (this.factories.size > 0) {
debugLogger.warn(
`getFunctionDeclarationsFiltered() called with ${this.factories.size} unloaded ` +
Expand Down
6 changes: 3 additions & 3 deletions packages/web-shell/client/settings/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,9 @@ export const SETTINGS_MESSAGES_ZH: Record<string, SettingsMessage> = {
'settings.label.tools.listDirectory.enabled': '启用 ListDirectory',
'settings.description.tools.listDirectory.enabled':
'启用内置 list_directory 工具。默认关闭;当它被显式列入 coreTools 白名单(--core-tools / tools.core)时会自动启用。',
'settings.label.tools.codeModeOnly': '仅代码模式(实验性)',
'settings.description.tools.codeModeOnly':
'普通工具只通过隔离的 exec JavaScript 工具暴露给模型。直接控制类工具仍然可用。在 safe 和 bare 模式下忽略。',
'settings.label.tools.mode': '工具模式(实验性)',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] R1-32: The row became an enum but the ZH dictionary only translates its label and description — the three option labels have no settings.option.tools.mode.* entries, so a zh-CN user gets the raw English schema labels.

With language zh-CN, open Settings → Tools → 工具模式(实验性). SettingsMessage.tsx:745-757 builds the picker from the daemon descriptor and calls formatSettingOption, which looks up settings.option.tools.mode.direct|code_mode|code_mode_only; none exist (repo-wide grep for settings.option.tools.mode returns zero source hits), so translateSettingText falls back to the served labels — { value: ToolMode.Direct, label: 'Default' } etc. (packages/cli/src/config/settingsSchema.ts:2917-2919, forwarded verbatim by buildSettingsResponse at packages/cli/src/serve/routes/workspace-settings.ts:233). The Chinese panel therefore shows "Default / Code Mode / Code Mode Only" under a fully Chinese label and description, while every other enum in this same ZH map is translated — settings.option.ui.chatWidth.* (messages.ts:192-193), settings.option.review.effort.* (234-237), settings.option.model.reasoningEffort.* (307-311), settings.option.tools.workflowSizeGuideline.* (362-366), settings.option.policy.permissionStrategy.* (377-380). Before this diff the row was a boolean rendered through the already-translated settings.value.on/off, so the untranslated option list is new. "Default" is also the least self-describing of the three for a Chinese reader, since the description calls that mode "Direct".

Witness:

not run — probe/mutation via `review scratch-tree` and `base-tree`: unavailable in this environment (repo-local git includeIf resolves to a missing credentials file, so scratch-tree refuses to create a tree; the base build timed out), so the verdict rests on a line-by-line source trace plus repo-wide greps

Suggested fix: Add the three option keys next to the new label/description, e.g. 'settings.option.tools.mode.direct': '直接(默认)', 'settings.option.tools.mode.code_mode': 'Code Mode', 'settings.option.tools.mode.code_mode_only': 'Code Mode Only' (keeping the two proper-noun mode names as-is if that is the intended house rendering).

The fix must not violate this existing fact: Keys must be spelled exactly settings.option.${setting.key}.${String(value)} (packages/web-shell/client/components/messages/SettingsMessage.tsx:186) with the values the schema ships — { value: ToolMode.Direct, label: 'Default' }, { value: ToolMode.CodeMode, ... }, { value: ToolMode.CodeModeOnly, ... } (packages/cli/src/config/settingsSchema.ts:2917-2919), i.e. direct / code_mode / code_mode_only, not the label text.

Acceptance criterion: A case in packages/web-shell/client/components/messages/SettingsMessage.dom.test.tsx (or a new collocated settings/messages.test.ts) that renders/derives the option list for a tools.mode enum descriptor under the zh-CN dictionary and asserts the Direct option is not the raw schema label 'Default' — equivalently, asserts SETTINGS_MESSAGES_ZH['settings.option.tools.mode.direct'] is defined. Delete the added keys and that assertion must go red; no existing test covers it (`SettingsMessage Please prove it by removing the fix and confirming that test goes red.

中文说明

该行变成了枚举,但中文字典只翻译了它的 label 和 description——三个选项标签没有对应的 settings.option.tools.mode.* 条目,因此 zh-CN 用户在完全中文的标签与描述下会看到原始的英文选项 "Default / Code Mode / Code Mode Only"。同一 diff 已为 CLI 翻译了这三个标签并加了 must-translate 测试,可见 web-shell 这一处属于遗漏而非有意。

— qwen3.8-max via Qwen Code /review (v0.25.0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] R1-32: The row became an enum but the ZH dictionary only translates its label and description — the three option labels have no settings.option.tools.mode.* entries, so a zh-CN user gets the raw English schema labels.

With language zh-CN, open Settings → Tools → 工具模式(实验性). SettingsMessage.tsx:745-757 builds the picker from the daemon descriptor and calls formatSettingOption, which looks up settings.option.tools.mode.direct|code_mode|code_mode_only; none exist (repo-wide grep for settings.option.tools.mode returns zero source hits), so translateSettingText falls back to the served labels — { value: ToolMode.Direct, label: 'Default' } etc. (packages/cli/src/config/settingsSchema.ts:2917-2919, forwarded verbatim by buildSettingsResponse at packages/cli/src/serve/routes/workspace-settings.ts:233). The Chinese panel therefore shows "Default / Code Mode / Code Mode Only" under a fully Chinese label and description, while every other enum in this same ZH map is translated — settings.option.ui.chatWidth.* (messages.ts:192-193), settings.option.review.effort.* (234-237), settings.option.model.reasoningEffort.* (307-311), settings.option.tools.workflowSizeGuideline.* (362-366), settings.option.policy.permissionStrategy.* (377-380). Before this diff the row was a boolean rendered through the already-translated settings.value.on/off, so the untranslated option list is new. "Default" is also the least self-describing of the three for a Chinese reader, since the description calls that mode "Direct".

Witness:

not run — probe/mutation via `review scratch-tree` and `base-tree`: unavailable in this environment (repo-local git includeIf resolves to a missing credentials file, so scratch-tree refuses to create a tree; the base build timed out), so the verdict rests on a line-by-line source trace plus repo-wide greps

Suggested fix: Add the three option keys next to the new label/description, e.g. 'settings.option.tools.mode.direct': '直接(默认)', 'settings.option.tools.mode.code_mode': 'Code Mode', 'settings.option.tools.mode.code_mode_only': 'Code Mode Only' (keeping the two proper-noun mode names as-is if that is the intended house rendering).

The fix must not violate this existing fact: Keys must be spelled exactly settings.option.${setting.key}.${String(value)} (packages/web-shell/client/components/messages/SettingsMessage.tsx:186) with the values the schema ships — { value: ToolMode.Direct, label: 'Default' }, { value: ToolMode.CodeMode, ... }, { value: ToolMode.CodeModeOnly, ... } (packages/cli/src/config/settingsSchema.ts:2917-2919), i.e. direct / code_mode / code_mode_only, not the label text.

Acceptance criterion: A case in packages/web-shell/client/components/messages/SettingsMessage.dom.test.tsx (or a new collocated settings/messages.test.ts) that renders/derives the option list for a tools.mode enum descriptor under the zh-CN dictionary and asserts the Direct option is not the raw schema label 'Default' — equivalently, asserts SETTINGS_MESSAGES_ZH['settings.option.tools.mode.direct'] is defined. Delete the added keys and that assertion must go red; no existing test covers it (`SettingsMessage Please prove it by removing the fix and confirming that test goes red.

中文说明

该行变成了枚举,但中文字典只翻译了它的 label 和 description——三个选项标签没有对应的 settings.option.tools.mode.* 条目,因此 zh-CN 用户在完全中文的标签与描述下会看到原始的英文选项 "Default / Code Mode / Code Mode Only"。同一 diff 已为 CLI 翻译了这三个标签并加了 must-translate 测试,可见 web-shell 这一处属于遗漏而非有意。

— qwen3.8-max via Qwen Code /review (v0.25.0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deferred to the next round, not dropped: Critical-only mode is active on this PR (the takeover window was seeded at round 5) and the previous round exhausted its time budget, so this round landed only the blocking agent-core fixes — the R3-1 Critical (nested-only allowlists revoking hybrid direct declarations) and the exec-route listing/gate gap. This Suggestion stays open and is first in the next round's queue.

中文说明

本轮延后处理(并非忽略):本 PR 已处于仅处理 Critical 的模式(takeover 窗口从第 5 轮起算),且上一轮已耗尽时间预算,因此本轮只落地了阻断性的 agent-core 修复(R3-1:nested-only 白名单撤销 hybrid 直接声明;以及 exec 通道的列表/闸门分歧修复)。该建议保持开放,已排入下一轮队列。具体技术细节见上方英文正文。

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deferred to the next round, not dropped: Critical-only mode is active on this PR (the takeover window was seeded at round 5) and the previous round exhausted its time budget, so this round landed only the blocking agent-core fixes — the R3-1 Critical (nested-only allowlists revoking hybrid direct declarations) and the exec-route listing/gate gap. This Suggestion stays open and is first in the next round's queue.

中文说明

本轮延后处理(并非忽略):本 PR 已处于仅处理 Critical 的模式(takeover 窗口从第 5 轮起算),且上一轮已耗尽时间预算,因此本轮只落地了阻断性的 agent-core 修复(R3-1:nested-only 白名单撤销 hybrid 直接声明;以及 exec 通道的列表/闸门分歧修复)。该建议保持开放,已排入下一轮队列。具体技术细节见上方英文正文。

'settings.description.tools.mode':
'选择工具向模型暴露的方式。Direct 使用普通工具调用;Code Mode 额外提供隔离的 exec JavaScript 工具;Code Mode Only 仅通过 exec 暴露普通工具。safe 和 bare 模式始终使用 Direct。容器执行时,Code Mode 会警告并使用直接工具,Code Mode Only 则被拒绝。SSH 工作区会警告并将两种代码模式回退为 Direct。Code Mode Only 在会话工具界面忽略 eager/visible 的 schema 延迟加载:可调用工具保留完整嵌套 schema,tool_search 被隐藏。两种代码模式下,AgentCore 都不会将仍被 tools.eager 隐藏的工具加入嵌套绑定;未授予 exec 的智能体白名单会收窄嵌套绑定。继承或显式授予 exec 会保留其他规则允许的所有普通代码模式工具绑定。执行白名单只要提及任一 MCP 工具,就会进一步将 MCP 绑定限制为匹配的精确名称或服务器模式。',
'settings.label.tools.todoWrite.enabled': '启用 Todo Write',
'settings.description.tools.todoWrite.enabled':
'启用内置 todo_write 工具及其系统提示词引导。',
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.