fix(chat): claim-check silently degraded when tool-calling was off - #295
Merged
Conversation
The request-intent half of the claim check needs the user's message. But last_user_text was populated only inside the use_tools gate, so any request with tools disabled left it empty and the check fell back to reply-patterns alone — exactly the half that rephrasing can evade, and the half three rounds of pattern widening already proved insufficient. Found by verifying the previous fix live instead of trusting it: the module flagged the case correctly in isolation, but the running dashboard produced no correction. The logic was right; the wiring starved it. A safety check must not depend on an unrelated feature flag. last_user_text is now resolved unconditionally, before the gate. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found by verifying the previous fix live rather than trusting it.
The module flagged the case correctly in isolation — but the running dashboard produced no correction. The logic was right; the wiring starved it.
last_user_textwas populated only inside theuse_toolsgate. Any request with tools disabled left it empty, so the claim check's request-intent half got nothing and fell back to reply-patterns alone — exactly the half that rephrasing can evade, and the half that three rounds of pattern-widening already proved insufficient.A safety check must not depend on an unrelated feature flag. Now resolved unconditionally, before the gate.
Also reworded a comment that contained the literal
if use_tools:— it tripped an existing string-matching test (test_chat_bindings_hoisted_before_use_tools_gate) that scans the source withsrc.index(). The code was correct; the prose wasn't.180 chat/claim tests pass.