fix: validate file extensions in python_check before running linters#6
Open
gszep wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: validate file extensions in python_check before running linters#6gszep wants to merge 1 commit intomicrosoft:mainfrom
gszep wants to merge 1 commit intomicrosoft:mainfrom
Conversation
Reject non-Python files (.ts, .js, etc.) upfront in PythonChecker.check_files() instead of feeding them to ruff/pyright. When called on TypeScript files, linters produced 228K+ chars of garbage output that exhausted the Claude CLI context budget. Non-Python files now get a clear info-level message while directories and .py/.pyi files pass through normally. The validation sits in the shared checker code path, protecting all callers (tool, hook, CLI). 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.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.
Summary
PythonChecker.check_files()to reject non-Python files before invoking ruff/pyright.ts,.js, etc.) return an informativeNON_PYTHONinfo-level issue instead of garbage linter output.py/.pyifiles pass through normallyProblem
During an Amplifier session, the LLM called
python_checkon TypeScript files. Without any file extension validation, ruff and pyright ran against.tsfiles and produced 228K+ characters of nonsensical output (907 garbage issues). This single tool call consumed ~30% of the Claude context budget, ultimately triggering a failure that crashed the session.Fix
Added validation in
PythonChecker.check_files()-- the shared code path that protects all callers (tool module, hook module, and CLI):.py/.pyifiles and directoriesTest plan
.ts,.js) are rejected with clearNON_PYTHONinfo message