Skip to content

fix: report Claude Code's StopFailure as done - #48

Merged
omartelo merged 2 commits into
mainfrom
feat/report-stop-failure
Oct 8, 2026
Merged

omartelo merged 2 commits into
mainfrom
feat/report-stop-failure

Conversation

@omartelo

@omartelo omartelo commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

Claude Code fires StopFailure instead of Stop when an API error ends the turn: a usage limit, an overload, a failed login (measured on 2.1.293, where the hook is fire-and-forget). The plugin registered only Stop, so after any of those the card kept its spinner until the next prompt.

This registers StopFailure with no matcher and reports done, the same as Stop: the turn is over either way. Which error it was stays out of the report; lich reads it off the transcript on every done and, for a usage limit, parks the turn's continuation for when the limit resets (omartelo/lich, feat/auto-resume-after-limit).

  • hooks/hooks.json: StopFailure → report-state.sh done
  • tests/hooks.test.mjs: pins that Claude reports done on StopFailure for every error
  • docs/providers.md: the event vocabulary row for done

No contract change: done is an existing state, so the vendored fixtures and tests/lich-ref stay as they are.

node --test tests/*.test.mjs: 328 passing.

Claude Code fires StopFailure instead of Stop when an API error ends the
turn, so the card kept spinning after a usage limit and lich never read
the limit off the transcript.
@omartelo
omartelo merged commit 384895f into main Oct 8, 2026
3 checks passed
@omartelo omartelo mentioned this pull request Oct 8, 2026
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