Skip to content

fix: preserve bounded trigger phrases - #614

Merged
rng1995 merged 1 commit into
NVIDIA:mainfrom
efegokdemir:codex/issue-609-tr1-discourse-boundary
Sep 28, 2026
Merged

rng1995 merged 1 commit into
NVIDIA:mainfrom
efegokdemir:codex/issue-609-tr1-discourse-boundary

Conversation

@efegokdemir

Copy link
Copy Markdown
Contributor

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

  • Treat only literal single-word description triggers as TR1 broad triggers.
  • Remove the flat trailing-discourse-word exception, which misclassified phrases such as go there and work now.
  • Add regressions covering the reported phrases and equivalent discourse tails.

Testing

  • uv run --locked --extra dev pytest -q tests/unit/test_patterns_new.py — 525 passed
  • uv run --locked --extra dev ruff check src/ tests/ — passed
  • uv run --locked --extra dev ruff format --check src/ tests/ — passed
  • git diff --check — passed

Notes

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.

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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 again and says hello world never fired.
  • It caused false positives on bounded verb and noun phrases.
  • Removing it restores parity with the legacy triggers grammar 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

  1. [Non-blocking] This PR reverses behavior that #541 pinned: hello there and hello here were 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.
  2. [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 chat and Use 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)

@rng1995
rng1995 merged commit e3f63ff into NVIDIA:main Sep 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TR1 fires on bounded phrases ending in a discourse word (go there, work now)

2 participants