Skip to content

feat(kiro): run user hooks in Chat - #46030

Merged
AmoabaKelvin merged 2 commits into
stablyai:mainfrom
LDH1103:feat/kiro-chat-user-hooks
Nov 21, 2026
Merged

AmoabaKelvin merged 2 commits into
stablyai:mainfrom
LDH1103:feat/kiro-chat-user-hooks

Conversation

@LDH1103

@LDH1103 LDH1103 commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Kiro lets people add hooks: small scripts that run when a chat starts, before a tool runs, and so on. They ran in Kiro's terminal UI but not in Orca's Kiro chats. Now they run in both.

Files Added Deleted Net
Test 0 0 0 0
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​4 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2

What Changed

Before: Kiro chats ignored the user's hooks in KIRO_HOME/hooks (default ~/.kiro/hooks). A PreToolUse hook that blocks a command or asks first did nothing in Chat, though it worked in a Kiro terminal tab.

After:

  • Hooks run in Chat: every Kiro chat loads the hooks in KIRO_HOME/hooks, as Kiro's TUI does.
  • Block: a PreToolUse hook that exits 2 stops the tool. The chat shows the tool row as failed, and the model gets the hook's reason.
  • Ask: a PreToolUse hook that answers ask arrives as an ordinary permission request, titled with the hook's reason. Full access approves it like any other request Kiro sends. Ask mode gets the existing Allow/Deny card.

Mechanism: Kiro V3 over ACP builds its hook runtime only when the client sends clientCapabilities._meta.kiro.hooks at initialize. KIRO_ACP_DIALECT in src/main/acp/acp-dialects/kiro-dialect.ts now sets { enabled: true, v2: true } there, the value Kiro's TUI sends. acp-session-runtime.ts already spreads a dialect's clientCapabilities into initialize, as it does for Cursor's _meta. The launch spec comment that said V3 runs no user hooks in Chat is updated.

Why

A hook is usually a guard, so skipping it in Chat is the surprising part: the same command that a hook blocks in the terminal ran in a chat. One capability flag fixes it with no new code path. Kiro loads, runs and reports the hooks itself, over ACP messages Orca already renders.

Considered and not done: claiming hook-ask requests so they always show a card, even in Full access. Full access already approves every permission request Kiro sends, and a hook ask is the same request.

Linked Issue

Fixes #46029

Visual Proof

Before: nothing to see. The hooks didn't run, so the blocked command ran too.

After, in a hidden Windows dev build with a test hooks file (the UI is in Korean). The hook blocked echo BLOCKPROBE2, so its row shows as failed ("1 실패"). For echo ASKPROBE2 the hook asked ("orca e2e hook asks"), Full access approved, and the command ran ("0 종료"):

Kiro chat with a blocked and an asked tool call

Testing

Windows 11, kiro-cli 3.1.0, a real Kiro account, dev build with ORCA_BACKGROUND_LAUNCH=1, driven over CDP. A temp KIRO_HOME held one hooks file with SessionStart, UserPromptSubmit, PreToolUse (matcher: '*') and Stop hooks. Each ran a .cmd that logs its trigger, and flag files made PreToolUse block (exit 2) or ask.

  • Raw ACP: without the opt-in, none of the hooks ran. With it, all four ran. A block sent a failed tool_call_update with no permission request. An ask sent a pending tool_call and then session/request_permission with Allow/Deny.

  • Dev build, Full access: the hooks logged all four triggers. The blocked command shows as a failed row and the model replied with the hook's reason. The asked command was approved and ran.

  • Maintainer check, macOS, kiro-cli 3.5.0 over raw ACP (throwaway HOME and KIRO_HOME, no account): with the opt-in, Kiro sends _kiro/hooks/didChange listing the hooks file and session.new.timing gains a hooks phase. Without it, neither happens. Turns need a real account, so block and ask were not re-run on 3.5.0.

  • Not run: Ask mode's card for a hook ask, kiro-cli 3.5.0, macOS, Linux, SSH and the phone app.

  • Automated: none added. The change is one capability object, and spreading it into initialize is existing code. pnpm check:changed --base=upstream/main passed (26 checks).

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

Risk

  • Riskiest part: hooks people already have now also run in chats. A slow hook slows chat turns, and a blocking hook blocks chat tools, the same as in Kiro's TUI.
  • Orca's own status hook (orca-agent-status.json, installed for terminal status) is in the same folder, so it also runs in chats now. Chat sessions start without the pane hook env, so it has nothing to report there (read from the code).
  • Other agents are untouched.

Back out with a plain revert.

Level: Low

AI Disclosure

Written with Claude Code (Claude Opus 5.5).

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

  • Security: Kiro runs only hooks the user put in their own KIRO_HOME, as its TUI does.
  • Cross-platform: no platform code. Kiro runs the hook commands itself.
  • Remote: a remote kiro-cli loads the remote host's KIRO_HOME/hooks.
  • Mobile: no change. The phone renders the host's chat.
  • Performance: no new work in Orca: the object is spread once per initialize. Kiro's hook load adds 4-6 ms to session/new (3 runs, kiro-cli 3.5.0). Orca's own status hook, which now also runs in chats, exits early because chat sessions strip ORCA_PANE_KEY and the hook env (STRUCTURED_CHILD_ENV_TO_DELETE): median 15.2 ms, p90 23.4 ms per trigger over 30 runs, exit 0, no output, nothing posted. That is about 2 runs per turn plus 2 per tool call, the same as in a Kiro terminal.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Kiro ACP dialect now declares hooks enabled with version 2. The V3 launch-spec comment now says that settings, sessions, and hooks are read from KIRO_HOME.

