fix(curator): prevent false-positive consolidation from substring matching#19573
Merged
Conversation
…ching _classify_removed_skills used naive 'in' substring matching to detect whether a removed skill's name appeared in skill_manage arguments. Short/common skill names (api, git, test, foo, etc.) matched incorrectly when they appeared as substrings of longer words in file paths (references/api-design.md) or content (latest, testing). Replace with field-aware matching: - file_path: needle must match a complete filename stem or directory name, with -/_ normalised for variant tolerance - content fields: word-boundary regex (\b) prevents embedding in longer words Also add 3 regression tests covering the false-positive scenarios.
Contributor
🚨 CRITICAL Supply Chain Risk DetectedThis PR contains a pattern that has been used in real supply chain attacks. A maintainer must review the flagged code carefully before merging. 🚨 CRITICAL: Install-hook file added or modifiedThese files can execute code during package installation or interpreter startup. Files: Scanner only fires on high-signal indicators: .pth files, base64+exec/eval combos, subprocess with encoded commands, or install-hook files. Low-signal warnings were removed intentionally — if you're seeing this comment, the finding is worth inspecting. |
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
Curator's
_classify_removed_skillsheuristic no longer matches short skill names (`api`, `git`, `test`) as substrings of longer words, so the fallback classification path doesn't invent consolidations where none exist.Root cause
`agent/curator.py` used `needle in hay` with no word or path-component awareness. A removed skill `api` would match `references/api-design.md` or content `running latest tests`, flipping what should be a pruning into a "consolidated into ". This path is only consulted when the authoritative `absorbed_into` declaration and the model's structured YAML block are both missing/malformed, but when it fires it pollutes REPORT.md and can misdirect cron-job skill-reference rewrites.
Changes
Validation
`scripts/run_tests.sh tests/agent/test_curator_classification.py` → 38/38 pass.
Salvaged from PR #19222 by @SimbaKingjoe — cherry-picked with authorship preserved. Closes #19233.