fix(web-ui): keep failed agent runs in review instead of auto-completing them - #559
Open
Atman36 wants to merge 1 commit into
Open
fix(web-ui): keep failed agent runs in review instead of auto-completing them#559Atman36 wants to merge 1 commit into
Atman36 wants to merge 1 commit into
Conversation
…ing them Auto-review ignored the session's reviewReason/state, so a run that failed mid-task (state awaiting_review, reviewReason error) was auto-committed and auto-moved to Done just like a clean review, and the card showed a green success dot with the error text. Gate all auto-review actions (arming, auto-commit/PR, move-to-done) on the failure signal, and give the card a red failure indicator instead of the misleading green one. Fixes cline#524
|
PR author is not in the allowed authors list. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #524
Problem
When an agent run fails mid-task (LLM/provider error), the session lands in the Review column with
reviewReason: "error"— but the auto-review automation never looks at that signal. If the failed run left partial changes on disk,useReviewAutoActionsauto-commits them and auto-moves the card to Done. The card face shows a green "success" dot with the error text. As reported in #524: you return in the morning to a Done card that is actually broken, with no visual trace it failed.Root cause
useReviewAutoActionsreceives onlyboard(which carries no session state) and keys its decisions solely onautoReviewEnabled+changedFiles.RuntimeTaskSessionSummary.reviewReasonalready reaches the web-ui (sessionsstate inApp.tsx, threaded toBoardCardassessionSummary), and is even in scope at the hook's call site inuse-board-interactions.ts— it just was never passed in. Similarly,getCardSessionActivityinboard-card.tsxbranches onstate === "awaiting_review"without checkingreviewReason, so failed runs get the green success dot.Change
sessionsintouseReviewAutoActions(ref pattern, same as the existingboardRef), and re-runevaluateAutoReviewwhensessionschanges — so a failure arriving over the state stream is acted on immediately, not only on the next board change.evaluateAutoReview, skip ALL auto actions (arming, auto-commit/PR, move-to-done) for a card whose session hasreviewReason: "error"orstate: "failed"— mirroring the existing disabled-path cleanup. The same failure gate is re-checked inside both delayed callbacks at timer-fire time (next to the existing column/enabled/mode re-checks), closing the race where a session flips to error after an action was scheduled but before its timer fires. Cards withreviewReasonofexit/attention/hook/null(incl. manually dragged cards with no session) behave exactly as before.getCardSessionActivity, failure now dominates success-style final messages:awaiting_review+reviewReason: "error"andstate: "failed"render a red error dot with the failure message (falls back towarningMessage, then a static label for PTY exits with no hook activity), keeping the credit-limit branch's precedence. The previously unreachable latefailedbranches are removed (the compiler flags them as dead after the new early branch).No server-side or contract changes — the signal already flows to the client.
Tests
use-review-auto-actions.test.tsx: bug repro (error session + changed files → no git action, no auto-done); happy-path guard (cleanexitreview still auto-commits/auto-dones); race guard (session fails after the action is scheduled, before timers advance → nothing fires).board-card.test.tsx: error dot + message for failed reviews (incl.state: "failed"carrying a success-style final assistant message); green dot unchanged for clean reviews.npm run check,npm --prefix web-ui run test(70 files / 503 tests),npm run buildall green locally (Node 22).Prior art
A similar fix was made independently in a fork (VictorGambarini#28) but never upstreamed; this implementation was written from the root cause against current
mainand additionally covers the PTY exit path (no hook activity) via thewarningMessagefallback.