Skip to content

fix: show REPEAT_ERROR in replay verdicts - #2

Merged
ruslanlap merged 1 commit into
mainfrom
fix/replay-repeat-error
Sep 27, 2026
Merged

ruslanlap merged 1 commit into
mainfrom
fix/replay-repeat-error

Conversation

@ruslanlap

@ruslanlap ruslanlap commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Found by an atlassian-engineering skill review of #1: replay (the debug surface for tuning thresholds) only surfaced LOOP/OSCILLATION verdicts — REPEAT_ERROR was invisible there.

  • reuse update_repeat_streak in replay_file for a cross-line sticky streak (same semantics as watch mode)
  • new verdict ⚠ REPEAT_ERROR + exit 1
  • replay --repeat-n N flag (matches watch)

TDD: failing test test_replay_detects_repeat_error first, then fix. 59/59 green; verified live: 3 consecutive failed bash → verdict on line 3, --repeat-n 5 → quiet.


Devin Review

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Devin Review

Comment thread loopguard.py

if args.command == "replay":
return replay_file(target)
return replay_file(target, repeat_n=args.repeat_n)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Replay command crashes on every transcript

For any existing transcript, main reads args.repeat_n, but the replay parser never defines it. Replay exits with AttributeError before printing verdicts.

Learn more

The replay subparser only registers path in build_parser. Argparse therefore creates no repeat_n attribute for replay. Reading it before invoking replay_file raises AttributeError, so even ordinary replay commands fail. The new test checks return code 1, which is also the exit code from this unhandled exception.

Example: loopguard replay fixtures/repeat_error.jsonl prints a traceback and exits 1 instead of printing three annotated events. loopguard replay fixtures/repeat_error.jsonl --repeat-n 5 rejects the option and exits 2.

Recommended fix: Register --repeat-n with the replay subparser in build_parser, using the same default and integer type as watch. Extend the CLI test to assert the expected verdict, successful quiet replay with a higher threshold, and no traceback.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already fixed — this finding is against a stale intermediate push. The PR branch was force-updated from bd65b86 (which had the AttributeError bug) to 287cba9 before merge; 287cba9 already registers --repeat-n on the replay parser (build_parser, replay subparser) and passes repeat_n=args.repeat_n to replay_file. Verified on current main (4a1a3ae): loopguard.py replay fixtures/repeat_error.jsonl → prints verdicts, no AttributeError; replay --repeat-n 5 → quiet, exit 0. Also note test_replay_detects_repeat_error asserts on stdout content (REPEAT_ERROR verdict), not just the exit code, so it can't pass via a crash.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bd65b866d7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread loopguard.py

if args.command == "replay":
return replay_file(target)
return replay_file(target, repeat_n=args.repeat_n)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Define repeat_n for the replay subcommand

Every replay invocation now accesses args.repeat_n, but --repeat-n is registered only on the watch parser, so replay exits with an AttributeError before processing any events. Add the option to the replay parser or pass the existing default without reading a missing namespace attribute.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already fixed — this finding is against a stale intermediate push. The PR branch was force-updated from bd65b86 (which had the AttributeError bug) to 287cba9 before merge; 287cba9 already registers --repeat-n on the replay parser (build_parser, replay subparser) and passes repeat_n=args.repeat_n to replay_file. Verified on current main (4a1a3ae): loopguard.py replay fixtures/repeat_error.jsonl → prints verdicts, no AttributeError; replay --repeat-n 5 → quiet, exit 0. Also note test_replay_detects_repeat_error asserts on stdout content (REPEAT_ERROR verdict), not just the exit code, so it can't pass via a crash.

@ruslanlap
ruslanlap force-pushed the fix/replay-repeat-error branch from bd65b86 to 287cba9 Compare September 27, 2026 20:26
@ruslanlap
ruslanlap merged commit 4a1a3ae into main Sep 27, 2026
7 checks passed
@ruslanlap
ruslanlap deleted the fix/replay-repeat-error branch September 27, 2026 20:27
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