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 <[email protected]>
This commit is contained in:
TurtleandTianyi Cui authored and Tianyi Cui committed 2026-10-22 23:13:19 +08:00
1 parent 70e2d31cc3
commit c29cda3777
6 files changed
+27 -7

No files matched your search

@@ -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')
@@ -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
+7 -1
View File
@@ -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.
@@ -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。
@@ -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<Record<ApprovalPolicy, string>> = {
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' },
}))
@@ -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' },
})