Repository navigation
feat(kiro): report Kiro agent status and list Kiro sessions in history - #26695
Conversation
Kiro keeps hooks inside each agent config, so Orca installs one managed hook per event into $KIRO_HOME/agents/*.json (locally and on SSH hosts under the remote KIRO_HOME) and normalizes the payloads on /hook/kiro. Pets, sidebar, notifications and mobile now see Kiro working and done. Kiro resume is gated on a new agent-session.kiro-resume.v1 capability.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 7 minutes. View limit detailsLimit details: You’ve used all 10 included reviews currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (52)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe change adds managed Kiro hooks to local and remote agent configurations and routes Kiro hook events into status normalization. It adds Kiro session scanning, session-ID extraction, and resume command support. Kiro resume support is gated by a runtime capability. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to Kiro history resumes use the validated session filename, so mismatched metadata cannot change the resume target. No actionable merge risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
64355089-a6b7-4566-88d8-65a8dda5a801
📒 Files selected for processing (28)
config/tsconfig.cli.jsonsrc/main/agent-hooks/installer-utils-remote.tssrc/main/agent-hooks/managed-agent-hook-registry.tssrc/main/agent-hooks/managed-hook-command-contract.test.tssrc/main/agent-hooks/managed-hook-local-filesystem.tssrc/main/agent-hooks/managed-hook-runtime.test.tssrc/main/agent-hooks/managed-hook-runtime.tssrc/main/agent-hooks/remote-hook-service-registry-coverage.test.tssrc/main/agent-hooks/remote-managed-hook-installers.tssrc/main/agent-hooks/server-retired-pane-new-turn.test.tssrc/main/kiro/hook-service.test.tssrc/main/kiro/hook-service.tssrc/main/kiro/hook-settings.tssrc/renderer/src/runtime/agent-resume-host-authority-capability.test.tssrc/renderer/src/runtime/agent-resume-host-authority-capability.tssrc/shared/agent-hook-listener/provider-dispatch.tssrc/shared/agent-hook-listener/provider-event-routing.tssrc/shared/agent-hook-listener/providers/kiro-events.test.tssrc/shared/agent-hook-listener/providers/kiro-events.tssrc/shared/agent-hook-listener/providers/kiro-tool-fields.tssrc/shared/agent-hook-listener/source-routing.tssrc/shared/agent-hook-relay.tssrc/shared/agent-hook-types.tssrc/shared/agent-resume-argv.tssrc/shared/agent-session-resume-runtime-capabilities.tssrc/shared/agent-session-resume.tssrc/shared/kiro-home.test.tssrc/shared/kiro-home.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Reads $KIRO_HOME/sessions/cli/<id>.json metadata plus the streamed <id>.jsonl transcript locally, under WSL and over SSH, skips subagent child sessions, and resumes with kiro-cli chat --tui --resume-id <id>.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/ai-vault/session-scanner-kiro-parser.ts (1)
102-110: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueValidate that
metadata.session_idmatches the file name.A non-UUID
session_idin the metadata would override the file's basename. The resume command would then use that value. This is unlikely for real Kiro metadata. If the field is wrong, resume fails for that row.Prefer the validated basename as the resume ID. Use
session_idonly as a fallback.
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
033793f6-f994-4eee-80b7-872d8f3d34e6
📒 Files selected for processing (15)
src/main/ai-vault/remote-session-scanner-kiro-source.tssrc/main/ai-vault/remote-session-scanner-sources.tssrc/main/ai-vault/session-scanner-agent-parser.tssrc/main/ai-vault/session-scanner-agent-sources.tssrc/main/ai-vault/session-scanner-every-agent-fixture.tssrc/main/ai-vault/session-scanner-kiro-fixtures.tssrc/main/ai-vault/session-scanner-kiro-parser.test.tssrc/main/ai-vault/session-scanner-kiro-parser.tssrc/main/ai-vault/session-scanner-opencode-sqlite-coexistence.test.tssrc/main/ai-vault/session-scanner-parse-cache.tssrc/main/ai-vault/session-scanner-test-fixtures.tssrc/main/ai-vault/session-scanner-types.tssrc/main/ai-vault/session-scanner.test.tssrc/shared/ai-vault-resume-command.tssrc/shared/ai-vault-types.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
|
Applied the CodeRabbit nitpick on |
|
Maintainer review: I did not accept the original head as-is. Fixed these defects before approval:
Validation on macOS with authenticated Kiro CLI 2.29.0, in a hidden Electron app built from this branch: installed real hooks; submitted a prompt; approved and ran a harmless shell tool; observed real Before the history environment fix, this same custom home showed no Kiro rows: After: real history, successful resume, and completed tool turn: Local checks: 3,531 tests passed (23 skipped), all Compared #24937 and #24938: they implement the opt-in V3 engine and do not replace this default V2 integration. They remain separate work; I am not merging them as part of this issue. |
nwparker
left a comment
There was a problem hiding this comment.
Reviewed the default V2 integration against the existing V3 proposals. Blocking resume, user-config preservation, installation-status, and custom-home history defects have been fixed with regression tests. Authenticated Kiro 2.29.0 was exercised in a hidden macOS Electron app through real hooks, tool execution, history, and successful conversation resume; evidence and remaining validation limits are in the maintainer review comment. Approval applies to 10a6940; merge remains contingent on green CI.
|
Additional live validation: the bundled pet has a fixed animation, so I used a temporary test sprite with distinct working and done rows in an isolated app profile. A real Kiro prompt and shell tool drove both the tab indicator and the pet from working to done. Only the visual test asset was supplied; status was received from the real managed hooks, without injected events. The existing pet renderer emits a React shorthand-style warning when switching sprite rows; the correct rows render. This PR does not change that component. Physical OS notification banners remain unverified, as noted above. |
…d-26695 # Conflicts: # src/shared/ai-vault-resume-command.ts
nwparker
left a comment
There was a problem hiding this comment.
Re-reviewed 385e922 after updating the remaining older-peer test expectations and resolving the new OpenCode 2 resume overlap from main. All 73 focused resume and transport tests pass. Production Kiro behavior is unchanged from the real CLI validation and attached screenshots. Waiting for the final head CI before merge.
|
Final-head update ( Remote scope clarification: the existing SSH session policy skips POSIX managed-hook installation on Windows hosts. This adds Kiro to local native installation and POSIX remote installation; it does not change that Windows SSH policy. Remote history honors the execution host's path, including Windows paths. Actual Windows SSH Kiro status remains outside the live validation described above. |
…gents (#27002) #26695 added Kiro to the history-search agent catalog and updated the unit tests, but the cross-version wire tests still built their expected older-host agent list as 'everything except the agents added later', which now included Kiro. Older hosts never accepted Kiro, and the client correctly withholds it, so those 7 tests failed on main.
…gents #26695 added Kiro to the history-search agent catalog and updated the unit tests, but the cross-version wire tests still built their expected older-host agent list as 'everything except the agents added later', which now included Kiro. Older hosts never accepted Kiro, and the client correctly withholds it, so those 7 tests failed on main. (cherry picked from commit 5eac4a6)
…sessions Takes main's Kiro session history (stablyai#26695) for every file both sides touched: agent registration, search negotiation, resume command, parse cache and the kiro parser. The V3 store is re-applied on top in the next commit.
stablyai#26695 lists the default engine's $KIRO_HOME/sessions/cli store. Sessions from the opt-in V3 engine (--v3) live in a separate store, ~/.kiro/sessions/<workspace-hash>/sess_<uuid>/session.json with a sibling messages.jsonl, so they never showed up in Agent Session History. Add that store as a second root of the same kiro source, locally, under WSL and over SSH, with its own parser. Rows stay agent 'kiro', so search negotiation and resume need no change: kiro-cli --resume-id reopens a sess_ id on the engine it was created with. - The V3 root is the home's .kiro, not KIRO_HOME: kiro-cli 2.27.1 V3 ignores KIRO_HOME and always writes ~/.kiro/sessions. - With KIRO_HOME unset the cli/ root sits inside the V3 root, so the V3 walk skips cli/, UUID and dot directories and only enters sess_<uuid> dirs. - The session id is the validated sess_<uuid> directory name, as stablyai#26695 does with the V2 file name. - A manifest without messages.jsonl lists as a session with no messages.
Takes main's default-engine Kiro integration (stablyai#26695) for every file both sides added: hook registry, remote installers, resume argv and capability, and the /hook/kiro event routing. The V3 standalone hooks are re-applied on top in the next commit.
… file Kiro's opt-in V3 engine (--v3) refuses default-engine agent configs and loads ~/.kiro/hooks/*.json instead, so the hooks stablyai#26695 installs into each agent never fire there. Install one Orca-owned standalone hooks file next to them, locally and over SSH, and normalize V3's PascalCase events on the same /hook/kiro route. - The file always lives under the home's .kiro, not KIRO_HOME: kiro-cli 2.27.1 V3 ignores KIRO_HOME for both hooks and sessions. - It is installed even with no custom agent, since V3 applies it to the built-in default agent too. - A same-named file Orca did not write (other entries, unknown fields, a non-v1 version, unparsable JSON) is left untouched and reported as an error, matching the default-engine installer. - SessionStart is ignored: V3 fires it lazily right before the first prompt.




ELI5
Orca knows what a coding agent is doing because the agent "pings" Orca at key moments: prompt sent, tool running, turn finished. Kiro never pinged Orca, so Orca could launch Kiro but never knew when it was working or done. Orca also builds its session history by reading the files each agent saves, and it never read Kiro's. This PR teaches Orca both.
What Changed
Before:
Other agents behaved normally.
After:
Mechanism:
src/main/kiro/). Kiro has no global hook file; hooks live inside each agent config.agentSpawn,userPromptSubmit,preToolUse,postToolUse,stop) to every agent in$KIRO_HOME/agents/*.json(default~/.kiro). The user's own hooks are left untouched, and uninstall removes only Orca's entries./hook/kiro. Kiro runs hooks through PowerShell on Windows andshelsewhere, so the existing wrappers are reused.KIRO_HOME(read from its login shell, likeGROK_HOME).providers/kiro-events.ts). Kiro's payload has the same fields as Claude's (session_id,prompt,tool_name,tool_input,assistant_response), only with camelCase event names, so it reuses the existing Claude tool-field extraction.session_id, so a restored pane can reopen the same conversation withkiro-cli chat --tui --resume-id <id>, gated on a new host capability (see Notes).session-scanner-kiro-parser.ts).$KIRO_HOME/sessions/cli/<id>.json(metadata) plus<id>.jsonl(transcript). The transcript is streamed, because tool outputs make these files megabytes.parent_session_id) are left out, the same way Claude's subagents are.kiro-cli chat --tui --resume-id <id>.Why
Hooks feed the one status store every other agent already uses (the hook server's). Pets, sidebar, notifications and mobile pick Kiro up with no reader-side changes. History plugs Kiro into the existing session scanner the same way, as one more agent source with its own parser.
Alternatives considered:
kiroand never reflects working or idle, so there is nothing reliable to match.--agent. This would override the user's chosen default agent and drop their tools and permissions.kiro_defaultagent file. We can't reproduce its built-in config faithfully.Known limit: a user who only uses the built-in
kiro_defaultagent has no file to patch. The hook status names the agents directory and points them tokiro-cli agent create.Status and history ship together because together they fix the issue as users report it: Kiro looks invisible in Orca. They touch separate files (hooks vs. session scanner), so each half can be reviewed on its own commit.
Linked Issue
Fixes #26694
Fixes #11743
Related PRs
#24937 and #24938, by @LDH1103, add Kiro status and history for the V3 engine (
kiro-cli chat --tui --v3). They install a standalone hook file in~/.kiro/hooks/and read~/.kiro/sessions/<hash>/sess_*/session.json. This PR covers the V2 engine that Orca launches by default, which #24937 describes as not firing those standalone hooks. Here the hooks go into each agent file in~/.kiro/agents/, and history comes from~/.kiro/sessions/cli/. Both PRs addsrc/main/kiro/hook-service.ts, so they conflict; I offered in #24937 to rebase this one onto theirs as a V2 fallback.Visual Proof
Before → after: the current Orca release (no pet reaction, no notification, no Kiro rows in Agent session history), then this branch with the same prompt.
orca-kiro-pr-26695.mp4
Testing
Maintainer validation and adversarial fixes are documented in this review: 3,531 tests passed, full typecheck and changed-code quality passed, and authenticated Kiro CLI 2.29.0 was exercised in a hidden macOS Electron app through prompt, tool, completion, history listing, and successful history resume. Repairs preserve unsupported user hook configs, detect missing launchers, keep
KIRO_HOMEin history workers, use the remote execution host's history path, and prevent duplicated resume command arguments.The following is the original contributor's Windows validation:
Tested on Windows 11 with
kiro-cli2.28:--tuimode Orca launches. All five events fire. Subagents do not fire the parent's hooks.userPromptSubmit → preToolUse → postToolUse → stoparrived on/hook/kirowith the right token and pane key. Kiro's answer was unchanged, which confirms the hook writes nothing into the model context.kiro-cli chat --tui --resume-id <id>restores the conversation.Automated:
New tests:
src/main/kiro/hook-service.test.ts(local,KIRO_HOME, SSH with detected and default home, uninstall),providers/kiro-events.test.ts,src/shared/kiro-home.test.ts, the remoteKIRO_HOMEprobe inmanaged-hook-runtime.test.ts, andsession-scanner-kiro-parser.test.ts. Kiro is added to the hook registry coverage, resume-capability and every-agent vault fixture tests.Checks:
pnpm tcpasses. The Kiro, hook-registry, hook-listener, resume and Kiro parser tests pass.Pre-existing Windows failures: some
src/main/agent-hookstests (spool,installer-utils,hook-script-outside-orca,local-tmux-managed-pty) and AI Vault scanner/search tests fail on Windows. They fail the same way onmainwithout this change.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Implemented with Claude Code (Claude Opus 5.5), directed and reviewed by me.
Review
AI agent review summary:
.cmdlaunched through Kiro's PowerShell wrapper; macOS/Linux get a POSIXshscript. Paths usepath.joinlocally andpath.posixfor SSH.KIRO_HOME. Hook events reach the host's own hook server, so status stays owned by the execution host..jsonand.jsonlstats..bak; files that don't parse are reported and left alone. Hook stdout stays silent, because Kiro injectsagentSpawn/userPromptSubmitoutput into the model context.Agent skill upstream boundary
Notes
kiroto the resumable agents widensterminal.ensureAgentSession's enum, so Kiro resume is gated on a newagent-session.kiro-resume.v1runtime capability and older hosts fall back instead of failing. An older relay ignores/hook/kiro, and older clients filter out unknown agents, so they drop Kiro rows from a newer host's session list.working(the agent is mid-tool).Author
X: @felipesf360
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)