Skip to content

Persist a failure reason on failed threads and surface it in the sidebar and Agents panel - #224

Merged
currentbits merged 4 commits into
mainfrom
coder/use-grok-workers-to-do-this-gh-issue-you-08ef20
Aug 17, 2026
Merged

currentbits merged 4 commits into
mainfrom
coder/use-grok-workers-to-do-this-gh-issue-you-08ef20

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Closes #140.

Problem

ThreadStatus was a bare "idle" | "working" | "done" | "failed", so a failed run left the sidebar showing an unexplained Failed badge with no tooltip. The only record of why was an event card buried in the thread transcript. Triaging several red threads after a night of parallel runs meant opening each one and scrolling — even though "provider CLI crashed", "budget cap hit" and "permission denied" call for completely different follow-ups.

Deriving the reason on demand was not an option for the sidebar: it feeds off threads:summaries, which deliberately does not walk transcripts (that was a prior perf fix). So the reason has to be stored.

What changed

Store the reason — new lastError: string | null on ThreadInfo (src/shared/ipc.ts).

electron/runner.js

  • New shortError() helper: first 2 lines, capped at 300 chars — tooltip-sized.
  • Applied at all 14 status: "failed" sites. Each already had the human-readable reason in scope as errText / errLabel / failText, so this is one added property per site. The large line count is mostly Prettier expanding one-line patch objects onto multiple lines.

electron/store.js

  • updateThread clears lastError whenever a patch sets status to anything other than "failed". Every status change routes through this one function, so a retry cannot carry a stale reason and no call site has to remember to clear it.
  • migrateThread defaults the field to null, so threads from older stores are stable rather than undefined.
  • The boot sweep that lands runs stranded by a quit now stamps "Run error: app quit while the run was in flight" instead of a silent failed.

electron/orchServer.js

  • thread_status prefers the stored lastError and keeps its existing backwards-scan for a Run error event as a fallback, so threads that failed before this change still report a reason.

Surface the reason

  • src/components/Sidebar.tsx — title={thread.lastError ?? undefined} on the Failed badge. A native title is the right tool here; no tooltip component and no new dependency.
  • src/components/AgentsPanel.tsx — the recap facts line appends the whitespace-collapsed reason, with the full text as the row title so a long error cannot break the layout.

Tests

  • electron/test/thread-last-error.test.js — a failed thread keeps its lastError, patching it back to working clears it, and thread_status prefers the stored value over the message scan.
  • test/sidebarFailedBadge.test.tsx — a failed thread renders its lastError as the badge tooltip.

Verification

  • npm run typecheck (tsc --noEmit) — clean.
  • npm test — 38/38 core, 720/720 renderer, 814/815 electron.

The single electron failure is pre-existing and unrelated: wireClient × webBridge asserts production first backoff is still 1s and gets 120000 !== 1000 (an unrelated two-minute timer registers first). It reproduces identically on the base commit 1e9f3c2 in a clean worktree and touches none of the files changed here, so it is left alone rather than folded into this branch.

Notes

Built by two agents working in parallel on disjoint file sets — electron/* and src/components/* — which is why the branch has two feature commits. Both added the lastError field declaration to src/shared/ipc.ts byte-identically, so the halves merged without conflict.

  • PR created by the Claude Code agent

Willem added 4 commits August 17, 2026 10:26
Surface ThreadInfo.lastError as a native title on the sidebar Failed
badge, and as a truncated recap facts line in the Agents panel, so
failed runs can be triaged without opening each thread.
Persist a short failure reason on ThreadInfo so the sidebar can show
why a run failed without walking the transcript. updateThread clears
it on any non-failed status so a retry cannot keep a stale reason.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@currentbits
currentbits merged commit 8525151 into main Aug 17, 2026
1 check failed
@currentbits
currentbits deleted the coder/use-grok-workers-to-do-this-gh-issue-you-08ef20 branch October 3, 2026 16:07
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.

A failed thread carries no failure reason; sidebar badge is an unexplained Failed

1 participant