[BUG] File Changes panel lists a rejected file edit as a changed file
维护者通常 3 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 72/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript, vscode
调研方向
Start with webview-ui/src/components/chat/utils/fileChangesFromMessages.ts and trace how tool asks are filtered; then read the approval and finalization paths in src/core/task/Task.ts. Add coverage in webview-ui/src/__tests__/fileChangesFromMessages.spec.tsx for approved, auto-approved, rejected, and finalized-failed asks. Done means only approved edits appear in the File Changes panel, including after task reload.
由索引模型根据 Issue 内容生成。
描述
Problem (one or two sentences)
The File Changes panel lists a file edit that the user rejected. The file was never written. The panel treats a rejected tool ask as an approved one.
Context (who is affected and when)
Every user who rejects a proposed file edit sees the rejected file in the File Changes panel for the rest of the task. The entry also survives a task reload, because the persisted message record carries the same ambiguous flag. This misleads users into believing a rejected write touched their files.
Reproduction steps
- Environment: Zoo Code 3.98.0 in VS Code, Windows 10. Any API provider. Auto-approval for file edits is OFF.
- Start a task. Ask the agent to edit an existing file outside the workspace (any absolute path works).
- When the edit approval dialog appears, click Reject. The agent receives the rejection and the file is not modified.
- Open the File Changes panel.
Observed after step 4: the rejected file is listed in the panel with its full proposed diff.
Expected result
The panel lists only file edits that were approved (by the user or by auto-approval). A rejected edit is not listed.
Actual result
The rejected edit is listed as a changed file, with diff and stats, indistinguishable from a real approved edit.
Variations tried (optional)
- Approved edits and auto-approved edits list correctly; only rejected (and likely failed/finalized) edits leak in.
- The same entry also appears after closing and reopening the task (the persisted
ui_messages.jsoncarries the same flags). - Not verified: whether an auto-denied edit (deny rule / guard) produces the same false entry.
Root cause (analysis against main at dc6d1435e, 2026-11-16)
-
The panel derives its list in
webview-ui/src/components/chat/utils/fileChangesFromMessages.ts. Its filter is:// Only include ask "tool" file edits that the user (or auto-approval) has approved if (isAskTool && !msg.isAnswered) continueThis equates
isAnswered === truewith "approved". -
isAnsweredis also stamped on asks that will NOT complete.Task.finalizePartialToolAsk()insrc/core/task/Task.tssetspartial = falseandisAnswered = trueon a tool ask in error/rejection paths, explicitly to disarm the Save/Reject buttons. Its own doc comment says: "the ask is being finalized because it will NOT complete". -
A real approval marks the ask only on
yesButtonClicked(handleWebviewAskResponseinsrc/core/task/Task.ts), and auto-approval additionally setsautoApprovalDecisionon the message (ask()update path). A rejected/finalized ask therefore hasisAnswered = trueand NOautoApprovalDecision. -
Result: the panel cannot distinguish "answered = approved" from "answered = rejected/failed", so the rejected edit passes the filter and is displayed.
Evidence from persisted task state (sanitized): the tool-ask message for the rejected write has answered = true and an empty autoApprovalDecision, while every genuinely approved edit has autoApprovalDecision = "approve". The target file does not exist on disk at the listed path.
Suggested fix direction
Do not overload isAnswered with "approved". Either:
- add an explicit per-message outcome marker (for example
toolApproval: "approved" | "rejected" | "finalized-failed") set at the three write sites, and filter on it infileChangesFromMessages.ts; or - at minimum, exclude answered asks that have no
autoApprovalDecisionand were not answered byyesButtonClicked.
A unit test in webview-ui/src/__tests__/fileChangesFromMessages.spec.tsx should cover: approved, auto-approved, rejected, and finalized-failed tool asks.
App Version
3.98.0
API Provider (optional)
Not Applicable / Other (UI/state bug, provider-independent)
Model Used (optional)
N/A
Zoo Code Task Links (optional)
No response
Relevant logs or errors (optional)
No logs; the defect is visible in the persisted ui_messages.json flags described above.
- 主要语言
- TypeScript
- 星标
- 2k
- 派生
- 301
- 平均合并
- 3 天 14 小时
- 30 天内合并 PR
- 103
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Zoo-Code-Org/Zoo-Code 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
Zoo-Code-Org/Zoo-Code#2773 · 1 条评论 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
Zoo-Code-Org/Zoo-Code#2717 · 1 条评论 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 77/100
Zoo-Code-Org/Zoo-Code#2515 ·
维护者通常 3 天内回复
-
fix(scripts): stryker-diff.mjs spawns the extensionless .bin shim and cannot run on Windows可能已有人在做 @easonLiangWorldedtech 于 15 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
Zoo-Code-Org/Zoo-Code#2514 ·
维护者通常 3 天内回复
-
[BUG] search_files hides matching text on long lines可能已有人在做 @DananjayaNadun 于 9 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 74/100
Zoo-Code-Org/Zoo-Code#2496 · 1 条评论 · 已指派 1 人 ·
维护者通常 3 天内回复
查看 Zoo-Code-Org/Zoo-Code 的全部 Issue
相似的 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
ci
难度 2/5 1-3 小时 新手友好度 78/100
ClickHouse/clickhouse-js#1248 ·
维护者通常 1 天内回复
-
E2E: Darlehen-Test wartet auf die gebuchte Auszahlung, bevor er zur Liquiditätsvorschau wechselt未关闭technik
难度 2/5 1-3 小时 新手友好度 78/100
-
bug
难度 2/5 1-3 小时 新手友好度 67/100
SR5-FoundryVTT/SR5-FoundryVTT#2162 ·
维护者通常 1 天内回复
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 84/100
AhmedNAgy25/analysor#25 ·
维护者通常 1 天内回复