Skip to content

fix(web-ui): keep failed agent runs in review instead of auto-completing them - #559

Open
Atman36 wants to merge 1 commit into
cline:mainfrom
Atman36:fix/524-review-error-gate
Open

fix(web-ui): keep failed agent runs in review instead of auto-completing them#559
Atman36 wants to merge 1 commit into
cline:mainfrom
Atman36:fix/524-review-error-gate

Conversation

@Atman36

@Atman36 Atman36 commented Jul 7, 2026

Copy link
Copy Markdown

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, useReviewAutoActions auto-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

useReviewAutoActions receives only board (which carries no session state) and keys its decisions solely on autoReviewEnabled + changedFiles. RuntimeTaskSessionSummary.reviewReason already reaches the web-ui (sessions state in App.tsx, threaded to BoardCard as sessionSummary), and is even in scope at the hook's call site in use-board-interactions.ts — it just was never passed in. Similarly, getCardSessionActivity in board-card.tsx branches on state === "awaiting_review" without checking reviewReason, so failed runs get the green success dot.

Change

  • Thread sessions into useReviewAutoActions (ref pattern, same as the existing boardRef), and re-run evaluateAutoReview when sessions changes — so a failure arriving over the state stream is acted on immediately, not only on the next board change.
  • In evaluateAutoReview, skip ALL auto actions (arming, auto-commit/PR, move-to-done) for a card whose session has reviewReason: "error" or state: "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 with reviewReason of exit/attention/hook/null (incl. manually dragged cards with no session) behave exactly as before.
  • In getCardSessionActivity, failure now dominates success-style final messages: awaiting_review + reviewReason: "error" and state: "failed" render a red error dot with the failure message (falls back to warningMessage, then a static label for PTY exits with no hook activity), keeping the credit-limit branch's precedence. The previously unreachable late failed branches 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 (clean exit review 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 build all 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 main and additionally covers the PTY exit path (no hook activity) via the warningMessage fallback.

…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
@greptile-apps

greptile-apps Bot commented Jul 7, 2026

Copy link
Copy Markdown

PR author is not in the allowed authors list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tasks that fail should move to Review instead of Done

1 participant