Skip to content

Fix Stop finalization recovery false positives - #395

Merged
Wibias merged 5 commits into
mainfrom
fix/stop-finalization-recovery
Aug 29, 2026
Merged

Fix Stop finalization recovery false positives#395
Wibias merged 5 commits into
mainfrom
fix/stop-finalization-recovery

Conversation

@Wibias

@Wibias Wibias commented Aug 29, 2026

Copy link
Copy Markdown
Owner

Summary

Fix the remaining Codex lifecycle Stop false-positive class observed after #393 / v1.3.5.

The new incident is a completed read-only analysis that ends with a required recommendation such as NEXT_ACTION = AUTHOR_NARROW_AUTHORITY_CORRECTION and an explicit stop condition. The assistant is finished, but the hook still injects recovery 1/3. The corrective continuation Cannot execute the selected next action... then fails to terminate recovery, producing recovery 2/3 and 3/3.

Root cause

#393 recognized a small set of terminal phrases after Stop, but two state-machine gaps remained:

  1. the generic 12k hook generation budget fires before a long completed recommendation is classified as final output, so a valid final report without one of those phrases is treated as a missing tool boundary;
  2. the corrective blocker recognizer did not match selected next action or an explicit Blocked: ... unauthorized disposition.

A blanket 64k allowance for every lifecycle Stop would weaken the existing hook-mode severe-recovery boundary. This PR therefore applies the larger completed-answer allowance only to an explicit finalization candidate and still runs the entire candidate through tool-intent/protocol detection.

Fix

  • recognize the existing terminal/blocker dispositions, including selected next action and explicit authorization blockers;
  • recognize the structured final-report form used by the incident: a Recommendation heading with a terminal NEXT_ACTION = ... recommendation;
  • only those explicit finalization candidates may use the 40k/64k completed-answer character allowance;
  • ordinary Stop messages retain the existing strict hook generation budget;
  • finalization candidates are still fully scanned, so a newly announced tool action remains in recovery;
  • terminal/finalization wording cannot bypass the 64k completed-answer hard bound;
  • malformed tool-protocol hard stops are unchanged.

TDD / adversarial evidence

The first test-only commit, d002b5e6f22b976e0bef89864c79015d9be319e1, was RED on the unchanged runtime and reproduced the new final-report and corrective-blocker failures.

Additional adversarial coverage pins both fail-open directions:

  • a terminal report above the completed-answer hard limit still recovers;
  • a long finalization candidate that announces a new tool action still recovers;
  • ordinary long repeated tool intent keeps the strict recovery behavior;
  • blocker wording plus a new tool action cannot clear active recovery.

Scope

Only the Codex watchdog hook logic and its focused terminal-Stop regression file change. No version bump, release preparation, merge, tag, GitHub Release, or npm publication is included.

@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c770928b-fed7-49d7-96a3-3fe7ec36b1e2


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Wibias
Wibias marked this pull request as ready for review August 29, 2026 16:18
@Wibias
Wibias merged commit 5322495 into main Aug 29, 2026
11 checks passed
@Wibias
Wibias deleted the fix/stop-finalization-recovery branch August 29, 2026 16:18
@Wibias Wibias mentioned this pull request Aug 29, 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