fix: stop masking retrieval failures as vault misses in /query confirm path#435
Merged
Merged
Conversation
9404717 to
69445b0
Compare
…m path When retrieve_node catches a RAGError it returns top_score=0.0 plus an error string, which routes to user_gate exactly like an empty vault. The gateway then answered with 'Vault miss (best score: 0.000 < ...) Send query to Grok online?' and dropped result['error'] — so a broken index was indistinguishable from a routine miss, and the console (which renders only confirm_message on the needs_confirm path) never showed the failure. The confirm response now names the retrieval failure in confirm_message and passes error through, matching the answered path. Routing topology is unchanged.
69445b0 to
c6e2d28
Compare
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.
What
When
retrieve_node(graph.py:235-243) catches aRAGErrorit returnstop_score=0.0plus anerrorstring, which routes touser_gateexactly like an empty vault. The gateway then answered"Vault miss (best score: 0.000 < ...). Send query to Grok online?"and droppedresult["error"]— a broken index was indistinguishable from a routine miss, and the console (which renders onlyconfirm_messageon theneeds_confirmpath and returns early before itsdata.errorhandler) never showed the failure.gate.py's needs-confirm branch now: (1) names the failure inconfirm_message("Retrieval failed (INDEX_NOT_FOUND: ...) — no vault results available. ...") whenresult["error"]is set, and (2) passeserrorthrough in theQueryResponse, matching what the answered path already does. Routing topology is untouched — no graph edge or invariant changes.Adds
test_retrieval_failure_not_masked_as_vault_missand tightenstest_needs_confirm_response(a real vault miss must carryerror: null).Why / benefit
Auditability/operability: a crashed index surfaces as what it is instead of silently nudging the user toward a Grok escalation prompt.
Risk to monitor
This edits the same
needs_confirmblock that open draft PR #415 touches (itsmin_scorefallback line) — whichever lands second may need a trivial rebase. Verified:tests/test_gate.py+tests/test_graph.pypass locally; full suite green on a trial merge with the three sibling optimize PRs.🤖 Generated with Claude Code
https://claude.ai/code/session_0195JFv9p8b8Gu6Qvag59ZVq
Generated by Claude Code