Headless caller authority for Auto review
Headless 调用者对 Auto review 的授权
Headless, SDK, and ACP admit tasks with `source.kind: 'user'`. Auto must recognize those tasks as instructions without requiring a browser RPC identity. The message role alone is insufficient: injected context also uses the user role but names its own source.
English
Problem
Headless, SDK, and ACP admit tasks with source.kind: 'user'. Auto must recognize those tasks as instructions without requiring a browser RPC identity. The message role alone is insufficient: injected context also uses the user role but names its own source.
Decision
The experimental Auto layer supports explicit headless selection. Default profiles remain unchanged. This extends the Web-only scope of per-tool Auto review; its risk classes, full-access execution, PTC exclusions, and lifecycle remain authoritative.
The reviewer assigns user-sourced text the user-instruction role, including existing history and tasks admitted before Auto was selected. The user may be a human or a supervising caller. Both can define the task and authorize an exact medium-risk action, target, and scope. The current child's creation prompt and direct-parent messages keep their subordinate role; inherited and unverified creation prompts remain facts. Files, constraints, checkpoints, images, and tool results do not acquire instruction authority. Input producers own the source attribution; task text never selects its source. The message types and persisted fields remain unchanged.
Headless applies an explicit --approval-policy after selecting the permission preset. Saved policy continues when both options are omitted on resume. Pass --permission-mode auto --approval-policy never to select unattended Auto explicitly. This retains the structured denial and avoids dependence on a human answerer. ask still follows the approval fallback decision; it does not add a CLI approval transport. Application shutdown preserves the saved Auto selection. Restoring it requires the integration even when selecting another preset; removing the plugin while the application remains active still migrates live Sessions to Full access.
The JSON projection includes existing durable error fields under its normal output bounds. A final denial carries AutoReviewDeniedError / AUTO_REVIEW_DENIED and optional reviewer detail; a technical or parsing failure carries AutoReviewFailedError / AUTO_REVIEW_FAILED. Neither executes the tool body. Completed agent execution does not imply that every requested action succeeded.
Alternatives considered
Reuse a browser RPC id. A headless invocation is not a browser request. Faking that identity would couple authorization to a different transport and misdescribe the persisted source.
Add a headless admission marker. The existing user source already identifies task input. A transport-specific marker adds persisted metadata and reader rules without changing the required authority decision.
Promote every user-role message. Plugins also supply user-role context. The existing source discriminator distinguishes admitted user input from injected content.
A live caller-approval channel. Headless consumes stdin as one task. Approving a suspended call needs a bidirectional protocol with correlation, disconnect and cancellation handling, and an answerer lifecycle. A later invocation can instead supply scoped authorization and receive a fresh review, without claiming to approve the earlier call.
Consequences
A supervisor can use Auto for implementation and gates, inspect structured denials, and resume with revision instructions. Native tools keep all supported tool bodies under review; direct Node effects inside PTC remain outside it. The reviewer remains a fallible model with full-access consequences, and the integration remains experimental and opt-in. Custom producers that use the user source are treated as the user; background context must use its own source.
中文
Problem
Headless、SDK 和 ACP 以 source.kind: 'user' 接纳任务。Auto 必须将这些任务识别为指令,而不要求浏览器 RPC 身份。仅有消息角色不足以判断:注入上下文也使用 user role,但声明自己的 source。
Decision
实验性 Auto 层支持显式 headless 选择。默认 profile 保持不变。这扩展了逐工具 Auto review仅限 Web 的范围;其风险分类、完全访问执行、PTC 排除项和生命周期仍具权威性。
Reviewer 将 user-source 文本归为 user-instruction,包括已有历史和选择 Auto 前接纳的任务。用户可以是人或监督调用者;两者都可定义任务,并明确授权 medium 风险动作、准确目标和范围。当前 child 的创建 prompt 和直接父级消息保留从属角色;继承的创建 prompt 与无法验证的创建 prompt 仍是事实。文件、约束、checkpoint、图片和工具结果不会获得指令权威。输入生产者负责来源归属;任务文本不能选择自己的 source。消息类型和持久字段保持不变。
Headless 在选择权限预设后应用显式 --approval-policy。恢复时省略两个选项会延续已保存的策略。传入 --permission-mode auto --approval-policy never 可显式选择无人值守 Auto。这保留结构化拒绝,并避免依赖人工应答者。ask 仍遵循审批兜底决策;它不添加 CLI 审批传输。应用关闭保留已保存的 Auto 选择。恢复时需要该 integration,即使要选择其他预设也是如此;应用仍运行时移除插件则仍将存活 Session 迁移到 Full access。
JSON 投影在正常输出限制内包含已有的持久错误字段。最终拒绝携带 AutoReviewDeniedError / AUTO_REVIEW_DENIED 和可选 reviewer 详情;技术或解析失败携带 AutoReviewFailedError / AUTO_REVIEW_FAILED。两者都不执行工具 body。Agent 执行完成不代表每个请求动作都成功。
Alternatives considered
复用浏览器 RPC id。 Headless 调用不是浏览器请求。伪造该身份会将授权耦合到另一种传输,并错误描述持久来源。
添加 headless 入口标记。 已有 user source 已标识任务输入。传输专属标记增加持久元数据和读取规则,却不改变所需的权威判断。
提升每条 user-role 消息。 插件也提供 user-role 上下文。已有 source 判别字段区分接纳的用户输入与注入内容。
实时调用者审批通道。 Headless 将 stdin 作为一个任务消费。审批暂停的调用需要双向协议、请求关联、断连与取消处理,以及应答者生命周期。后续调用可以改为提供限定范围的授权并接受新审查,不声称批准了先前调用。
Consequences
监督者可以使用 Auto 实现修改和运行检查、查看结构化拒绝,并通过修订指令恢复。原生工具让所有支持的工具 body 都经过审查;PTC 内的直接 Node 效果仍不在范围内。Reviewer 仍是可能出错的模型,执行具有完全访问权限的后果,integration 仍保持实验性与显式启用。使用 user source 的自定义生产者被视为用户;后台上下文必须使用自己的 source。