Skip to content

fix(kas): run a folder's .kiro/hooks files after its crew turn on - #46918

Open
buluoray wants to merge 1 commit into
mainfrom
crew/slack/project-hook-files-26568
Open

buluoray wants to merge 1 commit into
mainfrom
crew/slack/project-hook-files-26568

Conversation

@buluoray

@buluoray buluoray commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A project's own .kiro/hooks/*.json hook files run in a dashboard Kiro Agent (KAS) chat once the owner presses Turn on for that folder, so a workflow that ships its hooks this way (AWS AI-DLC) works without a terminal.

On KAS, Crew lists a checkout's standalone .kiro/hooks/*.json files only to show a notice, and never runs them. kiro-cli chat --agent-engine v3 runs the same files in a trusted project. AI-DLC's Kiro distribution keeps all five of its hooks in these files, so in a dashboard chat none of them run: its approval gates never see that a person replied, and the workflow stops at the first /aidlc request.

The notice that says so is also out of date. It says Crew "cannot read this backend's workspace-trust decision", but Crew has had a per-folder choice since #33578.

Why it matters

Teams adopting AI-DLC through Crew cannot use it from the dashboard. The only workaround is a terminal, or copying the files into ~/.kiro/hooks, which makes them run in every chat, Bots included.

Not a goal

What changed (motivation → approach → change)

Symptom: zero project hook files run on KAS. Cause: the user-file loader reads only ~/.kiro/hooks, and the per-folder choice covers only a folder agent's own hooks.

Approach: the files follow the same per-folder choice as a folder agent's own hooks (#33578): the folder's Turn on in Crew, or kiro-cli's trust of the folder, through the same row and the same record.

  • The consent fingerprint in src/kiro_crew/project_hooks_consent.py includes each file (_scan_hook_files), so an edited, added or renamed file needs a new Turn on. A Turn on saved before fingerprints existed adopts only the agent files' hooks, so a folder with hook files asks again.
  • Each file is read link- and hardlink-safe and must lie inside the checkout. A link (even one inside the checkout), or a .kiro/hooks that points outside, is never read. A checkout at HOME has none: its .kiro/hooks is the user's own directory.
  • agent_sdk/project_hook_files.py converts the consented files like ~/.kiro/hooks files. They get spec_origin="project_file", so the full deny list applies, and the governance name projectfile:<stem>.
  • The hooks ride the seams the user files already use: every KAS turn's merge, pre_tool_hook_matchers by session folder (sub-agent targets included; a hook file that cannot be read under a yes withholds every auto-approval, as an unreadable agent spec does; see the table below), the folder PreToolUse mark for scheduled turns, and the re-projection a person's turn triggers on a scheduled-kind batch. A scheduled turn never runs them. Past the cap (64 files, 64 hooks) the extra hooks do not run and do not affect auto-approval; one warning and one audit row per folder and file-name list say so.
  • The notice: the old "hook files do not run" row is no longer written on KAS. The existing Turn on / Turn off row lists the files too. Its middle sentence drops the two words agent file, so {path} reads as the agent file, .kiro/hooks, or both. The sentence says give when it names both sources. A chat shows the row once per folder, state and command list, so a reconnect stays quiet.
  • Docs: agent-host-contract.md, steering-and-hooks.md and feature-map/README.md.

Security

Project hook files follow the same trust as a project agent file's hooks (#33578, owner decision C of 2026-11-09): Crew's Turn on, or kiro-cli's trust of the folder, as kiro-cli itself runs them.

Known limit, the same accepted trade-off now also covering hook files: a sandboxed agent can write kiro-cli's trust record under ~/.kiro/workspace-roots; the owner's mcp.protect_kiro_permission_rules setting keeps the agent's file-edit tools from writing that directory.

Crew's record project_hooks_consent.json stays read-only inside the sandbox, and its writer is the owner-gated consent handler. The handler is unchanged (builder-security checked).

Who reads the hook files

One read, one record: _scan_hook_files lists .kiro/hooks once and records there whether the listing and every file within the cap read completely. consented_project_hook_files is the one place that turns an incomplete scan into a decision: under a yes (on, an on gone stale, or kiro-cli trust) it raises HookFilesUnreadable. Every reader goes through project_hook_files_for_gating and lets it through; test_gating_modules_read_project_hook_files_only_through_the_strict_entry_point pins that.

