Skip to content

THI-455: output below an API error clears the flag - #56

Merged
tdody merged 4 commits into
mainfrom
thibaultdody/thi-455-api-error-flag-sticks-after-the-session-recovers-when-tool
Nov 3, 2026
Merged

tdody merged 4 commits into
mainfrom
thibaultdody/thi-455-api-error-flag-sticks-after-the-session-recovers-when-tool

Conversation

@tdody

@tdody tdody commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

The critter's "the Anthropic API is erroring in 1 pane" item and the pane header's "⚠ API error" stayed on for a pane whose stream cut had recovered half an hour earlier. Two later prompts had both got complete replies.

Cause

_detect_api_error reads the pane upward from the bottom. It returns true at the first API Error: line, and only a ⎿ tool-result line stops it first. Claude Code collapses successful tool calls into Called <server> N times (ctrl+o to expand), which prints no ⎿. In a pane with only collapsed calls, prose and prompts since the error, nothing stopped the scan before the old error, so the flag stayed on until the line scrolled out of the 100-line capture.

Fix

Anything Claude wrote below the error means the API answered, so the scan also stops at a ⏺ line or a collapsed tool group (COLLAPSED_TOOL_GROUP_RE: an indented row starting with a capitalized verb and ending in (ctrl+o to expand), e.g. Called fdy 6 times, Read 1 file, Made 3 edits). No later prompt is needed, so it also clears when Claude Code carries on by itself after a stream cut, the common case: about 40 of 67 mid-response errors in local transcripts recovered that way. A result's … +N lines row and › Message from @… agent rows don't match, so they can't clear an error they belong to.

The header chip's tooltip now says "Claude hit an API error and has written nothing since" instead of "last tool result was an API error".

Tests

  • New collapsed-calls-later-reply (the live pane, abridged) and stream-cut-recovered-in-turn (the same pane when its first turn ended): both flagged before, clear now.
  • New rate-limited-resuming-calls: a nudged turn that has only printed Called fdy 6 times so far is clear.
  • rate-limited-stuck is now rate-limited-resumed and expects the flag off: Claude has replied after the last keep going.
  • error-then-only-text now expects the flag off: its fixture has a ⏺ reply and a finished turn after the error, which the old expectation only guessed was still stuck.
  • Guards that stay flagged: rate-limited-nudged (keep going with only a spinner below it) and new error-truncated-result (an error whose … +3 lines (ctrl+o to expand) row sits under it).

bin/check is clean, pytest passes (2080), vitest passes (1313). Against every live pane, the only one whose flag changes is the incident pane, which now reads clear.

Assumptions

  • Every ⏺ line and collapsed tool group below an error was written after it by Claude. The agent panel's ⏺ rows under the composer are cut off before the scan.
  • Collapsed tool groups start with a capitalized verb after their indent, and truncation (… +N lines, … N more lines) and agent-message (› Message from @…) rows don't, per a survey of the (ctrl+o to expand) rows in all live panes.
  • A rate-limit error still ends the turn until the user nudges it, as the original screenshot showed.

Linear: THI-455

🤖 Generated with Claude Code

tdody and others added 4 commits November 3, 2026 09:01
…, since collapsed calls print no ⎿ (THI-455)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…pi_error, no prompt needed (THI-455)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ince, not that the last tool result failed (THI-455)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@tdody tdody changed the title THI-455: a reply to a later prompt clears the API-error flag THI-455: output below an API error clears the flag Nov 3, 2026
@tdody
tdody merged commit a376380 into main Nov 3, 2026
2 checks passed
@tdody
tdody deleted the thibaultdody/thi-455-api-error-flag-sticks-after-the-session-recovers-when-tool branch November 3, 2026 14:54
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.

1 participant