fix(engine): tighten input reference scanning to reduce false matches#61
Open
mvanhorn wants to merge 3 commits intodanshapiro:mainfrom
Open
fix(engine): tighten input reference scanning to reduce false matches#61mvanhorn wants to merge 3 commits intodanshapiro:mainfrom
mvanhorn wants to merge 3 commits intodanshapiro:mainfrom
Conversation
Fixes three sources of false-positive reference classification:
1. Reject tokens containing spaces as non-path natural language
2. Replace broad ContainsAny("*?[") with looksLikeGlobPattern() that
validates bracket syntax: unmatched [ is rejected, and matched [...]
requires a path separator to disambiguate from programming constructs
3. Add .worktrees and .cargo-target to artifact path exclusions
Fixes danshapiro#48
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…i/ paths - Add gpt-5.3-codex-spark to cliOnlyModelIDs map (fixes TestIsCLIOnlyModel) - Replace root .ai/verify_errors.log and .ai/test-evidence/latest/ with run-scoped .ai/runs/$KILROY_RUN_ID/ paths in demo spec (fixes TestReferenceSurfaces_NoLegacyRootAIScratchPaths) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.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.
Fixes #48
Summary
Input materialization over-classified arbitrary tokens as path/glob references, producing ~1397 warnings per run and materializing irrelevant files. This fixes three root causes.
Changes
1. Reject tokens with spaces (
input_reference_scan.go)Natural language fragments like
"you are wielding ([ch]) [weapon"contain spaces and are clearly not file paths. Added an early rejection for tokens containing whitespace inlooksLikeReferenceToken().2. Validate bracket syntax (
input_reference_scan.go)Replaced the broad
ContainsAny(token, "*?[")check with a newlooksLikeGlobPattern()function that:*and?as glob metacharacters unconditionally[, validates that every[has a matching](rejectsDEFAULT_TOOL_LIMITS[tool_name)/or\) when brackets are the only metacharacter (rejectsmap[string]anystyle programming constructs)3. Expand artifact exclusions (
input_materialization.go)Added
.worktreesand.cargo-targettoisLikelyArtifactInputPath(), preventing materialization of worktree and Cargo build cache artifacts.Test plan
TestInputReferenceScan_RejectsNaturalLanguageWithBrackets- regression test for issue's bad-token examplesTestInputReferenceScan_AcceptsValidGlobBrackets- valid globs likesrc/[abc]/*.gostill workTestIsLikelyArtifactInputPath_ExcludesWorktrees-.worktreesand.cargo-targetexcludedgo build ./...compiles cleanlyThis contribution was developed with AI assistance (Claude Code).