Skip to content

fix(kas): match spec hook tool matchers against KAS's tool id - #14065

Merged
iamwhatever merged 1 commit into
mainfrom
fix/kas-spec-hook-matcher-vocab-13926
Sep 26, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
fix/kas-spec-hook-matcher-vocab-13926

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Item 3 of #13926 ("Matcher vocabulary across harnesses"). Refs #13926; the issue stays open for its other items.

A spec hook's matcher names kiro-cli tools (execute_bash, fs_write). On KAS, Crew's turn loop compared it with the call's title. For a KAS shell call the title is the command line (touch /tmp/x), so a tool-scoped spec preToolUse hook never fired. KAS's tool names also differ: its shell tool is run_command.

What changed

  • acp/_dispatch.py: build_permission_event reads the id KAS states on a permission request, _meta.kiro.toolId, into a new AcpEvent.harness_tool_id (acp/types.py). Only an identifier survives (word characters, ., - and the /, @, : separators; no glob characters or whitespace), and it is not read under a gate envelope. providers/acp.py forwards it through _to_llm_event, so the turn loop sees it.
  • acp/kas_permissions.py: KAS_TOOL_IDS_BY_KIRO_TOOL is the one kiro-cli name -> KAS ids table (execute_bash -> run_command, fs_write -> fs_write/fs_append/str_replace/delete_file, fs_read -> read_file/list_directory, grep, glob, web_fetch, web_search -> remote_web_search, use_subagent -> invoke_sub_agent). Every id in it was stated by a live KAS session on a permission request (see Testing). KIRO_TOOL_ALIASES keeps kiro-cli's legacy shell key and the short read/write names working. The public surface is KAS_TOOL_IDS_BY_KIRO_TOOL, KIRO_TOOL_ALIASES, KAS_TOOL_MATCH_VOCABULARY and kas_tool_match_names(tool_id), so other callers can import it instead of adding a second table. There was no name table to reuse: CAPABILITY_BY_TOOL maps names to capabilities, not to KAS tool ids.
  • hooks.py: ScriptHookStore.fire(extra_hooks_tool_names=...): when given, an extra (spec) hook's tool matcher is compared with those names instead of tool_name. Globs keep working, because the tool id is translated (KAS id plus the kiro-cli names it stands for) and the matcher is left as written. A spec hook's stdin reports the tool's kiro-cli name (execute_bash) as tool_name, so a script that branches on it reads the same vocabulary as its matcher; a Hooks-page hook in the same fire still gets the title.
  • dashboard/chat_runner.py: _fire(tool_id=...) passes agent_sdk.spec_hooks.spec_hook_tool_names(event.harness_tool_id) (the agent_sdk seam onto kas_tool_match_names) only when the session has spec hooks, which only a crew_fires_spec_hooks backend (KAS) gets. A call KAS names no tool for gets None, so its spec hooks are matched on the title as before rather than skipped. The four PreToolUse call sites each gain one tool_id=event.harness_tool_id argument.
  • agent_sdk/spec_hooks.py: nothing is dropped and nothing widens. A PreToolUse matcher the table does not know (use_aws, disclose_context, an MCP id) is kept, meets a KAS id it matches as written, and is warned about when the spec is read. A tool-scoped PostToolUse matcher is warned about too, since it still meets only the title.
  • docs/agent-spec-fields.md: the hooks row says how a tool matcher is read on KAS.

Unchanged: Hooks-page hooks still match tool_name. kiro-cli sessions get no spec hooks from Crew. PostToolUse spec hooks still see the title, because KAS's tool_call frames carry no tool id. That gap is recorded on #13926.

Testing

  • test/test_spec_hook_kas_tool_names.py (new) covers the table, the wire read (missing, malformed and trailing-newline ids read as empty), conversion (every matcher kept; one the table does not know is warned about, and still meets the KAS id it names), and store matching (the title is never matched). Through _run_chat: on KAS, an execute_bash spec preToolUse exit 2 rejects the run_command call; an fs_write matcher does not fire and the call is approved; a kiro-cli session fires no spec hook.
  • Mutation check: with _fire passing no translated names, the KAS block test fails.
  • test/test_crew_fired_spec_hooks.py was updated to kiro-cli matcher names (execute_bash, exec*). The related suites pass: test_kas_permissions, test_script_hooks, test_dashboard_approval, test_hook_matcher_modes, test_agent_spec_fields_doc (439 passed).
  • black, isort, flake8 and mypy pass on the touched files.

