Fix: Use configured model for API validation instead of hardcoded deprecated model#76
Open
theLightArchitect wants to merge 1 commit intoanthropics:mainfrom
Conversation
…recated model Fixes two layers of a bug where FindingsFilter silently disables Claude-based filtering due to a deprecated model string: 1. validate_api_access() used hardcoded "claude-3-5-haiku-20241022" instead of self.model — now uses the model configured via CLAUDE_MODEL env var or default 2. initialize_findings_filter() did not pass model parameter to FindingsFilter — now passes DEFAULT_CLAUDE_MODEL through to ClaudeAPIClient 3. Added GitHub Actions ::warning:: annotation when filtering silently disables, so users get visible feedback (not just a logger.warning) Includes 8 new tests verifying model propagation and warning behavior. Closes anthropics#69 Co-Authored-By: Claude Opus 4.6 <[email protected]>
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 (3 source files + 1 test update + 1 new test file):
claude_api_client.py: Useself.modelinvalidate_api_access()instead of hardcoded stringfindings_filter.py: Addmodelparameter toFindingsFilter.__init__(), pass through toClaudeAPIClient. Add GitHub Actions::warning::annotation when filtering disables (not just logger.warning)github_action_audit.py: Passmodel=DEFAULT_CLAUDE_MODELtoFindingsFilterinitializationtest_helper_functions.py: Update existing test to expect the newmodelparametertest_model_configuration.py: 8 new tests verifying model propagation and warning behaviorWhy
self.modelinstead of a new constant:PR #73 proposes adding a
VALIDATION_MODELconstant — but this creates another hardcoded model string that will eventually go stale (the same problem that caused this bug). 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. The only behavioral change is that validation now uses the configured model and surfaces a::warning::annotation on failure.Test results: 181 tests pass (173 existing + 8 new), 0 failures.
Closes #69
Test plan
python -m pytest claudecode/ -v)self.modelis used (not hardcoded string)initialize_findings_filter()→FindingsFilter→ClaudeAPIClient::warning::annotation on validation failureclaude-3-5-haiku-20241022is never used