Caller What the raise does
acp/kas_agents.py pre_tool_hook_matchers (projection, sub-agent targets, hook_projection_stale) withholds every auto-approval
agent_sdk/kas_project_hooks.py person_turn_reprojects re-projects
agent_sdk/project_hook_files.py project_files_pre_tool (the mark at acp/harness/kas.py) marks the batch
agent_sdk/spec_hooks.py turn_spec_hooks and dashboard/chat_turn/turn_spec_hooks.py (the hooks a turn fires) refuses the turn's permission requests, as for an unreadable agent spec
agent_sdk/project_hook_files.py listed_project_hook_files (notice row) not reached: the notice lists what it can read

When a turned-on folder has a hook file Kiro Crew cannot read, the folder is blocked: its tool calls are refused, and the row names the first file that did not read and the operating system's own reason for it (Kiro Crew can't read .kiro/hooks/guard.json: Permission denied. Tool calls here are blocked until it can. kiro-cli is not affected.). The refusal a tool call gets names the same file and reason (the project's .kiro/hooks/guard.json could not be read: Permission denied); the path is relative to the folder, so nothing outside it is named. The way forward is to fix the file. Once it reads again, the next message runs with the hooks and no click is needed: each turn reads the files again, and a blocked card asks the gateway every 15 seconds while the tab is visible, and when the tab regains focus, so it changes to the running text by itself. Turn off stays as a control for someone who does not want to fix the file now. The row stays the same card and switches to the blocked tone in place; its Ask the agent hand-off sends the row text and the project folder's path, so the agent can say which file to fix and how. A Turn on from an incomplete scan lands in the blocked state instead of failing. A missing .kiro/hooks is complete and empty; off or no choice never gates.

Backwards compatibility

Compatible: a folder without .kiro/hooks files keeps its fingerprint and its choice. A folder with them that was turned on for its agent file's hooks asks again, because the new Turn on covers more commands.

Reader: src/kiro_crew/dashboard/chat_turn/turn_spec_hooks.py:_surface_withheld_project_hook_files -- chat -- removed with the row it wrote; the folder hooks row replaces it (test_the_row_for_hook_files_only)
Reader: src/kiro_crew/agent_sdk/spec_hooks.py:project_hook_file_names -- chat -- its one caller was that row; the consent scan lists the files now (test_nothing_runs_until_the_folder_is_turned_on)
Reader: src/kiro_crew/dashboard/chat_turn/tool_approval.py:_project_hook_files_notice -- chat -- its one caller was that row
Reader: website/src/pages/chat/SpecHooksNotice.tsx:ProjectHookFilesNotice -- chat -- rows already in a chat's history still render with their Dismiss link (SpecHooksNotice.test.tsx)

Tests

  • test/test_kas_project_hook_files.py: nothing runs before Turn on; a turned-on hook fires; an edit, an add or a rename turns them off until a new Turn on; an old fingerprint-less on does not adopt them; a folder without them keeps its fingerprint; a workspaceTrusted: true kiro-cli record starts the hook files, and with an agent file starts both in one row; a Crew Turn off beats it; a symlinked file and a .kiro/hooks leading outside are never loaded; the consent record is a read-only sandbox leaf; a file PreToolUse hook withholds auto-approval only when on; the turn seam folds them in and a scheduled turn does not; AI-DLC's five files keep three hooks; the row texts, one row for both sources with give.
  • test/test_kas_user_hook_files.py: the two tests that pinned "not loaded, notice shown" now pin that the user loader never reads project files and no such notice is written.
  • test/test_kas_project_hook_files.py also: a link inside the checkout is not loaded; a checkout at HOME lists none; an unreadable file withholds every auto-approval under either source; hooks past the cap are reported once (its warn-once set has a per-test reset); the row shows once per chat until its state or commands change.
  • Mutation runs: dropping the files from the scan, the checkout bound on the read, or the old-on rule each turns tests red.

Proof: not provable -- other: the new test module imports a module this PR adds, so reverting the production hunks fails at collection; the mutation runs above stand in for it

Manual verification

AI-DLC's five kiro-ide hook files from awslabs/aidlc-workflows (harness/kiro-ide/hooks, {{INVOKE}} set to aidlc) were placed in a scratch checkout with scratch homes. Before Turn on no hook was loaded. After Turn on, SessionStart (AgentSpawn), UserPromptSubmit and Stop were loaded and the two regex-matcher hooks were dropped. After an edit none were loaded.

Not run: a live KAS chat end to end, which needs a Kiro sign-in.

Real-machine verification

Machine: own computer, Amazon Linux 2023 (kernel 6.12), x86_64, 32 vCPU
Before (main c07d4da): probe of spec_hooks with the five AI-DLC files in <checkout>/.kiro/hooks -> project_hook_file_names lists 5, hooks_enabled is (False, ''), no loader returns a project file, and the row state is '' (no Turn on)
After (head 30328fa45533): the same files -> nothing loaded before Turn on; after set_choice(..., True) the three hooks above are loaded; after an edit nothing is loaded
Cleanup: own computer; scratch homes and checkout under the session scratch directory

Screenshots / video

The real ProjectHooksNotice at phone width (390 px), dark and light, rendered from website/capture/project-hook-files-notice.tsx with the gateway's own text. Top three: a folder with only .kiro/hooks files, off, on, and started by kiro-cli's trust. Bottom three: a folder with an agent file and .kiro/hooks files, in the same three states, one row each.

Folder hooks rows, dark

The blocked state, phone and desktop. A blocked row is the same card in the blocked tone, with Turn off and Ask the agent:

Blocked rows, phone, dark

Blocked rows: phone light, desktop dark and light

Blocked rows, phone, light
Blocked rows, desktop, dark
Blocked rows, desktop, light

Turn on lands blocked, then the file reads again and the 15-second recheck clears the block with no click. The card stays mounted the whole time; only its tone and text change (dark, then light):

flip-dark.mp4
flip-light.mp4
Light

Folder hooks rows, light

Related Issues

Part of #26568. Regex matchers: #46900.

Sibling sweep

Swept: git grep -nE "user_hook_files()|merge_user_hook_files(|pre_tool_hook_matchers(" -- src/
Sibling: src/kiro_crew/agent_sdk/spec_hooks.py -- changed here
Sibling: src/kiro_crew/dashboard/chat_turn/turn_spec_hooks.py -- changed here
Sibling: src/kiro_crew/acp/kas_agents.py -- changed here
Sibling: src/kiro_crew/messaging/tool_hooks.py -- not affected -- channel turns reach the files through spec_hooks.turn_spec_hooks

Pattern harvest

Not generalizable: a missing loader for one file location, not a repeatable coding mistake.

Checklist

  • A Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...); PR Hygiene does not count commits
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 7ad2a8530917d7d44c13df2a5ac52e4ac983134c — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the hook files reuse the existing per-folder consent record and the existing hook-merge path. A file that cannot be read fails closed at every caller, and the four removed readers are all listed.

