From c29cda3777f080345078e06ea4f5239f8dc32810 Mon Sep 17 00:00:00 2001 From: Turtle Date: Mon, 19 Oct 2026 01:45:55 +0800 Subject: [PATCH] Clarify approval policy switch notice wording Name each policy by its meaning in the model-visible switch notice so a bare "never" is not read as "approval is never granted". Refs #6496 Co-authored-by: Tianyi Cui <53024+tianyicui@users.noreply.github.com> --- .../permission-presets/tests/projection.spec.ts | 2 +- packages/interaction/user-approval/README.i18n.yaml | 7 +++++-- packages/interaction/user-approval/README.md | 8 +++++++- packages/interaction/user-approval/README.zh.md | 8 +++++++- packages/interaction/user-approval/src/index.ts | 7 ++++++- packages/interaction/user-approval/tests/approval.spec.ts | 2 +- 6 files changed, 27 insertions(+), 7 deletions(-) diff --git a/packages/interaction/permission-presets/tests/projection.spec.ts b/packages/interaction/permission-presets/tests/projection.spec.ts index 6b82374298..d1d98d7c66 100644 --- a/packages/interaction/permission-presets/tests/projection.spec.ts +++ b/packages/interaction/permission-presets/tests/projection.spec.ts @@ -169,7 +169,7 @@ describe('/permission command', () => { expect(inject.mock.calls[0]?.[0]).toMatchObject({ content: [{ type: 'text', - text: 'The approval policy changed from "ask" to "never" (changed by the user).', + text: 'The user changed the approval policy from "ask the user for approval" to "never ask the user for approval".', }], }) const run = session.snapshotEvents().find(event => event.type === 'command/run') diff --git a/packages/interaction/user-approval/README.i18n.yaml b/packages/interaction/user-approval/README.i18n.yaml index 88bac2611d..cfa4ba0f1c 100644 --- a/packages/interaction/user-approval/README.i18n.yaml +++ b/packages/interaction/user-approval/README.i18n.yaml @@ -54,14 +54,17 @@ en: d23980f003b42fbb zh: 532f0174de5d87b5 /deepseek-ai-dsh-user-approval/model-experience/current-approval-policy-context/what-the-model-sees: - en: a38775858ccd61f3 - zh: c19c76827be7aabf + en: eb41f1a4972c07f5 + zh: 4264f408eb951951 /deepseek-ai-dsh-user-approval/model-experience/current-approval-policy-context/what-the-model-sees/ask-policy-contribution: en: b9f1262c97ec7568 zh: 8a6613695f896f70 /deepseek-ai-dsh-user-approval/model-experience/current-approval-policy-context/what-the-model-sees/never-policy-contribution: en: f13f09fc2466513b zh: 4a755a682551c481 +/deepseek-ai-dsh-user-approval/model-experience/current-approval-policy-context/what-the-model-sees/switch-notice: + en: e87e1e28ae7d7243 + zh: c6daddb5a131565a /deepseek-ai-dsh-user-approval/model-experience/current-approval-policy-context/token-effect: en: e96807422bdce44d zh: 9fdcfafcc96bd004 diff --git a/packages/interaction/user-approval/README.md b/packages/interaction/user-approval/README.md index d94986a978..09fa41c6bc 100644 --- a/packages/interaction/user-approval/README.md +++ b/packages/interaction/user-approval/README.md @@ -112,7 +112,7 @@ Read these pages when the package-level contract is not enough. They move from t #### What the model sees -The first request and each effective policy change append a full runtime-context snapshot after retained history. Under `ask`, the approval contribution states that configured answerers may be consulted and absence fails closed. Under `never`, it states the deterministic rejection and non-escalation consequence. Unchanged requests retain the earlier snapshot without adding another message. +The first request and each effective policy change append a full runtime-context snapshot after retained history. Under `ask`, the approval contribution states that configured answerers may be consulted and absence fails closed. Under `never`, it states the deterministic rejection and non-escalation consequence. Unchanged requests retain the earlier snapshot without adding another message. When the user switches a live Session's policy, the next model step also receives a switch notice. ##### Ask-policy contribution @@ -126,6 +126,12 @@ Approval policy: ask. Operations that require approval may ask through the confi Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`). ``` +##### Switch notice + +```markdown +The user changed the approval policy from "ask the user for approval" to "never ask the user for approval". +``` + #### Token effect One concise context message on the first request and on an effective change; unchanged requests add no duplicate policy tokens. diff --git a/packages/interaction/user-approval/README.zh.md b/packages/interaction/user-approval/README.zh.md index 1d523081d2..b14ab1904f 100644 --- a/packages/interaction/user-approval/README.zh.md +++ b/packages/interaction/user-approval/README.zh.md @@ -112,7 +112,7 @@ kind: "package-reference" #### 模型看到的内容 -首次请求与有效策略每次变化时,都会在保留的历史后追加一份完整运行时上下文快照。在 `ask` 下,审批上下文内容会说明系统可以咨询已配置的应答者,缺少可用应答者时则以拒绝方式关闭。在 `never` 下,它会说明确定性的拒绝与非升权后果。未变化的请求会保留先前快照,不增加另一条消息。 +首次请求与有效策略每次变化时,都会在保留的历史后追加一份完整运行时上下文快照。在 `ask` 下,审批上下文内容会说明系统可以咨询已配置的应答者,缺少可用应答者时则以拒绝方式关闭。在 `never` 下,它会说明确定性的拒绝与非升权后果。未变化的请求会保留先前快照,不增加另一条消息。用户切换运行中 Session 的策略时,下一次模型调用还会收到一条切换通知。 ##### Ask 策略贡献 @@ -126,6 +126,12 @@ Approval policy: ask. Operations that require approval may ask through the confi Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`). ``` +##### 切换通知 + +```markdown +The user changed the approval policy from "ask the user for approval" to "never ask the user for approval". +``` + #### Token 影响 首次请求和策略实际变化时增加一条简洁的上下文消息;未变化的请求不增加重复的策略 token。 diff --git a/packages/interaction/user-approval/src/index.ts b/packages/interaction/user-approval/src/index.ts index 978f6a7092..4c6f57702b 100644 --- a/packages/interaction/user-approval/src/index.ts +++ b/packages/interaction/user-approval/src/index.ts @@ -74,6 +74,11 @@ export const APPROVAL_POLICIES: readonly ApprovalPolicy[] = ['ask', 'never'] const NEVER_SENTENCE = 'Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`).' /** Model-facing statement for an interactive policy that may still fail closed. */ const ASK_SENTENCE = 'Approval policy: ask. Operations that require approval may ask through the configured answerers; without an available answerer, the request fails closed.' +/** Model-facing policy names in switch notices; a bare `never` reads as "approval is never granted". */ +const POLICY_NOTICE_NAMES: Readonly> = { + ask: 'ask the user for approval', + never: 'never ask the user for approval', +} interface ApprovalState { policy: ApprovalPolicy | null @@ -210,7 +215,7 @@ export class ApprovalService extends Service { agent.inject(createUserMessage({ content: [{ type: 'text', - text: `The approval policy changed from "${previous}" to "${policy}" (changed by the user).`, + text: `The user changed the approval policy from "${POLICY_NOTICE_NAMES[previous]}" to "${POLICY_NOTICE_NAMES[policy]}".`, }], source: { kind: 'user-approval' }, })) diff --git a/packages/interaction/user-approval/tests/approval.spec.ts b/packages/interaction/user-approval/tests/approval.spec.ts index dac2e822c7..018518ee76 100644 --- a/packages/interaction/user-approval/tests/approval.spec.ts +++ b/packages/interaction/user-approval/tests/approval.spec.ts @@ -466,7 +466,7 @@ describe('approval policy (the approval/policy fold)', () => { expect(inject.mock.calls[0]?.[0]).toMatchObject({ content: [{ type: 'text', - text: 'The approval policy changed from "ask" to "never" (changed by the user).', + text: 'The user changed the approval policy from "ask the user for approval" to "never ask the user for approval".', }], source: { kind: 'user-approval' }, })