Severity of issue fixed: Medium

Merge Risk: Low · up to f9618

Kiro chats now run hooks from KIRO_HOME/hooks, including Orca's own status hook if it is installed. Users with hooks may see slower chat turns or blocked tools. Users without hooks should see no change. The change is small and easy to revert, but the latency impact is unmeasured.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(kiro): run user hooks in Chat" matches the main change: the PR makes Kiro user hooks from KIRO_HOME/hooks run in Orca's Kiro chats by sending the hooks client capability during ACP ini…
Linked Issues check Passed [#46029] requires Orca's Kiro ACP client to send clientCapabilities._meta.kiro.hooks = { enabled: true, v2: true } at initialize. The reviewed head matches this. The diff against the merge base ad…
Out of Scope Changes check Passed The whole-PR changes are limited to the capability declaration in kiro-dialect.ts and a comment update in src/main/kiro/kiro-acp-launch-spec.ts (+1/-1). The comment now states that V3 reads hooks …
Description check Passed The description is thorough and follows the repository template. It covers the ELI5 summary, what changed (before and after), the mechanism, and the reasoning for not claiming hook-ask requests in Ful…
Full details: Title check

Explanation

The title "feat(kiro): run user hooks in Chat" matches the main change: the PR makes Kiro user hooks from KIRO_HOME/hooks run in Orca's Kiro chats by sending the hooks client capability during ACP initialization. The title is short, specific, and follows conventional commit style.

Full details: Linked Issues check

Explanation

[#46029] requires Orca's Kiro ACP client to send clientCapabilities._meta.kiro.hooks = { enabled: true, v2: true } at initialize. The reviewed head matches this. The diff against the merge base adds this declaration to KIRO_ACP_DIALECT in src/main/acp/acp-dialects/kiro-dialect.ts (+3/-1). The existing normalizeToolUpdate entry is unchanged. The behavioral criteria (session, prompt and stop hooks run; a PreToolUse exit 2 blocks the tool with the hook reason; an ask answer arrives as an ordinary Allow/Deny permission request) depend on Kiro's hook runtime, which this opt-in enables. The author reports raw-ACP and dev-build results for these behaviors. The forwarding path in acp-session-runtime.ts was not re-read in this assessment. The author states it already spreads dialect clientCapabilities into initialize. No automated test was added. The issue does not request one. Ask-mode card, kiro-cli 3.5.0, macOS, Linux and SSH were not tested. These gaps concern verification, not a missing coding requirement.

Full details: Out of Scope Changes check

Explanation

The whole-PR changes are limited to the capability declaration in kiro-dialect.ts and a comment update in src/main/kiro/kiro-acp-launch-spec.ts (+1/-1). The comment now states that V3 reads hooks from KIRO_HOME, which replaces the outdated statement. Both changes implement #46029. Existing user hooks, including Orca's orca-agent-status.json, now run in Chat. This follows from loading KIRO_HOME/hooks, which the issue requires. The PR does not change hook-ask handling in Full access. No unrelated code change was found.

Full details: Description check

Explanation

The description is thorough and follows the repository template. It covers the ELI5 summary, what changed (before and after), the mechanism, and the reasoning for not claiming hook-ask requests in Full access. It links issue #46029 with 'Fixes #46029'. It includes a visual proof with a before/after explanation and a screenshot. Testing lists the platforms actually run (Windows 11, kiro-cli 3.1.0, plus a macOS raw-ACP check on 3.5.0) and what was not run. The risk section names the riskiest part and gives a revert path. The AI disclosure, agent skill boundary, notes, and checklist are filled in. Minor gap: the template's 'Automated tests added/updated' checkbox is checked while no tests were added, though the description explains why.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c91248c2-7dd6-42bf-a1f3-3507edf58622
Commits

Reviewing files that changed from the base of the PR and between 818a6e4 and f961866.

Files selected for processing: 1

  • src/main/kiro/kiro-acp-launch-spec.ts
Files skipped from review as they are similar to previous changes: 1

  • src/main/kiro/kiro-acp-launch-spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@AmoabaKelvin

Copy link
Copy Markdown
Collaborator

Merged current main into this branch (no code changes) so CI picks up the max-lines fix from #46033, which broke the static analysis job here.

@AmoabaKelvin
AmoabaKelvin merged commit 8ec3588 into stablyai:main Nov 21, 2026
62 checks passed
@AmoabaKelvin

Copy link
Copy Markdown
Collaborator

Thanks @LDH1103, this was exactly the right fix and a really thorough write-up. I confirmed on kiro-cli 3.5.0 that the opt-in is what loads the hooks, then merged it as is. Much appreciated!

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.

[Feature]: Run the user's Kiro hooks in Kiro Chat

2 participants