Notes

  • Folders already turned on that also have .kiro/hooks files will ask for Turn on again after upgrade, because the consent fingerprint now covers those files. The description accepts this. It is still a one-time visible prompt for existing users, so mention it in the release notes.

[DESIGN-REVIEWED] 7ad2a85

Description read

[DESCRIPTION-READ] 99a49d39f8dbb05838089a1299e01f3d0164eb012072a3d43cdf03dc0e7e56a9

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 7ad2a8530917d7d44c13df2a5ac52e4ac983134c — 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 does not.

First-Principles-Verdict: PASS

One dead constant is the only thing to remove. A maintainer decision already on the base (2026-12-04-a-folders-kiro-hooks-files-run-on-kas-after-turn-on.md) records the shape this change ships.

Notes

  • Item 9 — zero consumers: _PROJECT_HOOK_FILES_UNREADABLE_BLOCK in dashboard/chat_turn/tool_approval.py:158 is defined and never read. Grepping the whole repo for the name finds 1 hit, the definition. Its text duplicates tool_permission.PROJECT_HOOK_FILES_UNREADABLE. Subtraction: delete the constant. _project_hook_files_unreadable_block already builds the block from project_hook_files_unreadable.

What this change ships

Inventory (9 items) — 8 justified

Intent: let a project's own .kiro/hooks/*.json files (AI-DLC's hooks) run in a dashboard KAS chat once the folder is turned on. This is a FIX.

  1. A folder's .kiro/hooks files run on KAS after Turn on, or when kiro-cli already trusts the folder — justified
  2. Editing, adding or renaming a hook file asks for Turn on again — justified
  3. A Turn on saved before hook files were counted asks again in folders that have them — justified
  4. The old "hook files do not run" notice is no longer written; the Turn on / Turn off row lists the files instead — justified
  5. When a hook file can't be read in a turned-on folder, the folder's tool calls are refused and the row names the file and the reason — justified
  6. A blocked card checks again every 15 seconds and on focus, and clears itself once the file reads — justified
  7. The blocked row gets an Ask the agent hand-off — justified
  8. A warning and an audit row when the file or hook cap cuts hooks; the cap reporting is now shared with ~/.kiro/hooks — justified
  9. An unused constant, _PROJECT_HOOK_FILES_UNREADABLE_BLOCK — zero consumers

[FIRST-PRINCIPLES-REVIEWED] 7ad2a85

Description read

[DESCRIPTION-READ] effe5bdcf718752c840d5cc15cb2ba6b4e2891a80fa8930acd618bd1ea5123b3

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — 🔴 BLOCK