Live KAS probe (kiro-cli 2.24.1, acp --agent-engine v3). It uses Crew's own build_permission_event, spec_script_hooks and ScriptHookStore.fire, and a spec hook that exits 2:

matcher: execute_bash
harness_tool_id='run_command' names=('run_command', 'execute_bash')
crew fired 1 hook(s), blocked=True, tool='touch /tmp/kas5b-probe/ran'
shell command actually ran: False

matcher: fs_write
harness_tool_id='run_command' names=('run_command', 'execute_bash')
crew fired 0 hook(s), blocked=False, tool='touch /tmp/kas5b-probe/ran'
shell command actually ran: True

The same probe, with every call allowed, asked KAS to use each built-in tool once. These are the toolId values KAS stated on the permission requests, which is where every table row comes from:

read a file         -> read_file        list a directory -> list_directory
create a file       -> fs_write         replace in file  -> str_replace
append to a file    -> fs_append        delete a file    -> delete_file
grep                -> grep_search      find files       -> file_search
fetch a URL         -> web_fetch        search the web   -> remote_web_search
invoke a sub agent  -> invoke_sub_agent run a command    -> run_command

Pattern harvest

Rule candidate: review-prompt
Pattern: a matcher or allowlist written in one harness's tool vocabulary is compared with another harness's identity (or with a display title) without a translation, so it silently never matches.

@iamwhatever
iamwhatever requested review from a team and pepmach September 26, 2026 01:04
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 26, 2026
@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — 🟡 CONCERNS

Design-level review of 8ccd4a5bdddbf90162009f904f44f4e5aeb973f6 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: CONCERNS

Hand-pinned KAS tool-id table has no runtime drift signal: a kiro-cli rename silently re-creates the exact never-fires bug this PR fixes.

