fix: prevent false-positive auth errors in stripAuthErrors()#178
Open
catgodtwno4 wants to merge 1 commit intoMartian-Engineering:mainfrom
Open
fix: prevent false-positive auth errors in stripAuthErrors()#178catgodtwno4 wants to merge 1 commit intoMartian-Engineering:mainfrom
catgodtwno4 wants to merge 1 commit intoMartian-Engineering:mainfrom
Conversation
When summarizing conversations that discuss authentication errors (e.g. '401', 'invalid api key'), pickAuthInspectionValue() would fall back to the original value when no auth-related keys were found in the subset, causing the downstream extractProviderAuthFailure() to incorrectly detect auth failures from conversation content rather than actual API responses. This resulted in misleading '[lcm] compaction failed: provider auth error' log messages even though summaries were successfully written to the DB. Fix: return empty object instead of original value when no auth-related keys are found, preventing false-positive auth error detection. Fixes Martian-Engineering#171
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.
Summary
Fixes #171 — false-positive auth error when summary content contains auth-related keywords.
Root Cause
In
src/summarize.ts,pickAuthInspectionValue()(line 390) returns the full response object when no auth-related keys are found in the subset:This causes
collectAuthFailureText()to walk the entire response includingcontent[].text(the actual summary text). If the summary discusses auth errors (e.g., a conversation about debugging 401s), the regexAUTH_ERROR_TEXT_PATTERNmatches against conversation content rather than actual API error responses.Fix
Return empty object
{}instead of the originalvaluewhen no auth-related keys are found:This prevents downstream
extractProviderAuthFailure()from inspecting irrelevant fields.Verified On
Test
Compress a conversation containing strings like
401,invalid api key,authentication_error. Before fix: false[lcm] compaction failed: provider auth errorlog. After fix: clean log, summary written successfully.