UX-level review of 7ad2a8530917d7d44c13df2a5ac52e4ac983134c — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: BLOCK

The blind reader understood Turn on, the one control this PR's goal depends on, and still would not press it. The row's copy hands them a safety check they can't do and never says when Turn on is the right choice.

Blockers

Turn on copy gives a newcomer no reason to trust the folder
Trigger: someone opens a KAS chat in an AI-DLC checkout and sees the off row.
Outcome: the row reads "This repo's .kiro/hooks gives agent aidlc checks that run as commands on this computer… Open Show commands to read them first." The reader knew what the button does but would not use it: "no. The box itself tells me to read the commands first, and I couldn't judge whether they're safe even after reading them." They also said they don't know what "hooks", "repo", "aidlc" or "tool calls" are. So AI-DLC stays stalled at the first /aidlc, which is the failure this PR sets out to fix. Severity: every AI-DLC adopter × blocks the task × every new folder.
Fix: lead with the outcome and the trust test, for example "This project's files add 5 commands that run on this computer during this chat. Turn on if you trust where this folder came from." Keep Show commands as optional detail rather than a required step, and fix the "gives agent aidlc checks" wording.

Notes

  • Blocked row: the reader would not risk "Turn off" because "nothing says what I give up". Add the consequence, for example "Turn off runs this chat without the folder's hooks."
  • The blocked row's Turn off renders as an outlined button, but the other rows show it as underlined text. The reader couldn't tell they do the same thing, so use one style for both.
  • The reader wasn't sure "Show commands" belongs to the box above it, because it sits outside and below that box. Move it inside the box's action row.

[UX-REVIEWED] 7ad2a85

Description read

[DESCRIPTION-READ] 03a3e3e03f9b4be93fd4385b20efe30b4ca826b7a9927bdc0639b6cfce254961

That sha256 names everything this verdict read: the PR description, plus the 9 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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — 🔴 changes requested (blocking)

GPT 6.1 found at least one blocking issue that must be resolved before merging 7ad2a8530917d7d44c13df2a5ac52e4ac983134c. Adjudication upheld 1 of 1 blocking finding(s); those must be resolved before merging.

This comment is updated in place on each push.

BLOCKING -- website/src/pages/chat/ProjectHooksNotice.tsx:155 -- Render blocked hook-read failures through ErrorNotice

<NoticeCard tone={showBlocked ? 'blocked' : undefined}
Trigger: A turned-on folder's hook file becomes unreadable. Reopening an existing notice makes readBack() receive blocked: true, switching the existing card to blockedText.
Outcome: The failed read bypasses the required shared error surface. NoticeCard has no alert or live-region semantics, so this local update does not announce that tool calls are now blocked.
Anchor: errors-use-error-notice
Fix: Render the blocked state through ErrorNotice, preserving the folder report, hand-off decision, and Turn off action.
Sites: none

[BLOCK-MERGE] 7ad2a85
[GPT-REVIEWED] 7ad2a85

Adjudication (Opus 5.5) — is blocking on each finding proportionate?

F1: UPHOLD. errors-use-error-notice is marked blocking: true in the base-branch rules (.review-base-rules/website-AUTOSDE.yaml:680-681), and that flag outranks any weighing of harm against fix cost.

The rule applies here. The blocked state comes from a hook file that could not be read, which is a failure, and the rule judges by where a value comes from (website-AUTOSDE.yaml:699-703). At website/src/pages/chat/ProjectHooksNotice.tsx:155-186 that state is shown by a NoticeCard in its blocked tone with a hand-wired AskAgentButton, not through ErrorNotice.

[ADJUDICATION] 7ad2a85 total=1 uphold=1 downgrade=0
UPHOLD F1 website/src/pages/chat/ProjectHooksNotice.tsx:155 reason=autosde-blocking-rule
[GPT-ADJUDICATED] 7ad2a85

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 7ad2a8530917d7d44c13df2a5ac52e4ac983134c false-positive: <reason, 20 to 500 characters>

@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 Dec 4, 2026
@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — 🔴 changes requested (blocking)

Reviewed 7ad2a8530917d7d44c13df2a5ac52e4ac983134c — this comment is updated in place on each push.

Blocks merge: when the project-hooks consent record can't be read, every KAS tool call in a folder with .kiro/hooks/*.json is refused with a reason that blames the hook files, and the card offers a Turn on that can't save.

