mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-24 00:51:31 +01:00
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 <244097767+vilano93@users.noreply.github.com> 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
This commit is contained in:
4 files changed
+108
-6
No files matched your search
@@ -284,6 +284,46 @@ describe('installed skills beside gstack (GST-3123)', () => {
|
||||
expect(traceLog()).toMatch(/event=routed skill=prove-it score=1 source=\S+prove-it\/SKILL\.md variant=name bug_report=true\n$/);
|
||||
});
|
||||
|
||||
test('words inside inline code or a fenced code block never match a trigger or make a bug report; the prose around them still routes (#4564)', () => {
|
||||
const proveIt = other('prove-it', ['fix this bug', 'prove the fix', 'reproduce the bug in a test']);
|
||||
const names = (text: string, host?: 'claude' | 'codex') => { const d = routePrompt(text, [...routed, proveIt], undefined, host); return d.route ? d.routes.map(r => r.skill) : []; };
|
||||
for (const text of [
|
||||
'You have 1 orchestration message. Run `orca orchestration check --run run_<run-id> --terminal term_<terminal-id>`.',
|
||||
'Run `gh pr review 123 --approve` once CI is done.',
|
||||
'Run ``tool lint check --fix`` and paste the output.',
|
||||
'Run `mycli check` now',
|
||||
'Pasted from CI:\n```\n$ make check\nall tests pass\n```\nWhat does this output mean?',
|
||||
'What does this print?\n~~~sh\nrun the checks || echo broken\n~~~',
|
||||
'What does this print?\n```\nrun the checks\n````\nmore\n````',
|
||||
'rename `handleError` to `onError`',
|
||||
]) {
|
||||
expect([text, names(text)]).toEqual([text, []]);
|
||||
expect([text, names(text, 'codex')]).toEqual([text, []]);
|
||||
}
|
||||
for (const [text, skill] of [
|
||||
['run the checks', 'verify'], ['verify my change in `src/app.ts`', 'verify'], ['run the checks, then `git push`', 'verify'],
|
||||
['an unclosed ` backtick: run the checks', 'verify'], ['```\nmake check\n```\nrun the checks on that', 'verify'],
|
||||
['review this pr before I merge `feature/login`', 'review'], ['please review my changes to `lib/auth.ts`', 'review'],
|
||||
['Saving a draft raises `KeyError: title` when the title is empty', 'prove-it'],
|
||||
['The upload fails on large files; I ran `make check` and it passed', 'prove-it'],
|
||||
['the export crashes on empty input, see `export.ts`', 'prove-it'],
|
||||
['What happened?\n```\nTraceback (most recent call last):\nValueError: bad input\n```', 'prove-it'],
|
||||
]) {
|
||||
expect([text, names(text)]).toEqual([text, [skill]]);
|
||||
expect([text, names(text, 'codex')]).toEqual([text, [skill]]);
|
||||
}
|
||||
});
|
||||
|
||||
test('a prompt at the hook\'s stdin cap full of unmatched backtick runs is split in one linear pass (#4564)', () => {
|
||||
let text = '';
|
||||
for (let i = 1; i <= 60; i++) text += `${'`'.repeat(i)} x `;
|
||||
text += 'y '.repeat(120000);
|
||||
const t0 = performance.now();
|
||||
expect(routePrompt(text, routed).route).toBeNull();
|
||||
// gstack-timing-ok: the bound is the hook's own 1.5 s DEADLINE_MS; a rescan per unmatched run took about 5 s on this prompt, one pass takes milliseconds
|
||||
expect(performance.now() - t0).toBeLessThan(1500);
|
||||
});
|
||||
|
||||
test('a trigger that names its own target claims no bug report; a full /review or /qa trigger keeps a request to find bugs', () => {
|
||||
const proveIt = other('prove-it', ['fix this bug']);
|
||||
const lint = other('auto-fix-lint', ['fix lint errors', 'fix broken links', 'fix postgres bugs']);
|
||||
|
||||
Reference in new issue
Block a user