Watch

  • KAS_TOOL_IDS_BY_KIRO_TOOL is grounded in ids one live probe of kiro-cli 2.24.1 stated ("Every id in it was stated by a live KAS session"), and KAS's own table (policy/capabilities.ts) lives outside this repo, so nothing in CI or at runtime can notice when a later kiro-cli renames an id (run_command → anything else). Mechanism: kas_tool_match_names then returns only the unknown id itself, an execute_bash matcher stops matching, and a spec preToolUse guard silently stops blocking shell calls after an upgrade — the same silent-miss failure mode the PR's own "Pattern harvest" names, now recurring on version drift instead of on day one. The spec-read warning covers unknown matchers, not unknown runtime ids, so this direction is unobserved.
    Clears when: the turn loop (or kirocrew doctor) logs once per session when a KAS-stated harness_tool_id falls outside KAS_TOOL_MATCH_VOCABULARY, or an equivalent drift probe is recorded on Agent spec hooks: remaining gaps after KAS delivery (#11116) #13926.

[DESIGN-REVIEWED] 8ccd4a5

@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of 8ccd4a5bdddbf90162009f904f44f4e5aeb973f6 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Verify KAS's toolId vocabulary holds on every kiro-cli version Crew supports — the table was probed on 2.24.1 only; a renamed id silently un-fires matchers again.

Not justified as shipped

  • Item 7 — rides along: the unknown-matcher warning ("is warned about when the spec is read") is diagnostics beside the fix, declared, harm-free surface (one log line).
  • Item 8 — rides along: the PostToolUse title warning covers the gap this PR deliberately leaves ("KAS's tool_call frames carry no tool id"), declared and deferred to Agent spec hooks: remaining gaps after KAS delivery (#11116) #13926.

What this change ships

Inventory (10 items) — 8 justified

Intent: make an agent spec's tool-scoped hooks actually fire on KAS, where matching against the call's title meant they never ran — a FIX (#13926 item 3; live probe; the new turn-loop test fails on base per the mutation check).

  1. A spec hook naming execute_bash now blocks a KAS shell call — justified
  2. Permission events carry the id KAS states, validated to identifier shape — justified
  3. One kiro-cli↔KAS name table with shell/read/write aliases (spellings WITHHELD_FROM_AUTO_APPROVE already records; grep of KAS ids like run_command in src/ found no prior table) — justified
  4. agent_sdk.spec_hook_tool_names seam onto the ACP layer (rfc-crew-agent-sdk-boundary, partial) — justified
  5. Hook store matches extra hooks on translated names (extra_hooks_tool_names, one caller, values genuinely plural) — justified
  6. Spec hook stdin reports the kiro-cli name as tool_name — justified
  7. Warning when a PreToolUse matcher names no known tool — rides along
  8. Warning that tool-scoped PostToolUse matchers still meet only the title — rides along
  9. A call KAS names no tool for keeps title matching — justified
  10. agent-spec-fields.md hooks row updated in the same commit — justified

[FIRST-PRINCIPLES-REVIEWED] 8ccd4a5

@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 8ccd4a5bdddbf90162009f904f44f4e5aeb973f6 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 8ccd4a5

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 8ccd4a5bdddbf90162009f904f44f4e5aeb973f6: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review -- 🟡 CONCERNS

Which legitimate operations does 8ccd4a5bdddbf90162009f904f44f4e5aeb973f6 newly refuse? Updated in place on each push. A script-confirmed regression blocks; the model proposes candidates and never decides a refusal.

Verdict basis: the reviewer's own judgement; no confirmed regression.

Security scope review -- adjudicated candidates

  • macos-latest (platform posix): 10 classified, 0 newly refused, 10 still allowed.
  • ubuntu-latest (platform posix): 10 classified, 0 newly refused, 10 still allowed.
  • windows-latest (platform windows): 8 classified, 0 newly refused, 8 still allowed.

No candidate flipped from allowed to refused.

Scope-Verdict: CONCERNS

TIGHTENING: On a KAS PreToolUse permission request, a spec hook's tool matcher is no longer compared with the call's title but only with the harness-stated tool id and its kiro-cli translations, and the id itself must survive a new validator — not isinstance(tool_id, str) or len(tool_id) > _MAX_HARNESS_TOOL_ID_LEN or not _HARNESS_TOOL_ID_RE.fullmatch(tool_id) drops it, and in the store if extra_hooks_tool_names is not None and id(hook) in extra_ids: if hook.matcher != "*" and not any(_tool_matches(hook.matcher, name) for name in extra_hooks_tool_names): continue. The one threat refused: a model-authored string (the call's title is the model's own command line, and a forged _meta.kiro.toolId carrying globs, whitespace, or oversize) selecting which tool-scoped spec-hook guards fire for a call.

ADJUDICATED: 14 candidates, 0 confirmed newly-refused handed to this review. The tightening does not touch the composite the classifier reads — kiro_crew.security's is_sensitive_bash_command, audit_bash_exfiltration, and is_denied are unmodified by this diff, and that package imports none of the touched modules (acp/_dispatch.py, acp/kas_permissions.py, agent_sdk/spec_hooks.py, hooks.py's ScriptHookStore.fire, chat_runner.py, providers/acp.py) — so the 14 rows are boundary controls over the touched area (the touched test files' pytest invocations, read-only traces for toolId/harness_tool_id/run_command, agent-spec reads, kirocrew doctor, file-scoped git reads, the docs gate on the edited page), not probes of a changed matcher.

PLATFORM COVERAGE: posix (6 rows: the sanctioned .venv/bin/python -m pytest shapes for both touched test files, rg traces of the new field and wire key, the fixture search, the ~/.kiro/agents spec read) and windows (4 rows: the .venv\Scripts\python.exe pytest spellings, Select-String, and the %USERPROFILE% spec read) cover the only platform-shaped operations this area's maintainers run — interpreter paths, separators, and env-var expansion — plus 4 platform-neutral any rows (kirocrew doctor, file-scoped git diff/git log, the docs gate with a file argument). The diff's one new platform-adjacent assumption, _HARNESS_TOOL_ID_RE = [A-Za-z0-9_.\-/@:]+ excluding \, is not a path assumption — a KAS/MCP tool id is an engine-written name (run_command, @srv/tool:v1), never a host path — so no windows spelling of a legitimate id exists to probe; that judgment is stated here rather than silently assumed. Per-leg verdicts are the deterministic fold's to report after capture.

UNADJUDICATED: The whole tightening lives outside what the classifier can settle — a shell command line cannot express any of it, because the refusal depends on the session's spec and the wire frame, not on argv. The honest verdict is therefore CONCERNS, not PASS, despite the empty confirmed set.

  1. Guard: _permission_tool_id (acp/_dispatch.py). Call path: KAS session/request_permission frame → build_permission_event → _permission_tool_id(params) (skipped under a gate envelope) → AcpEvent.harness_tool_id → providers/acp.py → chat_runner. Candidate legitimate inputs I would have submitted: run_command (the live 2.24 id), @srv/tool:v1 (the MCP spelling the regex deliberately admits), and an id of exactly 128 characters (the fence sits at >, so 128 must survive). The failure mode of a false drop is contained — the event falls back to title matching "as a Hooks-page hook is", so a legitimate call is not refused, only matched in the older vocabulary — which is why this is a named gap rather than a BLOCK.

  2. Guard: the matcher rebinding itself (spec_hook_tool_names → ScriptHookStore.fire(extra_hooks_tool_names=...)). Call path: chat_runner's four PreToolUse sites pass tool_id=event.harness_tool_id; on any named call the spec hook's matcher never sees the title (test_a_matcher_is_never_compared_with_the_title). Two populations flip and neither is expressible as a shell row:

    • Newly refused: a KAS session whose spec carries an exit-2 PreToolUse hook with a tool-name matcher (execute_bash, shell, fs_write, read) that was inert at base — every call of that kind in that session flips approved→blocked at head. That is the change's stated intent (the guard's author asked for it), but it lands with no per-spec notice at session start, only a log line for unknown matchers.
    • Narrowing I can argue but not confirm: the table's row breadth makes one matcher reach sibling operations — fs_write now also fires (and with an exit-2 hook, blocks) delete_file and fs_append, and fs_read also reaches list_directory. An author whose hook meant "guard edits" loses deletes with no record that anyone chose it. If that breadth is intended, a doc line per row would make it chosen; if not, splitting delete_file out of the fs_write row is the narrow fix that keeps the threat (title steering) refused.
    • The opposite direction — a title-glob matcher (*rm -rf*) that fired at base and never fires at head on named calls — is a retired guard, which belongs to the other reviewers' lane and is noted here only so it is not read as this lane's silence.

[SCOPE-REVIEWED] 8ccd4a5

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Addressed in f9545e4:

  • GPT BLOCKING (spec_hooks.py:157, shell dropped): real. KIRO_TOOL_ALIASES maps shell -> execute_bash and read/write -> fs_read/fs_write. So those matchers are kept and meet the same KAS ids (kas_tool_match_names("run_command") == ("run_command", "execute_bash", "shell")). A test covers it.
  • GPT FINDING (docstring contradicts PostToolUse): the module docstring and agent-spec-fields.md now say the translation applies on PreToolUse only, and that PostToolUse still sees the title.
  • Design CONCERNS (silent fail-open on a missing or renamed toolId): spec_hook_tool_names(tool_id, hooks) warns and SEL-records, once per id, an empty or table-unknown KAS tool id while a tool-scoped spec hook is loaded.
  • First Principles item 4 (unverified rows): every row is now a toolId a live KAS session stated on a permission request (the probe table is in the PR body). Rows with no live evidence (code, todo_list, knowledge, the process-control ids) were removed.
  • First Principles item 6 (spec_hook_tool_names is a pure delegation): it now also carries the drift audit above, so it is no longer a plain pass-through.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 26, 2026
@iamwhatever
iamwhatever force-pushed the fix/kas-spec-hook-matcher-vocab-13926 branch 2 times, most recently from cbc073b to cb477da Compare September 26, 2026 01:43
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 26, 2026
@iamwhatever
iamwhatever force-pushed the fix/kas-spec-hook-matcher-vocab-13926 branch from cb477da to 77c2db6 Compare September 26, 2026 01:55
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Addressed in 77c2db6 (squashed to one commit):

  • GPT BLOCKING (spec_hooks.py:193, a disclose_context guard is dropped) and Design CONCERNS (an MCP-scoped hook is dropped): both real, and the same kind of problem the shell and touch* findings were. The load-time drop is removed. A PreToolUse matcher the table does not know is now kept. It is compared with KAS's raw id as written, so disclose_context meets disclose_context (new test), and it is warned about once. No row was added for disclose_context, because no live permission request has stated that id. With nothing dropped, the disarm path this class of finding keeps hitting is gone.
  • Design suggestion (the description says shell names no tool): the Testing section now names the updated matchers (execute_bash, exec*).

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 26, 2026
@iamwhatever
iamwhatever force-pushed the fix/kas-spec-hook-matcher-vocab-13926 branch from 77c2db6 to 856d190 Compare September 26, 2026 02:05
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Advisory items on 856d190:

  • Design (do the table's ids hold on kiro-cli 2.23, the supported floor?): checked against the installed KAS bundles for 2.23.0, 2.23.1 and 2.24.1 (@kiro/agent/dist/server/acp-server.js). All three declare the same tool ids (run_command, read_file, list_directory, fs_write, fs_append, str_replace, delete_file, grep_search, file_search, web_fetch, invoke_sub_agent). All three also build the permission request's _meta.kiro.toolId the same way. remote_web_search is not a string literal in any of the three bundles; it was stated live on 2.24.1.
  • GPT (*search also fires for grep_search / file_search): left as is. A glob is matched against the raw KAS id as well as the translated names. That is what lets a matcher naming a KAS id (or an MCP id) work at all, and *search meeting every *_search id is what the glob says. Matching raw ids only exactly would bring back the dropped-guard class this PR removed. For a deny hook, the wider match is the safe direction.
  • First Principles (Hooks-page matchers in kas_wire.select_hooks are compared with KAS's toolId untranslated): real, and outside this PR's spec-hook scope. Recorded on Agent spec hooks: remaining gaps after KAS delivery (#11116) #13926.

@iamwhatever
iamwhatever force-pushed the fix/kas-spec-hook-matcher-vocab-13926 branch from 856d190 to 5df56f6 Compare September 26, 2026 02:32
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Addressed in 5df56f6, from the Backend Tests reds and the Opus 5 findings on 856d190:

  • _to_llm_event dropped harness_tool_id (Opus, plus the test_acp_provider parity red): real, and the most important one. Production never saw the id, and the turn tests missed it because they built the LLMEvent directly. providers/acp.py now forwards the field. The KAS frame snapshot is re-recorded; the recorded KAS permission frame now carries "harness_tool_id": "run_command".
  • An unnamed call was treated as "no scoped hook applies" (Opus): spec_hook_tool_names("") now returns None, so those spec hooks are matched on the title, as before this PR and as a Hooks-page hook is. A new test covers it.
  • An MCP-shaped id was discarded (Opus): _HARNESS_TOOL_ID_RE admits /, @ and :, and still refuses glob characters, whitespace and ids over 128 characters. Tests cover both directions.
  • Shell-family coverage (Opus): the table comment now says coverage is per id, not per capability. Only ids seen live get a row. Any other KAS id is met by a matcher that names it as written.
  • Audit hygiene (Opus): the unknown-id record has its own SEL event (spec_hook_match / kas_tool_id_unknown), no longer config_hooks_merge. It is bounded at 64 ids without being cleared, so no id repeats, and it says so once when full. _fire runs it through asyncio.to_thread.
  • Cross-checking toolId against is_shell (Opus): not done. toolId is engine-written in the same frame family the shell cache comes from, with no model-authored path into it. A mismatch would mean KAS contradicting itself, and the unknown-id audit is the visible signal for drift.
  • Windows / Linux shard reds: they were the same two tests above, and both pass locally now.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Sep 26, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Addressed in 5cf3d4c:

  • GPT BLOCKING (spec_hooks.py:179, unknown-id overflow is not counted): real under a-bound-bounds-every-field-it-retains. Calls that arrive once the 64-id bound is full are now counted in _unknown_tool_ids_overflow and read through unknown_tool_id_overflow(). The warning logged when the bound is first reached names the counter. The bound test asserts that 5 ids past the bound give an overflow of 5.
  • Design / First Principles (does the oldest supported KAS state the same ids): both PASS. The 2.23.0 and 2.23.1 bundle check is in the earlier comment. If a KAS build states no toolId, the spec hooks fall back to base behavior, which is title matching.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 26, 2026
@iamwhatever
iamwhatever force-pushed the fix/kas-spec-hook-matcher-vocab-13926 branch from 5cf3d4c to f508561 Compare September 26, 2026 04:37
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Addressed in f508561:

  • First Principles BLOCK (unknown_tool_id_overflow() has no consumer): right. The whole runtime unknown-id audit is removed: the id set, the bound, the counter, its own SEL event, and the spec_hook_tool_names wrapper. It was added for the drift concern, and each round asked for more machinery around it (bound, counter, off-loop I/O). _fire now calls kas_tool_match_names directly, and an unnamed call still falls back to title matching. Drift stays visible in two places: a matcher the table does not know is warned about when the spec is read, and a renamed built-in id leaves a kiro-cli-named hook unmatched for exactly the calls the new tests pin. The earlier GPT overflow finding goes away with the counter it was about.
  • Design CONCERNS (a tool-scoped PostToolUse spec hook misses silently on KAS): a tool-scoped postToolUse matcher is now warned about when the spec is read, saying it is compared with the title. There is a test for it. The frame gap is recorded on Agent spec hooks: remaining gaps after KAS delivery (#11116) #13926.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 26, 2026
@iamwhatever
iamwhatever force-pushed the fix/kas-spec-hook-matcher-vocab-13926 branch from f508561 to 7f211a0 Compare September 26, 2026 04:58
@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

Reviewed 8ccd4a5bdddbf90162009f904f44f4e5aeb973f6 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 8ccd4a5

Verdict parsed from the review's SHA-scoped output markers for commit 8ccd4a5bdddbf90162009f904f44f4e5aeb973f6.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 8ccd4a5bdddbf90162009f904f44f4e5aeb973f6: <one-sentence reason>

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Sep 26, 2026
@iamwhatever
iamwhatever force-pushed the fix/kas-spec-hook-matcher-vocab-13926 branch from 7f211a0 to 290baf0 Compare September 26, 2026 06:26
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running labels Sep 26, 2026
A spec hook's matcher names kiro-cli tools (execute_bash, fs_write). On KAS the
turn loop compared it with the call's title, which for a shell call is the
command line, so a tool-scoped spec PreToolUse hook never fired there.

Read the tool id KAS states on a permission request (_meta.kiro.toolId) into
AcpEvent.harness_tool_id, and on a PreToolUse match the spec's own hooks
against that id plus the kiro-cli names it stands for, from one table
(kas_permissions.KAS_TOOL_IDS_BY_KIRO_TOOL, with the shell/read/write aliases).
Every id in the table was stated by a live KAS session. Hooks-page hooks,
PostToolUse and kiro-cli sessions are unchanged.

Nothing is dropped and nothing widens: a matcher the table does not know is
kept, meets a KAS id it matches as written, and is warned about when the spec
is read. A call KAS names no tool for keeps title matching. The spec hook's
stdin reports the tool's kiro-cli name as tool_name.

Refs #13926
@iamwhatever
iamwhatever force-pushed the fix/kas-spec-hook-matcher-vocab-13926 branch from 290baf0 to 8ccd4a5 Compare September 26, 2026 15:14
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 26, 2026
@iamwhatever
iamwhatever enabled auto-merge (squash) September 26, 2026 22:52

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Read the full diff. The tool-id read is validated to an identifier (no glob metacharacter, no whitespace, length-capped) and comes from the engine-written _meta.kiro.toolId, not the model's arguments; the no-overlapping-rows test is the right invariant. Required gate green. Approving.

@iamwhatever
iamwhatever merged commit 5f42e5b into main Sep 26, 2026
101 checks passed
@iamwhatever
iamwhatever deleted the fix/kas-spec-hook-matcher-vocab-13926 branch September 26, 2026 22:58
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 26, 2026
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.

2 participants