Repository navigation
fix: preserve bounded trigger phrases - #614
Conversation
Signed-off-by: Efe Gökdemir <[email protected]>
rng1995
left a comment
There was a problem hiding this comment.
[SkillSpector Review]
Hi @efegokdemir, thank you for your contribution to SkillSpector — we really appreciate it!
This PR removes the "broad head + trailing discourse word" retention that #541 added (_DESCRIPTION_TRAILING_DISCOURSE_WORDS = there/here/now/then). Description TR1 now fires only when the extracted trigger phrase is a single broad word, or 2 characters or fewer. That fixes #609's false positives (says go there and says work now were reported as go and work).
I checked what the ~39 removed lines were. They are only the discourse set, the retention condition, and the old parametrized positive test. No references remain. Legacy triggers TR1–TR3, description TR2/TR3, clause extraction and _DESCRIPTION_TRIGGER_PHRASE_RE are unchanged. I also evaluated the phrase regex and the old and new conditions on sample descriptions.
Coverage impact (intentional)
Descriptions whose broad word is followed only by there/here/now/then no longer produce TR1; all of them did on main. Examples: …says hello there, …says hi there, …says ok then.
I think this trade-off is acceptable, for three reasons:
- The retention was a four-word allowlist that any other tail word bypassed. On main,
says hello againandsays hello worldnever fired. - It caused false positives on bounded verb and noun phrases.
- Removing it restores parity with the legacy
triggersgrammar documented above_DESCRIPTION_TRIGGER_PHRASE_RE, where multiword triggers are never TR1.
Forms bounded by quotes or punctuation still report TR1 on both main and this head, e.g. says "hello" to start a chat and says hello, then greet them back. Bare says hello still fires. TR3 catch-all detection (whenever the user sends any message) is unaffected.
Findings
- [Non-blocking] This PR reverses behavior that #541 pinned:
hello thereandhello herewere TR1 positives, added at a reviewer's request. Please say so explicitly in the PR description, so the trade-off is visible when #609 is closed. If maintainers prefer to keep greeting phrases, an optional refinement is to keep the discourse tail only for interjection heads (hi,hello,hey,thanks,ok,yes,no,please), where there/here/now/then can only be discourse. Verb and noun heads (go,work,make,code, …) would then stay bounded phrases, which still satisfies #609. - [Non-blocking, optional]
tests/unit/test_patterns_new.py:2472: with the old test removed, every description TR1 positive fixture now ends on the trigger word, which is the fixture-shape gap raised during #541. Consider adding positives where a quote or punctuation bounds the broad word and prose follows, e.g.Use this skill whenever the user says "hello" to start a chatandUse this skill whenever the user says hello, then greet them back.
Tests/CI
All checks pass. The new parametrized negatives cover both #609 phrases and the two former positives. The bare-hello positive, the hello world negative, the article test and the SKILL.md frontmatter end-to-end test are all still there. There is no competing PR for #609, and GitHub reports this PR as mergeable with current main.
Decision: Approved (reviewed head 91a925aa8044e62ecd2aaa5ac1e6c87a2ae0e0ae)
Summary
Prevent TR1 from reducing bounded multiword trigger phrases to their first word when the phrase ends in a discourse-looking word.
Closes #609.
Changes
go thereandwork now.Testing
uv run --locked --extra dev pytest -q tests/unit/test_patterns_new.py— 525 passeduv run --locked --extra dev ruff check src/ tests/— passeduv run --locked --extra dev ruff format --check src/ tests/— passedgit diff --check— passedNotes
The change preserves the existing single-word TR1 behavior while treating the complete bounded wording as the trigger whenever the description names more than one word. CUDA/GPU hardware is not required for these static-analysis tests.
AI assistance was used during implementation. The human submitter reviewed the complete diff and test results. No competing open PR for #609 or this finding was found before submission.