fix: use configured model for API validation instead of hardcoded deprecated model#92
Open
theLightArchitect wants to merge 1 commit intoanthropics:mainfrom
Conversation
…recated model validate_api_access() hardcoded 'claude-3-5-haiku-20241022' instead of using self.model. When this deprecated model fails API validation, filtering silently disables — no user-visible indication. initialize_findings_filter() also did not pass model= to FindingsFilter, so the CLAUDE_MODEL env var never reached the ClaudeAPIClient used for filtering. Fixes: - claude_api_client.py: use self.model in validate_api_access() - github_action_audit.py: pass model=DEFAULT_CLAUDE_MODEL to FindingsFilter - Tests: add 5 tests verifying model propagation and warning behavior Closes anthropics#69
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 a two-layer bug where
FindingsFiltersilently disables Claude-based filtering due to a hardcoded deprecated model string.Root cause analysis:
validate_api_access()hardcoded"claude-3-5-haiku-20241022"instead of usingself.model. When this deprecated model fails API validation, filtering silently disables with only alogger.warning()— no user-visible indication.initialize_findings_filter()did not pass themodelparameter toFindingsFilter, so even when users configureCLAUDE_MODELenv var, it never reaches theClaudeAPIClientused for filtering (though it correctly reachesSimpleClaudeRunnerfor the main audit).Fix (2 source files + 1 test update + 1 new test file):
claude_api_client.py: Useself.modelinvalidate_api_access()instead of hardcoded stringgithub_action_audit.py: Passmodel=DEFAULT_CLAUDE_MODELtoFindingsFilterinitializationtest_helper_functions.py: Update existing test to expect the new model parametertest_model_configuration.py: 5 new tests verifying model propagation and warning behaviorNote:
findings_filter.pyalready accepts themodelparameter — this PR wires the missing upstream call sites.Why
self.modelinstead of a new constant: Usingself.modelmeans validation always uses whatever model the user configured, with zero new constants to maintain.Backward compatible: The
CLAUDE_MODELenv var andDEFAULT_CLAUDE_MODELconstant continue to work as before.Test plan
self.modelis used (not hardcoded string)initialize_findings_filter()→FindingsFilter→ClaudeAPIClient::warning::annotation on validation failureCloses #69