Repository navigation
Conversation
A prompt such as "Run `tool check --run <id>`", typed into a session by an orchestration tool to wake it, routed to /verify on the trigger "run the checks": "check" inside the inline code span supplied the second content word. "Run `gh pr review 123`" routed to /review the same way. Trigger scoring (scorePrompt, and the find-bugs phrase check in routePrompt) now reads the prompt's prose: inline code spans and fenced code blocks are blanked out as CommonMark reads them. Unmatched backticks stay plain text. The bug-report signs still read the code, where an exception name often sits. Claude Code and Codex share routePrompt, so both hooks get the fix. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
Thank you @vilano93. I reproduced this on current main (92c6c8a): |
The prompt-routing hook no longer acts on words inside backticks or code blocks, so a prompt that quotes a command (`Run `mycli check` now`) stops getting a wrong "run /verify" or "run /review" line. Why: routing is on by default, so any session that quotes commands got these hints; this fixes the report in #4564 by @vilano93, rebuilt on current main. Nothing to do: plain requests ("run the checks", "review this pr", bug reports in words) route as before. Co-authored-by: vilano93 <[email protected]> Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p1/specialist-batched#1 reader=red-team Review-Finding: p1/specialist-batched#2 reader=testing
|
Thank you, @vilano93. This was a clear report with a good repro. We rebuilt the fix on current main in #4566, which is now merged, and you're credited as co-author. Words inside backticks and fenced code blocks no longer route a prompt to /verify or /review. #4566 also stops a |
The prompt-routing hook no longer routes a prompt because of words inside backticks or code blocks; only the prose around them can match a trigger.
Why: a tool that wakes a session with "Run
<cli> … check …" got a /verify hint on every message, and "Rungh pr review 123" got a /review hint.Nothing to do: "run the checks", "verify my change" and other prose requests route as before, on Claude Code and Codex.
Why (in your own words)
I run Claude Code sessions as workers under a coordinator. The coordinator wakes a session by typing one line into it, for example:
With
skill_routingon (the default since 1.101), every one of these lines gotthis request fits /verify. Run /verify with the Skill tool before you start. In a coordinator session that happens dozens of times a day, and the model has to decide each time to ignore an instruction from gstack. Nothing in the line asks for checks. "run" comes from the prose, and "check" is a subcommand inside the code span, so the two content words of the/verifytrigger "run the checks" are both "present" and the trigger scores 1.0.Related, but a separate cause: #4423 (messages from other sessions routed as if a person asked). This PR doesn't detect injected messages. It fixes the narrower rule that applies to typed prompts too: a command quoted in backticks is not a request in words.
Live evidence
Same prompt, same installed skills (
~/.claude/skills), dry run withgstack-skill-route --explain:Installed 1.102.0.0:
This branch:
Counter-checks on this branch:
run the checks→route: /verify;verify my change in `src/app.ts`→route: /verify;Run `gh pr review 123 --approve` once CI is done.→route: none(on 1.102:/reviewvia "review this pr").The new test was red before the fix, on the first prompt:
Every negative case routed before the fix, checked one by one against the real
/review,/qaand/verifytriggers:Scope
lib/skill-route.ts:proseText, blanks out Markdown code as CommonMark reads it. That covers fenced blocks (``` or ~~~, closed by a fence of the same character that is at least as long; an unclosed fence runs to the end) and inline code spans (a backtick run closed by a run of the same length; an unmatched backtick stays text).scorePromptand the find-bugs phrase check inroutePromptscorepromptWindow(proseText(prompt)).bugReportstill reads the raw prompt, because an exception name in backticks (`ValueError`) is evidence of a bug report.hosts/codex/hooks/codex-skill-route-hook.tscalls the sameroutePrompt, so it gets the fix with no change. The test asserts both hosts.test/skill-route.test.ts: one test with four prompts that must not route (the wake-up line,gh pr reviewin a span, a double-backtick span, a fenced CI paste) and six that must still route to /verify (plain prose, prose next to code, an unclosed backtick).docs/skill-routing-and-contracts.md: one bullet on the rule.changelog.d/fix-skill-route-ignores-code-spans.md: the changelog fragment.--explainruns above on macOS (Apple Silicon, Bun 1.4.4).bun test test/skill-route.test.ts test/codex-hooks.test.tshas 56 passing tests. That includes the 60 plain prompts and the B1 in-sample set, unchanged.bun run typecheckis clean, andbun run typecheck:testreports none new.bun run testexits 1 on this machine both on this branch and on an untouchedupstream/maincheckout (bd04289): 92 test files red on the branch, 101 on main. That's shared-HOME and concurrency noise across the pre-PR checks, cso, update-check and other suites, and no skill-route file is among them. Two files were red only on the branch run,shard-engine-equivalenceandstrict-output-formats. Run alone, they pass on the branch and fail on main, so they're flaky here. CI is the judge for the full suite.skill-routing-e2e). The hint text is unchanged; only which prompts get it.Liveness proof (required for external contributors)
Checklist
GSTACK PRtyped live into a real surface) or PR author is@garrytan(owner exemption)🤖 Generated with Claude Code