Skip to content

loopguard: a productive turn is not a loop (fixes #128) - #138

Merged
Aaron Li (aaron-jx-li) merged 1 commit into
mainfrom
loopguard-false-alarms
Nov 4, 2026
Merged

Aaron Li (aaron-jx-li) merged 1 commit into
mainfrom
loopguard-false-alarms

Conversation

@aaron-jx-li

Copy link
Copy Markdown
Collaborator

Claude Code gives a successful call no exit status (a non-zero exit comes as PostToolUseFailure), so the guard read every success by its output: a green Playwright run whose exit prints libuv's "Assertion failed", or source read with cat that mentions an Error, counted as failing.

  • A successful Claude Code shell call counts as exit 0 where that status covers the command (exit_status_covers): one command, an && chain, or earlier commands that only read, move about, set up or report; heredoc bodies are input, not commands. The history import's envelope replay does the same.
  • git checkout -- / git restore counts as an edit only for a file the turn edited.
  • Every test run the turn tracker knows counts in SpiralState.test_runs in the plugin (the redirect's "N verification(s)"); dotenv ... -- is a launcher, and Playwright's summary decides a piped run.
  • Test fixtures send a failing Claude Code call as PostToolUseFailure, as Claude Code does.

Claude Code gives a successful call no exit status (a non-zero exit comes
as PostToolUseFailure), so the guard read every success by its output: a
green Playwright run whose exit prints libuv's "Assertion failed", or
source read with cat that mentions an Error, counted as failing.

- A successful Claude Code shell call counts as exit 0 where that status
  covers the command (exit_status_covers): one command, an && chain, or
  earlier commands that only read, move about, set up or report; heredoc
  bodies are input, not commands. The history import's envelope replay
  does the same.
- git checkout -- / git restore counts as an edit only for a file the
  turn edited.
- Every test run the turn tracker knows counts in SpiralState.test_runs
  in the plugin (the redirect's "N verification(s)"); dotenv ... -- is a
  launcher, and Playwright's summary decides a piped run.
- Test fixtures send a failing Claude Code call as PostToolUseFailure, as
  Claude Code does.

SpiralState, ERR_RE and the stuck rules are unchanged, so the experiments
read as before. Replayed: 3,806 SWE-bench Claude Code sessions, failing
outputs 7,730 -> 4,660, gate 11.9% -> 9.7%, stuck 113 -> 82, ended well
91.6% both; 682 local interactive turns, failing outputs 1,586 -> 594,
gate 68 -> 25 turns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aaron-jx-li
Aaron Li (aaron-jx-li) merged commit 519c65f into main Nov 4, 2026
14 checks passed
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