Agent 在用户连续拒绝权限审批后陷入无限思考循环 #2075
Replies: 3 comments 1 reply
|
Confirmed in code — this is a real loop bug, not model stubbornness. Root cause
// packages/core/tools/src/index.ts
case 'rejected': return {
decision: { kind: 'deny', reason: `the user rejected tool "${exec.name}"` },
approvalCancelled: false,
}
content: [{ type: 'text', text: `Error: ${denialReason}` }], isError: trueSo the model receives exactly The escalation hint compounds it: a sandbox denial returns (The regression test at Fix direction (two complementary layers)
I can prepare a cherry-pick-ready patch for (1) now (one branch, tool layer only, with a regression test). (2) is a loop-semantics change I'd scope against the maintainers' preferred behavior before touching — happy to draft a spec for it if useful. |
|
Shipped layer (1) as promised — cherry-pick-ready against
That is the model-facing half. The durable half is the loop-level yield-on-rejection (end the turn instead of auto-kicking the next step) — I left that out of this branch because it changes the loop's continuation semantics and I'd rather align on the maintainers' preferred behavior first. Happy to draft that as a spec/RFC if it helps. |
|
Shipped the loop-level half now too — the complete fix is one branch.
This supersedes the message-only branch ( |
Uh oh!
There was an error while loading. Please reload this page.
问题简述
在使用 DeepSeek Harness Web UI 时,Agent 在用户多次拒绝其权限审批请求后,陷入了“思考 → 申请审批 → 被拒绝 → 再思考”的无限循环,无法正常终止或接受用户的新指令。
复现步骤
预期行为
实际行为
Agent 将用户的每次拒绝都视为一个需要“解决”的“任务结果”,触发新一轮的 Agent Loop,而不是将拒绝理解为“暂停并等待用户指令”。即使 Agent 在输出中表示愿意倾听,其底层循环机制仍未真正等待用户输入,导致用户无法介入对话。
环境信息
补充说明
这个问题在交互式使用场景中严重影响用户体验。当 Agent 的理解出现偏差时,用户希望通过拒绝审批 + 文字说明来纠正 Agent,但当前的循环机制使得用户无法完成这个“纠正”动作,因为 Agent 不会等待用户输入就自行进入了下一轮循环。
官方文档中提到,ctx.approval 的 rejected 结果会导致工具体被跳过,调用方对 rejected 执行拒绝。但目前的实现中,rejected 似乎被 Agent 视为一个需要“重新尝试”的触发条件,而不是“停止并等待”的信号。
感谢开发团队的辛勤工作,这个预览版整体体验很棒,希望这个反馈能帮助改进产品!
All reactions