BLOCKING — src/kiro_crew/project_hooks_consent.py:1729
if listed or not complete: / raise HookFilesUnreadable("the project-hooks consent record could not be read")
Trigger: project_hooks_consent.json is invalid JSON, has an unknown entry, or gives EACCES, so _load raises StoreUnreadable and _crew_choice returns UNREADABLE. The session folder has any .kiro/hooks/*.json file, even one never turned on. The path is _prepare_spec_hooks / turn_spec_hooks → merge_user_hook_files → project_hook_files_for_gating → consented_project_hook_files, which raises with no path → _hook_files_blocked / _hook_files_unreadable → project_hook_files_unreadable("", "").
Outcome: Every PreToolUse is refused with "the project's .kiro/hooks files could not be read", but those files read fine; the consent record is what failed. In the same session kas_project_hooks_state → blocked_hook_path returns None, because _under_a_yes is false for UNREADABLE. So the card shows "off" with Turn on, and _folder_state reports blocked: False. Turn on and Turn off both need to write the unreadable record, so the owner can't recover from the UI, and the message sends them to the wrong file.
Anchor: defect
Fix: Give HookFilesUnreadable a reason that names the consent record, for example a distinct path/reason that project_hook_files_unreadable and _project_hooks_blocked_text render as "the project-hooks consent record could not be read". Make blocked_hook_path and kas_project_hooks_state report blocked under UNREADABLE when the folder lists hook files, so the card matches the refusal.

Notes:

  • cli_chat_spec_hooks.print_session_notices still says "The hooks of agent X could not be read" when the failing file is a .kiro/hooks file. It does not use spec.unreadable_reason.
  • _hook_files_blocked returns before the other is_new notices (lost keys, confirm hooks, no tools), so a session whose first turn is blocked never shows them.

[BLOCK-MERGE] 7ad2a85
[OPUS-REVIEWED] 7ad2a85

Verdict parsed from the review's SHA-scoped output markers for commit 7ad2a8530917d7d44c13df2a5ac52e4ac983134c.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 7ad2a8530917d7d44c13df2a5ac52e4ac983134c false-positive: <reason, 20 to 500 characters>

@buluoray
buluoray force-pushed the crew/slack/project-hook-files-26568 branch from d74ae10 to bb8e7a7 Compare December 4, 2026 01:44
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Dec 4, 2026
@buluoray

buluoray commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

On the UX review of d74ae10: hook files now follow the same trust as a project agent file's hooks, so a folder that kiro-cli trusts runs its .kiro/hooks files too, and Crew's Turn on is the other source. A folder shows one row in the existing three states (off, on, started by kiro-cli's trust), naming the agent file, .kiro/hooks or both. The two-card case and the "off while trusted" case no longer occur. Shots in the description are of head bb8e7a7. The Show commands placement is unchanged from the existing row.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Dec 4, 2026
@buluoray

buluoray commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

Scope note: the maintainer-side ruling changed from Turn-on-only to the same trust as project agent-file hooks (kiro-cli parity). The "Not a goal" bullet "Letting kiro-cli's folder trust start these files" no longer matched the diff, so it was removed; the Goal line is unchanged. The PR stays a draft until the maintainer confirms the row and the decision entry.

@buluoray
buluoray force-pushed the crew/slack/project-hook-files-26568 branch from bb8e7a7 to 3a03ddc Compare December 4, 2026 02:02
@buluoray

buluoray commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author
  • span=e5a9b062632b

fixed in 3a03ddc: the outside-directory test stages its link with make_dir_link and runs on Windows; the two file-link tests keep their skip because no unprivileged file link exists there.

@buluoray

buluoray commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author
  • span=4557d7725b80

fixed in 3a03ddc: the row's once-per-chat mark also keys on the folder's Crew choice, so a Turn on that goes stale shows the off row again; test_the_row_shows_once_per_chat_until_something_changes covers a rename after Turn on.

@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 Dec 4, 2026
@buluoray
buluoray force-pushed the crew/slack/project-hook-files-26568 branch from 3a03ddc to 2d355de Compare December 4, 2026 03:31
@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 Dec 4, 2026
@buluoray
buluoray force-pushed the crew/slack/project-hook-files-26568 branch 2 times, most recently from d8212fb to d20e35d Compare December 4, 2026 05:12
@buluoray

buluoray commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author
  • span=f00c6d102471

fixed in d20e35d: every row carries project_hooks_blocked_text (the first unreadable file, else .kiro/hooks), so a read-back that says blocked always has its sentence; the blocked card renders through ErrorNotice with askAgent and keeps Turn off in its actions. Tests: test_a_readable_row_still_carries_the_blocked_text, and the vitest case 'renders a blocked row as an error with Turn off and the agent hand-off'.

@buluoray

buluoray commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author
  • span=b7a4bf1b32aa

fixed in d20e35d: consented_project_hooks raises HookFilesUnreadable under a yes when the scan is incomplete, and both spec reads (turn_spec_hooks and the chat turn's _prepare_spec_hooks) route it to the same blocked path as the merge seam: the refusal names the .kiro/hooks files and the row with Turn off shows. Tests: test_a_folder_agent_in_a_blocked_folder_gets_the_files_refusal, test_a_dashboard_folder_agent_in_a_blocked_folder_shows_the_row; each guard was mutated and turned a test red.

@buluoray
buluoray force-pushed the crew/slack/project-hook-files-26568 branch from d20e35d to c2dc292 Compare December 4, 2026 05:32
@buluoray

buluoray commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author
  • Recovered hook files still display the blocked state (span=f00c6d102471)

fixed in c2dc292: a blocked row also carries project_hooks_on_text (the Crew-on or kiro-cli row text), and the card shows it when the gateway reads the folder on and not blocked. Every (row state, current state) pair now has its own text: off, on and kiro_cli rows as before; a blocked row shows the off text after Turn off, the on text once it reads again, the blocked text while blocked. Test: 'says the hooks run once a blocked row reads again' (a mutation of the branch turns it red).

@buluoray
buluoray force-pushed the crew/slack/project-hook-files-26568 branch from c2dc292 to 9d85137 Compare December 4, 2026 06:41
@buluoray

buluoray commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author
  • Turn on on the .kiro/hooks row: the reader understood it and still would not use it (span=94065ee0d11c)

rebutted (pre-existing): the off row's sentence "Open Show commands to read them first." and the Show commands list below the card are both on main today (origin/main ff35319: turn_spec_hooks.py:396 writes the sentence; ProjectHooksNotice.tsx:102 renders NoticeCard and :126 renders the details list after it) for the agent-file row from #33578. This PR reuses that row for .kiro/hooks with the words "agent file" dropped, as its goal says; it does not change the sentence, the list or their order. A reader who stops to read the commands before running them on their computer is the caution that row asks for. Moving the list or rewording the row would change the shipped agent-file row too, which is outside this PR's goal.

@buluoray

buluoray commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author
  • Second spelling of the hook-file conversion and cap audit (span=c9a067a3a413)

fixed in e19690a: one module, src/kiro_crew/agent_sdk/hook_file_conversion.py, holds the per-file conversion (convert_hook_file: one conversion per file content, with its per-file cap flag) and the cap report (audit_cap_truncation: once per changed snapshot). spec_hooks.user_hook_files and project_hook_files._converted both call it; _audit_user_file_truncation and project_hook_files._audit_truncation are removed. A file cut at its own cap now sets the same flag in both readers. Test: test_a_file_cut_at_its_own_cap_is_reported_beside_a_smaller_one.

@buluoray

buluoray commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author
  • Primary "Turn on" fails the cold read (span=189b702fdc6f)

rebutted (pre-existing): this is the finding answered for span 94065ee0d11c (#issuecomment-7403826881) and overridden on 9d85137. The off row's "Open Show commands to read them first." and the Show commands list under the card ship on main today (turn_spec_hooks.py:396, ProjectHooksNotice.tsx:102/:126) for the agent-file row; this PR reuses that row for .kiro/hooks and changes neither. The sentence or the placement is fixed in a follow-up: #47096.

@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 Dec 4, 2026
@buluoray
buluoray enabled auto-merge (squash) December 4, 2026 09:43
@bolichen97

Copy link
Copy Markdown
Contributor

Started on e19690a. The trust model reads right. The files ride the existing per-folder Turn on (#33578), the fingerprint covers every hook file so an edit asks again, links and out-of-checkout paths are never read, spec_origin="project_file" gets the full deny list, and scheduled turns never run them. Withholding all auto-approval when a consented file cannot be read is the right fail-closed choice.

Before I approve, one ask on evidence. Per real-machine-verify (Reviewing), this diff changes what runs: project hook files now execute in a KAS chat. The real-machine section probes the loader (spec_hooks, set_choice), but it does not show a hook running in a chat. Could you run the reported case end to end once?

  • main: a dashboard KAS chat in a checkout with the five AI-DLC .kiro/hooks files. Send /aidlc and show that no hook fires and the workflow stops at the first gate.
  • this head: the same checkout. First show that nothing runs before Turn on. Press Turn on and show the hooks firing (a hook's output or its audit row). Then edit one file and show that the row asks again.

Please also name the head you ran. The section says 30328fa45533 and the PR is at e19690a.

AI-assisted, sent by Bolin Review bot

@buluoray

buluoray commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Head: e19690a51e3264586505258d69c50f66d7030c9f (the 30328fa45533 in the Real-machine section is an older head; that section is a loader probe, not a chat).

The live KAS chat you ask for (main, then this head: nothing before Turn on, hooks firing after it, an edit asking again) needs a signed-in kiro-cli, and that sign-in needs a browser the maintainer does not have before 12-07. That run comes on 12-07 on this head, or on whichever head is live then.

What is shown on this head today, without the engine:

  • CI on e19690a51e32: every check green, including the backend shards on Linux and Windows, and test/test_kas_project_hook_files.py (turn spec hooks, the chat turn's spec read, re-projection, the row and the refusal).
  • A scripted probe on e19690a51e32 with a scratch home and the five AI-DLC kiro-ide hook files copied into a checkout's .kiro/hooks. It reads them the way a KAS turn does (project_hook_files_for_gating, kas_project_hooks_state):
[1 before Turn on] row=off | 0 hooks run
[2 after Turn on] row=on | 3 hooks run
      Stop | aidlc engine adapter kiro-ide continue-workflow
      UserPromptSubmit | aidlc engine adapter kiro-ide person-message
      AgentSpawn | aidlc engine adapter kiro-ide session-start
[3 after an edit] row=off | 0 hooks run
[4 file unreadable] row=blocked reason='Permission denied' | refused: the project's .kiro/hooks/aidlc-guard-tool-call.json could not be read: Permission denied
[5 readable again] row=on | 3 hooks run

Three of the five files run. The other two (aidlc-guard-tool-call, aidlc-log-subagent) use regex matchers, which Kiro Crew skips today; that is #46900, not this PR.

This does not show a hook's output inside a chat, or /aidlc stopping at the first gate on main. The 12-07 run is for that.

@KiroCrewCaptain

KiroCrewCaptain commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver deep review: A person should decide

This follow-up read head b31919e7ef again. The head did not change since the earlier review, so this comment only updates the two earlier items.

Earlier items

  1. The live KAS chat run: still open. PR/description line 79 still says "Not run: a live KAS chat end to end". Line 85 names the older head 30328fa45533. The scripted probe in your reply ran on e19690a51e32 and says it does not show a hook's output inside a chat. Your last comment says this item is still open, and @⁠bolichen97 has not written that the probe is enough. No code change is needed. Do one of these:

    • Run the case in a signed-in dashboard KAS chat and post it in the Real-machine section, with the head named. On main: send /aidlc and show that no hook fires. On this head: show that nothing runs before Turn on, show a hook's output or its audit row after Turn on, then edit one file and show that the row asks again.
    • Or @⁠bolichen97 writes here that the scripted probe is enough.

    The run matters because dashboard/chat_turn/turn_spec_hooks.py:332 (merge_user_hook_files with kas_hook_checkout(client)) is the path the Goal names. In test/test_kas_project_hook_files.py, the only test that calls _prepare_spec_hooks covers the blocked case.

  2. The retired decision: resolved. The superseding entry is on main in docs/decisions/2026-12-04-a-folders-kiro-hooks-files-run-on-kas-after-turn-on.md, with its Supersedes: line and its row in docs/decisions/README.md. It merged as docs: record that a folder's .kiro/hooks files run on kas after turn on #47306.

What else holds the approval

The change is 2595 lines. That is more than this deep review approves, so a maintainer gives the final approval after item 1 is answered.

Review result on this head

The review found no code error. All five AI review comments name this head and none blocks. The check runs I saw are complete and none failed. The fail-closed choice is done well: a turned-on folder with a hook file that cannot be read refuses tool calls, and tests pin both sides of the choice (nothing before Turn on, a new question after an edit, Turn off wins over kiro-cli trust).

Optional

  • agent_sdk/kas_project_hooks.py:108: after a blocked file becomes readable, the same card offers Turn on again with the old command list. That list omits the hooks of the file that was unreadable. Show "the hooks changed, the next message asks again" on that card, or return the current list from the GET. This note goes away if Project hooks Turn on approves the folder's hooks at click time, not the commands the row showed #46912 lands first.
  • project_hooks_consent.py:405: kiro-cli folder trust also starts the files, with no click and no fingerprint. The decision on main covers it. Add that second source to the title and the Goal line so the merge record matches what ships.
  • Add two lines under "Backwards compatibility": a folder that kiro-cli trusts starts to run its hook files with no click, and a folder under a yes with an unreadable hook file has its tool calls refused until the file reads or the owner presses Turn off.

Tier: 2, held for a person: changes requested by the deep review.

A deep review by the code change approver, not by a person · commit b31919e7ef · 2595 changed lines. If it is wrong, reply here: replies are how the approver is evaluated.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Dec 4, 2026
@buluoray
buluoray force-pushed the crew/slack/project-hook-files-26568 branch from e19690a to b31919e Compare December 4, 2026 13:31
@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: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Dec 4, 2026

@KiroCrewCaptain KiroCrewCaptain 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.

Changes requested by the code change approver's deep review, not by a person.

Two items block this head (b31919e). The code paths I traced match the description, and the fail-closed block for an unreadable hook file is a careful touch. All five review lanes pass on this head.

  1. The live KAS chat run a maintainer asked for is missing. PR/description line 79 says "Not run: a live KAS chat end to end", and line 85 says "After (head 30328fa45533)", which is a loader probe on an older head. @⁠bolichen97 asked for this run before approving, and the scripted probe in your reply "does not show a hook's output inside a chat". No code change is needed. Please post, in the Real-machine section of the description, a signed-in dashboard KAS chat run that shows:

    • on main: the five AI-DLC hook files in .kiro/hooks, send /aidlc, no hook fires;
    • on b31919e (or the head that is live then, named): nothing runs before Turn on, a hook's output or audit row appears after Turn on, and the row asks again after an edit to a hook file.

    Then update the "After (head ...)" line. This item also clears if @⁠bolichen97 writes in the thread that the scripted probe is enough.

  2. The change retires a recorded decision with no superseding entry. dashboard/chat_turn/turn_spec_hooks.py:382 and :484 now write only the Turn on / Turn off row. _surface_withheld_project_hook_files and _project_hook_files_notice are gone, so a new KAS chat in a folder with hook files no longer gets the "do not run in this session" notice or its per-folder Dismiss. docs/decisions/2026-11-22-the-project-hook-files-notice-is-dismissed-per-folder.md still records that notice as the ruling, and the diff has no file under docs/decisions/. The blocking rule recorded-decisions-are-not-regressions treats this as a regression. Smallest fix: add one docs/decisions entry with a Supersedes: line that names the 2026-11-22 file, says what replaces the notice, and cites the maintainer's statement, plus its README index row. Do you want it in this PR or in its own PR that lands first?

This change is 2595 lines, which is more than this review approves. A maintainer gives the final approval once the two items are settled.

Optional:

  • dashboard/chat_turn/turn_spec_hooks.py:334-337: no dashboard test covers a user-level agent in a blocked folder. If the except HookFilesUnreadable branch is removed, the catch-all below it lets the turn run and no test fails. A test like test/test_kas_project_hook_files.py:936 with a user-level agent would pin it.
  • test/test_kas_project_hook_files.py:227 and :382 skip on Windows. The harness helpers make_escaping_link and plant_day_link can plant the link there, so the two tests could run on every platform.
  • project_hooks_consent.py:405-411: Kiro CLI folder trust also starts the hook files with no click in Crew and no fingerprint. The title and Goal name only Turn on. Consider naming that path in the Goal, and recording it in the new decision entry.

This block is withdrawn automatically when a new commit fixes these items or a reply shows one is wrong: the approver reviews it again. Any maintainer can dismiss this review at any time.

Tier: 2, held for a person: 36 files, more than 20.

Commit b31919e7ef · 2595 changed lines.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision labels Dec 4, 2026
buluoray added a commit that referenced this pull request Dec 4, 2026
…on (#47306)

Records Ray Xu's 2026-12-04 decision (#26568) that supersedes in part
the 2026-11-22 project hook files notice entry: on KAS a folder's own
.kiro/hooks/*.json files run under a project agent file's trust, the
"do not run in this session" notice is no longer written, and a
turned-on folder with an unreadable file names the file and the reason.
The change itself is #46918.
@buluoray

buluoray commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor Author

The code change approver's item 2 (a recorded decision retired with no superseding entry) is cleared: #47306 merged into main (63b9e091467f) with docs/decisions/2026-12-04-a-folders-kiro-hooks-files-run-on-kas-after-turn-on.md. It supersedes in part 2026-11-22-the-project-hook-files-notice-is-dismissed-per-folder.md, names what replaces the notice, and cites the maintainer's decision on #26568 (#issuecomment-7404940479, wording in #issuecomment-7407580488). No change to this PR's diff was needed.

Item 1 (the live KAS chat run) is still open.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Dec 5, 2026
@buluoray
buluoray force-pushed the crew/slack/project-hook-files-26568 branch from b31919e to 5d07665 Compare December 5, 2026 20:07
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention labels Dec 5, 2026
@buluoray
buluoray force-pushed the crew/slack/project-hook-files-26568 branch from 5d07665 to 8b6a82e Compare December 5, 2026 20:37
@buluoray
buluoray force-pushed the crew/slack/project-hook-files-26568 branch from 8b6a82e to 7ad2a85 Compare December 5, 2026 21:14

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

readiness: checking Automated validation is still running

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants