Fix: false-positive tool-error detection (marker anywhere in response) + add npm/git markers

#47

Problem

The failure detector counts any tool response under 500 chars containing error:, failed to, exception:, etc. anywhere in the text. A grep result, a log excerpt, or a file listing that merely contains these substrings triggers the two-tier escalation: the model gets a ⚠️ SYSTEM WARNING scolding, and at 2 strikes its thinking block is disabled entirely (<think> </think> prefill) — degrading the model precisely when it is doing legitimate read-only work over content that mentions errors.

Fix

  • Failure markers must now appear within the first 80 characters of the response (real CLI/tool errors lead with the marker: Error: ..., Traceback ..., fatal: ...); the length/$ /took gates are unchanged.
  • Added two high-signal, low-noise markers within the same head gate: err! (npm) and fatal: (git).

Each fix in this series is an independent PR based on current main (v20); they touch overlapping regions of the same file, so merging one may require the others to be rebased — happy to update them.

Hey @Moore2877 ! Nevermind about rebasing—I went ahead and manually resolved the merge conflicts and integrated your excellent fixes directly into the new v21 release on main. Thank you so much for this incredible series of PRs! Closing this as the code is now officially merged.

froggeric changed pull request status to closed

Sign up or log in to comment