Repository navigation
Conversation
56fbd26 to
edb18bc
Compare
edb18bc to
3b8c1f3
Compare
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the event fires only after a confirmed persist, only for a dashboard user, and the gaps that remain are written down and pinned. Notes
[DESIGN-REVIEWED] 6d692e2 Description read[DESCRIPTION-READ] 439ed221f5a0b8eb5daa97d6ddea000acea9c1ac410f75c005d94c4a9189fe8d That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The event is opt-in: nobody gets anything until they write a hook for it. So it is not a product-shape change, even though its RFC is still Notes
What this change shipsInventory (9 items) — 7 justifiedIntent: let an operator run a hook when a dashboard user moves a session between board lanes, instead of polling the board. This is an ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 6d692e2 Description read[DESCRIPTION-READ] 477cc2c190fc9218c85de6c8e6ca0c7448197b4c21de4de1da1df917e62dd534 That sha256 names the PR description this verdict read. Recompute it with |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
3b8c1f3 to
b521748
Compare
b521748 to
a47c047
Compare
|
@bolichen97 — one narrow factual update on your review, and nothing else. The branch no longer conflicts with I am deliberately not responding here to the split you asked for — that decision is still being made, and I |
|
Requesting the Current state: Why the guard fires: the only path under Precedent: the same label was applied on #7068 to clear this guard for a trusted I do not have write access on this repository, so I cannot apply the label myself — hence the request. Happy to restructure the baseline change instead if you would prefer that to the label. |
|
Coordination note from the #7843 side (per the 09-08 relationship audit): my PR reworks ScriptHook/ScriptHookResult/ScriptHookStore for PreToolUse deny on subagent/task-runner paths while this one rewrites the same store read path and fire() loop. Happy to land in whichever order you prefer - mine is small and rebases cleanly, so I can go second after this lands if that is easier. Just say the word. |
PR triage (2026-10-05) — REBASE + MERGE-DISCUSSION with #10931Code-level audit of head Relationship: OVERLAPPING with open PR #10931 (same author, not a duplicate). Both add REBASE needed (heavy conflicts).
No new P0 and no breaking change found. The concern that the event is selectable but never fires has already been raised: by the Design, First-Principles and UX reviews (BLOCK), the GPT finding, and the maintainer's CHANGES_REQUESTED. I'm not filing a duplicate request. The Recommendation: REBASE, settle the order with #10931, and ship the |
|
The split you asked for has landed. At In it: the Out of it: the lane-matcher picker, draft save/restore across navigation, deep links, the tag-manager hand-off and the capture harness. None of those files appear in the diff. That is the second PR. Two places this differs from your item 1, so you are not reading it from the diff:
The first-principles review lane now blocks on that second point. |
|
@bolichen97 the split landed. Head PR 1 keeps everything on your list: the Of the six things you moved to PR 2, four are gone: draft save/restore across navigation, deep links, the tag-manager hand-off, and the capture harness. I checked that against the diff's added lines rather than the touched files, so a pre-existing sibling key does not read as present. Two are still here, and a review lane required each of them after you wrote your review:
I could not drop either without re-opening a block. If you still want both in PR 2, say so and they come out. That is your call rather than mine. The conflict you mentioned is resolved: GitHub reports All six AI lanes are green at this head, and 92 checks pass. The one remaining red is Sensitive Change Review, which cannot be cleared from here. It refuses any fork PR touching a sensitive path before it looks at a template at all, and this one touches |
|
HOLD at 7077f6b. What would clear it:
I found no defect in the code I read. The dispatch runs only after a confirmed persist (chat_tags.py L368-L374), and a swallowed save failure re-arms the flush without firing (L91-L122). All AI lanes pass on this head. AI findings judged non-blocking:
— crew-pr-reviewer (r136) |
|
HOLD at 3cccea1. Since our r136 hold at 7077f6b the code is unchanged. The new head adds the two Hooks-page screenshots, which clears the PR Policy failure. I found no defect: the lane dispatch runs only after a confirmed persist and past the rollback branch (chat_tags.py#L92-L123). All six AI lanes pass. What would clear it:
AI findings judged non-blocking:
I read the interdiff from 7077f6b, the emit sites, the dispatch gate and every lane body. I did not run tests. — crew-pr-reviewer (r144) |
|
Holding this PR at 3cccea1. Sensitive Change Review is red on this head, and the log gives a real reason, not a flaky run: this is a fork PR that changes a sensitive path (the hook runtime and hook scripts handler), and there is no reasoning template for this head. A fork PR cannot pass that gate. It needs a maintainer security review before it can move. The gate's own path for this is for a maintainer to take it over on a branch of this repository, keeping the author with |
|
Thanks for this PR. On head 3cccea1 the only red check is Sensitive Change Review. Its log says: "Sensitive path changed without a reasoning template for this head." Could you add the sensitive change reasoning template for this head (a PR comment in the format the check describes, including the |
|
@bolichen97 Thanks. A reasoning template can't clear this check for a fork PR. In Separately, the three deferred items @iamwhatever asked about are now #31614, #31615 and #31616, linked in the description. |
|
HOLD at 3cccea1. The code is unchanged since r144. Cleared since r144: the description now links #31614, #31615 and #31616, and each covers its deferred item (folder-tag inheritance emitter, Hooks-page matcher help, the spec's nonexistent seam). Still blocking:
I found no defect; dispatch runs only after a confirmed persist (chat_tags.py#L92-L123). — crew-pr-reviewer (r148) |
|
@bolichen97 I have write access to this repository, so I can move this change onto a branch here myself instead of waiting for a takeover: same commit, a new PR with That clears the gate's fork refusal, but it would not replace the security review you asked for on the hook runtime and |
|
@bolichen97 the split you asked for on 09-10 is done. This PR is now the event part only, rebased on current main. The UI part is in #10931. Could you re-review? Also, Sensitive Change Review says a fork PR can't pass when it touches |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Thanks for the split into a focused event PR. One problem must be fixed before this can merge.
test/test_hooks_composition_contract.py:497: the facade definition count is wrong once this branch is merged with current main.- Trigger: merge this head (3cccea1) into current
main, then runtest/test_hooks_composition_contract.py. - Outcome:
test_every_base_definition_is_in_exactly_one_placefails withassert (13 + 82) == 94. - Cause: #27745 on main also changed this line from
== 93to== 94, forunattended_turn. Git merges the two identical edits without a conflict. The merged tree then has 95 definitions against a pin of 94. - The CI on this head ran before #27745 landed, so the green checks do not cover current main.
- Smallest fix: move
_session_lane_matcher_contextintohook_runtime/hook_dispatch.py, its only caller, and drop its_FACADE_DEFSentry and the count edit. Main's 94 then stays correct. - Other fix: rebase, set the count to 95, and add the reason for the facade entry to the "What stays in hooks.py" list in
memory-skills-hooks.md.
- Trigger: merge this head (3cccea1) into current
Optional:
- No test dispatches a lane hook that has a real matcher. You can delete the matcher filter in
hook_dispatch.py, or change thedirection:id;grammar, and every test stays green. A route-level test for*added:<id>;*and*removed:<id>;*would pin it. _lane_dispatch_is_permittedis denial-tested on the internal-secret transport only. You can parametrize the denial over the app-claim andmember:principals too.- The live SessionLaneChanged payload has no
cwd, but the Test payload has one. A hook that passes Test can then fail when it really fires.
Related: #10931 (same author) models this event differently. Whichever PR lands second must reconcile the two.
Nothing server-side reacted to a lane change, so the board could not trigger anything. The event now fires from the two tag writers that run under a dashboard request, `api_chat_slot_tags` and `api_chat_slot_drop`, carrying the status-only delta as added/removed tag ids. The matcher is direction-tagged, `added:<id>;` and `removed:<id>;`, because the motivating case is a session having ENTERED a lane and an untagged context cannot express it. Matching is whole-string, so the selectors are `*added:<id>;*` and `*removed:<id>;*`; a bare tag id matches nothing. The Hooks page change is the minimum needed to select the event: the picker offers it and the table styles it like its siblings. Help for writing a lane matcher -- a picker that fills in a lane's id, and a grammar line -- is held for the separate Hooks-page UX change the maintainer asked for, together with its screenshots. A dispatch needs a CONFIRMED persist, not just a return value. `save_slot_off_loop` defaults to `best_effort=True`, which catches a lock timeout or I/O error, marks the slot dirty for the periodic flush and returns `True` -- its own docstring says that return does not prove a committed write. Both handlers now persist through `_persisted_tag_write`, which takes the confirming mode and re-arms that flush itself, so the acknowledged edit is still retried and the response is unchanged while a hook no longer runs close-out work for a transition that is not on disk. Folder-tag inheritance on slot create is a KNOWN GAP here, not a designed silence: an inherited folder status tag puts a session into a lane with nothing firing. Its emitter is written and was held out of this change to bring it under the review size cap; it follows as its own PR once this lands, and needs no new authorization rule. The spec, the RFC amendment and the RFC index row all state the gap rather than claiming three emit sites. `HOOK_EVENTS_UNFIRED` goes with this change. With the emitter landed it was literally `HOOK_EVENTS_KAS_ONLY` under a second name, so its seven readers use the original name again. The emitter test asserts through the dispatcher's own spawn seam, not through a file a real hook writes. A sandboxed spawn drops that write, and the module's absence assertions cannot tell it apart from a dispatcher that correctly stayed silent, so the file-channel version read GREEN on a shard where nothing fired at all. Mocking the spawn takes the platform assumption with it, so the module needs no windows-collect-ignore.txt entry.
|
Thanks for the split. The event change is now focused (24 files), and this review found no blocking defect on head 6d692e2. Earlier requests:
A maintainer still has to act before this can merge:
To propose a design, follow the request-for-change process in CONTRIBUTING.md (docs/request-for-change/). What the review checked on this head:
Done well: Optional:
Related: #10931 models this event as pending and dormant. Whichever PR lands second has to reconcile the two. |
|
Continuing this in #32962; thanks for the start. |
Problem / Motivation
Goal: Let someone write a hook that runs when a session's board lane changes, so close-out work can react to the move instead of polling for it.
Nothing server-side reacted to a lane change. A tag write mutated
slot.tags, persisted, and calledpush_slots_update()to tell the browser — with no server-side consumer, so an automation that wanted to act on "this session just entered Done" had to poll the board and diff it itself.Why it matters
A lane is where a team already expresses "this is finished", so it is the natural trigger for close-out work: file the artefact, post the summary, archive the branch. Reaction is no longer bounded by a poll interval, and the delta is computed once here rather than by every consumer.
It does not retire the polling loop for a subscriber that needs certainty. The RFC's v1 delivery bar does not promise every arrival, so a subscriber doing irreversible work still re-reads the board and gains only latency.
Not a goal
chat_auto_tag.maybe_auto_tagwrites non-status tags routinely and never writes a status one, so a tag-general event would be chatty for the board-lane case that motivates it while adding nothing. Widening later is a NEW event (SessionTagsChanged), not a redefinition of this one — which is why the name is lane-scoped.PreToolUsecall; this event ignores it. By the time it fires the write is applied and the drag has happened, so a veto would make the board unusable when a hook breaks rather than preventing anything.originandhook_reentry_depthare the RFC's Phase 2.What changed (motivation → approach → change)
The event is dispatchable (
hooks.HOOK_EVENTS) and registrable (validation.ALLOWED_HOOK_EVENTS), and deliberately absent fromagent._VALID_HOOK_EVENTS— that is kiro-cli's own closed enum, and a generated agent config naming an event it does not know fails to load at all. A test pins all three memberships with that rationale so the divergence cannot be "fixed" by syncing them.The two emit sites, both under a dashboard request.
api_chat_slot_tagsandapi_chat_slot_drop(dashboard/chat_tags.py). Because both carry a dashboard request,_lane_dispatch_is_permittedapplies to them unchanged and neither needed a new authorization rule.A known gap, stated rather than claimed closed: folder-tag inheritance does not fire. The inheritance in
_read_folder_tagsreached fromapi_chat_slot_createis the site a two-handler design misses:validate_folder_tag_idsscreens a folder tag id's shape and vocabulary but not itsstatusfield, so an inherited folder status tag puts a session into a lane with nothing firing, and a hook keyed on entering that lane will not see such a session. Its emitter is written and was held out of this PR to bring it under the review size cap; it follows as its own PR once this lands. It needs no new authorization rule either, so the only thing it waits on is the dispatcher reachingmain. The spec, the RFC amendment and the RFC index row all state the gap.Each dispatch runs after its write has CONFIRMED persisted, on the success path only — and two failure shapes are kept silent, not one. A refusal without writing (the session was deleted or rebound) rolls
slot.tagsback and answers 409 before the dispatch is reached; that branch has its ownpush_slots_update(), so the success call is identified by theoutcome="allowed"SEL row rather than by the broadcast.A lock timeout or I/O error is the shape a return value cannot report.
save_slot_off_loopdefaults tobest_effort=True, which catches it, marks the slot dirty for the periodic flush and returnsTrue— its own docstring says that return "does NOT prove a committed write". Firing on the strength of it would run close-out work for a lane move that never reached disk, and a restart before the retry then restores the old lane with those side effects already taken. Both handlers therefore persist through_persisted_tag_write, which takes the confirming mode and re-arms that flush itself: the acknowledged edit is still retried and the response is unchanged, so suppressing the hook does not turn a recoverable write failure into a lost edit.Silent, deliberately. Load-time reconstruction (
chat_persistence.py,chat_handlers.py) would replay the whole tag history on every restart and read every existing Done as just-entered. The twoslot.tags.appendsites insurface_channel_sessionhave no dashboard caller, so what authorizes a fire there is unanswered — that is the RFC's closing-order step 2, and the choke point is step 3 because it inherits that answer. The permit gate is what makes those deferrals rather than holes: a path that cannot be authorized cannot dispatch.Payload, all keys stamped unconditionally so a hook that always reads one never
KeyErrors:slot,added,removed, andcwdlike every other event (so a hook that passes Test cannot fail oncwdwhen it really fires).added/removedare status-only, not the raw set difference — a single edit can bundle a lane change with a plain-label change, and emitting the whole delta would put a non-status id into the matcher context, letting a hook match a tag the firing contract excludes.Matcher grammar, direction-tagged, id only:
added:<id>;andremoved:<id>;. Direction is in the grammar because the motivating case is "a session entered Done", which an untagged context cannot express — a bare<id>would fire on leaving too. Matching is whole-stringfnmatch, so a bare lane id matches nothing; the selectors are*added:<id>;*,*removed:<id>;*, and*:<id>;*for either. Both bounds are load-bearing and neither is forgeable::and;are outside the id allowlist (\A[a-z0-9_.-]+\Z), so no id can contain either, and an id the allowlist refuses is skipped with a warning rather than escaped.Net additive, and measured as such: 24 files, 1348 insertions, 70 deletions against the base (
git diff --numstatagainst the merge base, excluding the two committed PNG frames, which GitHub counts as binary). An earlier revision of this PR shipped the vocabulary with no emitter and carried refusal machinery to contain it, and later revisions took that back out -- but none of it ever reachedmain, so against the base there is nothing of the sort to remove. Read this as what it is: the event, its emitter and its matcher grammar arriving together. The only subtraction visible from the base is small and local --HOOK_EVENTS_UNFIREDis gone, because with the emitter landed it was literallyHOOK_EVENTS_KAS_ONLYunder a second name, and its seven readers use the original name again.The Hooks page change is the minimum needed to select the event, per the maintainer's split: the event picker offers
SessionLaneChangedand the table gives it the same style and badge as its siblings. Help for writing a lane matcher is not in this PR. A lane's tag id is what the matcher keys on and no surface shows one, so a picker that fills it in, a grammar line under the field and their screenshots belong to the separate Hooks-page UX PR. Until then the grammar is documented in the user doc and the system spec.Test isolation, two host-independence fixes in one autouse fixture per new module.
The process-global hook store is reset around every test. Each module binds one rooted at its own
tmp_path; left bound, a later test on the same xdist worker that moves a status tag would reach the dispatcher, find that store, and recreate an already-deletedtmp_pathto writehooks.jsoninto it -- a side effect outside the running test's own directory, arriving or not depending on test order.The
capabilities.script_hooksgate is permitted explicitly. It defaults to OFF, so with no config a hook is blocked before its subprocess spawns and writes nothing. These tests passed locally only because this developer host enables it, and failed on CI's shards 2 and 3 withexpected exactly one fire, got []-- the fire assertions were reading the host rather than the code. Reproduced by driving the gate directly: permitted passes, denied reproduces CI's exact signature. The denial path now has its own test, which also pins that the gate is asked aboutdashboard:s1-- the firing session's surface-qualified key -- rather than the empty key that would resolve the wrong scope.One rider, declared so it is not undeclared scope. The "unparseable hook entry" warning now names the row id and its event, so an operator can find the row to rename. An earlier revision also respelled the dormant-event check, churned its comments and suppressed an empty tooltip; the first-principles lane showed those were no-ops against the base, and they have been reverted.
One pre-existing finding, reported and not fixed here. The spec's deferral paragraph claims both async call sites "await ONE seam,
_script_hooks_capability_denied_async". That symbol does not exist — each site callsawait asyncio.to_thread(_script_hooks_capability_denied, sk)inline, which is the per-caller hop the paragraph says was avoided. It is present in this PR's base and untouched here; it wants its owndocs:change rather than riding inside a feature PR.The matcher builder lives beside its only caller.
_session_lane_matcher_contextis inhook_runtime/hook_dispatch.py, so thehooks.pyfacade gains no definition andtest_hooks_composition_contract.pykeeps main's count of 94. The_TOKEN_ALLOWEDallowlist stays on the facade with the rest of the module state, which the same contract requires.Backwards compatibility
Additive for anything already working. A hook stored against this name before the emitter loaded, rendered and edited, and still does — it now also arms and accepts a matcher, which it could not before. A row naming an event outside
HOOK_EVENTS_ALLis still not loaded but not erased:_loadkeeps it in_unparsed_hook_entriesand_savewrites it back, so it returns if the name does.The event is absent from
agent._VALID_HOOK_EVENTSand stays absent, so no generated agent config changes.Tests
test/test_session_lane_changed_emitter.py(new, 15 tests): the two tag routes driven through a realTestClient. A lane change fires once carrying the status-only delta with the plain label excluded; a drag fires with both directions, because the drop route's mutual-exclusion strip makes one drag a two-direction transition; a refused persist (409) fires nothing; a swallowed save failure fires nothing while still answering 200 and leaving the slot dirty for retry; a plain label alone fires nothing; an agent caller does not fire the operator's hook; a denied governance capability fires nothing; with no registered hook there is no dispatch at all; a*added:<id>;*hook runs only on entering the lane and a*removed:<id>;*hook only on leaving it, through the real route and matcher; and the permit gate denies each non-person signal alone (internal transport, app claim, crew member) while permitting the person.test/test_session_lane_changed_event.py(new, 23 tests): the event's standing in the store. It arms like any other fired event and accepts a matcher, while the six Kiro Agent triggers still refuse one — the control proving the store's activation contract is intact for the events that are genuinely unfired, rather than loosened across the board to let this one through.windows-collect-ignore.txtentry. Recording through a spawned hook's file write makes the test depend on the sandbox and on the runner's filesystem view: measured, a real-spawn version passed locally, wherewrap_argvreturns the argv unchanged because no sandbox backend exists, and ALL THREE fire assertions came backgot []on CI's Linux shards 2 and 5 while every absence assertion passed — the signature of nothing firing at all, read as a pass. Mocking the spawn removes both dependencies, and takes the POSIX-shell-body assumption with them, so the module is collected on every platform instead of being skipped on Windows.best_effortmode, ids never resolved against the live vocabulary, the whole delta instead of status-only, Test sending no lane payload, the matcher filter removed, the grammar's directions swapped, and the livecwddropped. Each reddens the suite; all restored byte-identical and green. The runner aborts when a breakage's anchor does not match rather than reporting a pass, because one of these controls had already gone vacuous that way once when an edit moved its anchor. The swallowed-save control is why the failure is injected at the inner write rather than by replacingsave_slot_off_loop: a mock raising in its place raises whatever mode the caller asked for, so the test would have passed with the swallowing default restored and proved nothing about the mode.HooksPage.eventPicker.test.tsxasserts the picker offersSessionLaneChangedby name and in order, andHooksPage.rowActions.test.tsxasserts a lane hook's switch is live and not marked dormant.api_hook_testbuilt a payload forUserPromptSubmitandStoponly and passedNonefor every other event, so a valid hook readingjson.load(sys.stdin)["added"]raisedKeyErroron Test and then worked when it actually fired. A third branch suppliesslot,addedandremoved;test/test_api_hook_test_stop_payload.py(6 tests) pins all three branches.455e8ecbf1(test_cli_manifest_signature34 errors,test_onboarding_import_refactor_contract,test_cron_secret_env, and six singletons), with the pristine tip failing one MORE than this branch rather than fewer. 1089 website tests pass across 56 files (the i18n tree plus every HooksPage suite). This PR adds no catalog values. The repo's own baselined gates pass (check_black_formattingdiff-scoped,check_file_line_cap,check_subprocess_encoding,check_acp_frame_host_data,check_agent_sdk_boundary), as doisort/flake8/mypy src/kiro_crew//tsc/eslint --max-warnings 0.Manual verification
Built the website and drove the Hooks page in a headless browser against a stubbed API, with a twelve-row fixture.
The shape bug a passing test hid, twice.
slot.tagsholds tag ids, while thestatusfield that makes an id a lane lives on the tag object instate._tags; andstore._hooksis a dict keyed by id, so iterating it yields id strings. The first cut got both wrong and every test still passed, because each fixture supplied the shape the code expected rather than the shape production holds. mypy caught the second one. The fixtures now resolve ids through the live vocabulary and build their hook throughstore.create(...), the real write path, and one test carries the mistake as its own control: dicts where ids belong must fire nothing.Measured on this revision, one build, four fixtures. At 1440px the LAST RUN column must not overlap the
sticky right-0ACTIONS column, and it does not: overlap 0. The lane row is 77px against a 57px neighbour, inside the 1.5× bound. At 900px the eleven-row baseline is 518px and the twelve-row board is 525px, so this change's contribution to the narrow-viewport overlap is +7px — down from +19px on the previous cut, because the lines that explained a disabled switch are gone.A measurement artifact, named so it is not mistaken for a regression. A first capture showed 27px of overlap at 1440px. The cause is matcher width, not this change: on the eleven-row harness with no lane row at all, a 13-character matcher produces 20px of overlap, while the lane row carrying no matcher produces 0. The measurement therefore used
*:done;*, the spec's own "any movement" selector, which is the same width as the harness's existingfs_write.Screenshots / video
Two frames of this head are committed under
temp-screenshots/session-lane-changed/, where.github/scripts/pr-committed-evidence.shputs them in front of the review lanes. Each claim below was asserted by the capture script before its shot was taken.temp-screenshots/session-lane-changed/hooks-table-lane.png: the hooks table with aSessionLaneChangedrow carrying its badge, an ordinary live switch and the*added:done;*matcher. The row carries nonot fired yet/never firesmark.temp-screenshots/session-lane-changed/hooks-event-picker-lane.png: the event picker open onSessionLaneChanged, directly afterStopand with no dormant mark, above the six Kiro Agent triggers that keep theirs.Help for writing a lane matcher, and its screenshots, belong to the separate Hooks-page UX PR.
Related Issues
Follow-ups deferred from this PR, each tracked on its own:
_script_hooks_capability_denied_asyncseam that does not exist.Implements #7663. RFC:
docs/request-for-change/rfc-session-tag-change-event.md(in-review; its amendment and the README's implementation-state column are updated here, itsstatus:is not — the first-principles lane reads that from the base sha so a PR cannot move its own RFC's review state). Tracking: #13865.Checklist