Repository navigation
fix(kiro): use standalone V3 session-start hooks - #1341
Conversation
|
No findings I’m confident are real in the specified diff. The PR description documents sufficient testing, including a representative built-CLI E2E run covering installation, listing, doctor, removal, reinjection, and user uninstall. Missing live Kiro and additional platform/provider coverage is explicitly disclosed and is not blocking. Review was read-only; I did not run, build, or install PR code. |
@jeff-r2026 This needs your decision. The PR checks "Breaking compatibility change": session-start for Kiro moves from the @nateEc We built this head and its merge-base
CI review: it reported no findings. We disagree because of the kept-agent case above, which it did not run. |
|
Decision: we accept dropping Kiro 2.x session-start support. Moving to the standalone |
7fde26a to
bdb0fa3
Compare
|
Addressed the review follow-up at
The PR description contains the updated verification record. Ready for another review. |
The PR description documents sufficient testing, including a representative built-CLI lifecycle/migration E2E run. Disclosed unavailable platform/provider coverage is not blocking. The earlier pass reported no findings, so none require resolution. Review was read-only; I did not run, build, or install PR code. |
|
Addressed the review follow-up at
The PR description contains the updated verification record. Ready for another review. |
|
No new findings I’m confident are real in the specified diff.
Review was read-only; I did not run, build, or install PR code. |
|
Addressed the review follow-up at
The PR description contains the updated verification record. Ready for another review. |
|
No new findings I’m confident are real in the specified diff.
Review was read-only and limited to the specified diff; I did not run, build, or install PR code. |
911d827 to
144af8a
Compare
|
Addressed the review follow-up at
The PR description contains the updated verification record. Ready for another review. |
|
No new findings I’m confident are real in the specified diff.
Review was read-only and limited to the specified diff; I did not run, build, or install PR code. |
@jeff-r2026 @nateEc Re-checked at 144af8a against the decision above. The code is ready. The only thing blocking is the rebase.
[P1 blocking] It conflicts with
The CI review reports no new findings. We agree there is no code P1, but it did not see the conflict or the |
- Install the Kiro CLI V3 standalone SessionStart hook for every agent, including the default agent, without requiring any team agent. - Integrate the owned artifact into injection, listing, doctor, explicit removal and scope-aware uninstall while preserving personal hook files. - Remove only the legacy managed agentSpawn entry from rendered agents to avoid duplicate dispatch; document the V3 lifecycle requirement in both languages. - Verify 54 adapter/rendering/list tests, a built-CLI pull/list/doctor/remove/inject/uninstall scenario, type checking and lint; live Kiro is unavailable locally. BREAKING CHANGE: Kiro lifecycle hooks now require Kiro CLI V3; upgrade before relying on automatic session-start synchronization.
- 安装 V3 独立 hook 前,从用户及当前项目 agent 中移除精确匹配的旧 TeamAI agentSpawn 命令,保留成员提示词、个人 hooks 和其他字段。 - hooks inject 在写入被拒绝时返回失败,doctor 的检查名称明确标注 Kiro CLI V3 要求,并同步中英文迁移说明。 - 新单测在修复前复现重复入口;53 个相关单测、真实 CLI 生命周期与拒绝写入用例,以及构建、类型检查和 lint 通过。
- 启用用户全局 hook 前扫描已注册项目及关联 worktree,同时通过统一定位接口覆盖配置过的 agent 目录。 - 配置发现保持只读,不触发自愈;仅删除精确匹配的旧 TeamAI 命令,保留其他项目的成员内容和个人 hooks。 - 两项目回归在修复前失败;54 个相关单测和跨项目真实 CLI 生命周期用例通过,构建、类型检查和 lint 通过。
- Ubuntu Node 20 在 session-sync-pull 测试清理临时 Git objects 目录时出现 ENOTEMPTY,其余 15252 项测试通过。 - 本地完整复查该测试文件的 27 项用例全部通过;本提交不修改产品代码,重新触发 CI 验证偶发清理失败。 - GitHub Actions 重跑接口因权限不足拒绝请求,因此通过分支提交触发同一验证流程。
- 将配置注释改为独立 V3 会话启动文件,说明旧 agentSpawn 入口仅用于迁移。 - 406 项定向单测及独立 Kiro hook CLI 场景通过,类型、lint 与构建通过。
144af8a to
17b3bb4
Compare
|
No new findings I’m confident are real in the specified diff.
Review was read-only and limited to the specified diff and trusted base criteria; I did not run, build, or install PR code. |
|
Updated and rebased onto main Verification: 406 focused unit tests passed; types, lint and build passed. Post-build real-CLI Updated head: |
@jeff-r2026 @nateEc Re-checked at 17b3bb4 against the decision above. Everything is in place. The kept-agent duplicate is fixed, and the Kiro e2e with the real CLI passes. The doctor check names the V3 requirement, and It conflicts with Two nits for a later Kiro change: migration matches the legacy command exactly ( |
|
No new findings I’m confident are real in the specified diff.
Review was read-only and limited to the specified diff and trusted base criteria. I did not run, build, or install PR code. |
…ectory legacyAgentDirs read every scope through readConfigFrom, which only loads project partitions, so a user-scope toolPaths.kiro.agents directory was never searched and its agents kept the old agentSpawn dispatcher next to the new standalone hook. Load the user config with loadLocalConfig.
# Conflicts: # skill-data/core/references/troubleshooting.md
|
No new findings I’m confident are real in the specified diff.
Review was read-only and limited to the specified diff and trusted base criteria. I did not run, build, or install PR code. |
SaulMoro
left a comment
There was a problem hiding this comment.
Thanks @nateEc. I merged main twice to clear the troubleshooting.md conflicts (keeping every section), and fixed one gap: legacyAgentDirs read the user scope through readConfigFrom, which only loads project partitions, so a user-scope custom toolPaths.kiro.agents directory kept the old agentSpawn dispatcher next to the new hook. It now loads the user config with loadLocalConfig, with a unit case and a real-CLI run in the description. CI is green at e16c992.
…encent#1221) Tencent#1341 moved Kiro's session-start hook to ~/.kiro/hooks/teamai.json, which Kiro CLI V3 loads for every agent. The descriptor still said Kiro takes no hooks. It now names the file as a hook adapter, and kiroHookFile takes its directory from locate, as the other adapters do.
…ollow a moved home (#1221) (#1405) * feat(tools): state every tool's hook channel in the descriptor (#1221) Each built-in tool now names, for the user scope and for self mode, how teamai installs its hooks: entries in a settings file with the shape of its hook list, a file of teamai's own its adapter writes (OpenCode's plugin, Pi's and OMP's extension, Hermes, OpenClaw, dsh), 'none' or 'unknown'. Leaving it out fails tsc (tools.type-test.ts). hooks.ts takes each tool's hook shape from the descriptor (hookFormatOf) instead of its own tool sets; a test pins it to the table it replaced. * feat(locate): locate each tool's hooks from the descriptor (#1221) locate(tool, 'hooks') answers with the hook list of the tool's hook file, in its shape, or the directory its adapter writes teamai's file into. A workspace takes the user hooks; self mode takes the project's, except for a tool that reads its user hooks there too (ZCode's CLI, every adapter). A user hook file follows the tool's moved home, and the default home's is retired for the four tools whose earlier releases wrote there. hookSettingsFile and hookAdapterDir give the writers the same answer. No writer uses them yet. The matrix states every tool in the user scope, a workspace and self mode, with the moved homes. * fix(hooks): write and remove hooks where locate says the tool reads them (#1221) Hook writers took a fixed default-home path, so a tool whose home moved (CODEBUDDY_CONFIG_DIR, CODEX_HOME, OPENCODE_CONFIG_DIR, XDG_CONFIG_HOME, PI_CODING_AGENT_DIR) got hooks in a file it never reads. Settings writers now take the file from hookSettingsFile, and the Pi, OMP, OpenCode and dsh adapters take their directory from hookAdapterDir; both sit beside locate's hooks resolver and share its toolHome. Uninstall checks the moved file and the default-home copy earlier releases wrote, and the OpenCode and Pi adapter dirs locate retires. Pull leaves the default-home copy in place, as it does for skills; the tool does not read it. * fix(doctor): drop the note that teamai writes under a tool's default home (#1221) Hooks now follow a moved home, so nothing teamai writes for Pi, CodeBuddy, OpenCode or Muse stays under the default one, and doctor's "still writes some of its other files under" notes were wrong. The descriptor flag behind them is renamed to defaultHomeLeftovers: it now only says where earlier releases left hooks and MCP servers, which uninstall and MCP ownership still look for. * fix(hooks): hooks remove also clears the default-home hooks an earlier release wrote (#1221) A tool reads its default home again once the member unsets the variable that moved it, so the hooks an earlier release left there would fire after `hooks remove`. It now sweeps the places locate retires: the settings file, with the team's hook history to find team entries whose records went with the moved copy, and the OpenCode plugin and Pi extension directories. The e2e test runs the real CLI with CODEBUDDY_CONFIG_DIR and XDG_CONFIG_HOME set: hooks inject writes the moved homes, and uninstall and hooks remove clear both copies. * docs: hooks follow a moved OpenCode, Muse, Pi and CodeBuddy home (#1221) * fix(hooks): clear the default-home copy first, so one team-hook record covers both copies (#1221) A Muse team hook carries no marker, so only its manifest record names it, and an HTTP-backed team has no hook history to fall back on. Cleaning the moved file first consumed that record and left the team hook in the default-home copy. That copy now goes first with keepRecords, and the moved file's pass consumes the records. * refactor(hooks): key HOME-hook ownership on the descriptor's self channel, not on ZCode (#1221) A project install of a tool that keeps its user hooks reads them from HOME, so it owns only its gated team hooks there. reconcileHooksToAllTools and uninstall's HOME target named ZCode for this; they now read hooks.self === 'user', as hookSettingsFile already does. * fix(hooks): pull removes the OpenCode plugin an earlier release left in the default home (#1221) OpenCode 1.x loads the default config dir's plugins beside OPENCODE_CONFIG_DIR's and dedupes them by file URL, so the copy an earlier release wrote there and the moved one both ran, firing every event twice. Pull already deletes a project-scope copy for the same reason. * fix(hooks): an agent hook leaves no copy in a moved tool's default home (#1221) Withdrawing an OpenCode or Pi agent hook removed only the moved copy, so the one an earlier release wrote under the default home ran again once the home stopped moving. Removal now clears both. Writing an OpenCode agent hook also removes the earlier copy, which OpenCode 1.x loads beside the moved one. * fix(hooks): keep a moved tool's hooks and records when a copy is the same or fails (#1221) A default home linked to the moved one is the same directory, so pull no longer deletes the plugin it just wrote through the link. And when the default-home copy cannot be cleaned, the moved copy's pass leaves the records, so a retry after repairing the file still finds the team hook. * fix(hooks): pull removes the hooks an earlier release left in a moved tool's default home (#1221) The default-home copy was left as it was, so once the team changed a hook, the moved file's pass replaced its record and the old Muse team hook stayed in that copy with nothing to name it for removal. Pull now clears the copy first, judged by the records the moved pass then replaces, for CodeBuddy and Muse settings and Pi's extension as already for OpenCode's plugin. A copy that is the moved file through a link is left alone. * fix(hooks): keep a moved tool's hooks and records when its default-home copy cannot be cleaned (#1221) * fix(models): models switch writes into the Claude and Codex roots teamai init recorded (#1221) * fix(hooks): hooks remove exits 1 when it leaves hooks behind, as uninstall does (#1221) * fix(hooks): write settings and agent hooks only through a channel the tool reads (#1221) * test(hooks): cover recorded tool homes end to end for Pi, OpenCode, Muse and CodeBuddy Each test records a moved home, then runs pull or hooks inject, hooks list and hooks remove through the built CLI with the variable unset, so the recorded home alone decides where the hooks go. The OpenCode case also checks that the plugin reads the user context from the moved home. All four fail on main and pass here. They come from #1368, #1369, #1370 and #1371, which this branch replaces. Co-authored-by: Nathan Shan <[email protected]> * feat(tools): state Kiro's standalone hook file as its hook channel (#1221) #1341 moved Kiro's session-start hook to ~/.kiro/hooks/teamai.json, which Kiro CLI V3 loads for every agent. The descriptor still said Kiro takes no hooks. It now names the file as a hook adapter, and kiroHookFile takes its directory from locate, as the other adapters do. --------- Co-authored-by: Nathan Shan <[email protected]>
…ollow a moved home (Tencent#1221) (Tencent#1405) * feat(tools): state every tool's hook channel in the descriptor (Tencent#1221) Each built-in tool now names, for the user scope and for self mode, how teamai installs its hooks: entries in a settings file with the shape of its hook list, a file of teamai's own its adapter writes (OpenCode's plugin, Pi's and OMP's extension, Hermes, OpenClaw, dsh), 'none' or 'unknown'. Leaving it out fails tsc (tools.type-test.ts). hooks.ts takes each tool's hook shape from the descriptor (hookFormatOf) instead of its own tool sets; a test pins it to the table it replaced. * feat(locate): locate each tool's hooks from the descriptor (Tencent#1221) locate(tool, 'hooks') answers with the hook list of the tool's hook file, in its shape, or the directory its adapter writes teamai's file into. A workspace takes the user hooks; self mode takes the project's, except for a tool that reads its user hooks there too (ZCode's CLI, every adapter). A user hook file follows the tool's moved home, and the default home's is retired for the four tools whose earlier releases wrote there. hookSettingsFile and hookAdapterDir give the writers the same answer. No writer uses them yet. The matrix states every tool in the user scope, a workspace and self mode, with the moved homes. * fix(hooks): write and remove hooks where locate says the tool reads them (Tencent#1221) Hook writers took a fixed default-home path, so a tool whose home moved (CODEBUDDY_CONFIG_DIR, CODEX_HOME, OPENCODE_CONFIG_DIR, XDG_CONFIG_HOME, PI_CODING_AGENT_DIR) got hooks in a file it never reads. Settings writers now take the file from hookSettingsFile, and the Pi, OMP, OpenCode and dsh adapters take their directory from hookAdapterDir; both sit beside locate's hooks resolver and share its toolHome. Uninstall checks the moved file and the default-home copy earlier releases wrote, and the OpenCode and Pi adapter dirs locate retires. Pull leaves the default-home copy in place, as it does for skills; the tool does not read it. * fix(doctor): drop the note that teamai writes under a tool's default home (Tencent#1221) Hooks now follow a moved home, so nothing teamai writes for Pi, CodeBuddy, OpenCode or Muse stays under the default one, and doctor's "still writes some of its other files under" notes were wrong. The descriptor flag behind them is renamed to defaultHomeLeftovers: it now only says where earlier releases left hooks and MCP servers, which uninstall and MCP ownership still look for. * fix(hooks): hooks remove also clears the default-home hooks an earlier release wrote (Tencent#1221) A tool reads its default home again once the member unsets the variable that moved it, so the hooks an earlier release left there would fire after `hooks remove`. It now sweeps the places locate retires: the settings file, with the team's hook history to find team entries whose records went with the moved copy, and the OpenCode plugin and Pi extension directories. The e2e test runs the real CLI with CODEBUDDY_CONFIG_DIR and XDG_CONFIG_HOME set: hooks inject writes the moved homes, and uninstall and hooks remove clear both copies. * docs: hooks follow a moved OpenCode, Muse, Pi and CodeBuddy home (Tencent#1221) * fix(hooks): clear the default-home copy first, so one team-hook record covers both copies (Tencent#1221) A Muse team hook carries no marker, so only its manifest record names it, and an HTTP-backed team has no hook history to fall back on. Cleaning the moved file first consumed that record and left the team hook in the default-home copy. That copy now goes first with keepRecords, and the moved file's pass consumes the records. * refactor(hooks): key HOME-hook ownership on the descriptor's self channel, not on ZCode (Tencent#1221) A project install of a tool that keeps its user hooks reads them from HOME, so it owns only its gated team hooks there. reconcileHooksToAllTools and uninstall's HOME target named ZCode for this; they now read hooks.self === 'user', as hookSettingsFile already does. * fix(hooks): pull removes the OpenCode plugin an earlier release left in the default home (Tencent#1221) OpenCode 1.x loads the default config dir's plugins beside OPENCODE_CONFIG_DIR's and dedupes them by file URL, so the copy an earlier release wrote there and the moved one both ran, firing every event twice. Pull already deletes a project-scope copy for the same reason. * fix(hooks): an agent hook leaves no copy in a moved tool's default home (Tencent#1221) Withdrawing an OpenCode or Pi agent hook removed only the moved copy, so the one an earlier release wrote under the default home ran again once the home stopped moving. Removal now clears both. Writing an OpenCode agent hook also removes the earlier copy, which OpenCode 1.x loads beside the moved one. * fix(hooks): keep a moved tool's hooks and records when a copy is the same or fails (Tencent#1221) A default home linked to the moved one is the same directory, so pull no longer deletes the plugin it just wrote through the link. And when the default-home copy cannot be cleaned, the moved copy's pass leaves the records, so a retry after repairing the file still finds the team hook. * fix(hooks): pull removes the hooks an earlier release left in a moved tool's default home (Tencent#1221) The default-home copy was left as it was, so once the team changed a hook, the moved file's pass replaced its record and the old Muse team hook stayed in that copy with nothing to name it for removal. Pull now clears the copy first, judged by the records the moved pass then replaces, for CodeBuddy and Muse settings and Pi's extension as already for OpenCode's plugin. A copy that is the moved file through a link is left alone. * fix(hooks): keep a moved tool's hooks and records when its default-home copy cannot be cleaned (Tencent#1221) * fix(models): models switch writes into the Claude and Codex roots teamai init recorded (Tencent#1221) * fix(hooks): hooks remove exits 1 when it leaves hooks behind, as uninstall does (Tencent#1221) * fix(hooks): write settings and agent hooks only through a channel the tool reads (Tencent#1221) * test(hooks): cover recorded tool homes end to end for Pi, OpenCode, Muse and CodeBuddy Each test records a moved home, then runs pull or hooks inject, hooks list and hooks remove through the built CLI with the variable unset, so the recorded home alone decides where the hooks go. The OpenCode case also checks that the plugin reads the user context from the moved home. All four fail on main and pass here. They come from Tencent#1368, Tencent#1369, Tencent#1370 and Tencent#1371, which this branch replaces. Co-authored-by: Nathan Shan <[email protected]> * feat(tools): state Kiro's standalone hook file as its hook channel (Tencent#1221) Tencent#1341 moved Kiro's session-start hook to ~/.kiro/hooks/teamai.json, which Kiro CLI V3 loads for every agent. The descriptor still said Kiro takes no hooks. It now names the file as a hook adapter, and kiroHookFile takes its directory from locate, as the other adapters do. --------- Co-authored-by: Nathan Shan <[email protected]>
Kiro's default agent never ran the session-start dispatcher because synchronization was embedded in custom agents. Install a standalone Kiro V3 user hook and connect injection, listing, doctor, removal and uninstall. Migrate managed legacy agentSpawn entries out of active and kept agent copies to avoid duplicate dispatch.
Compatibility: intentionally requires Kiro V3 standalone hooks and drops Kiro 2.x embedded-hook support, as agreed in review. Member-authored hooks and agent content are preserved.
Review follow-up:
Rebase and retain both troubleshooting sections. Update the obsolete type comment to describe standalone V3 session hooks and legacy agentSpawn migration. Preserve the previously reviewed cleanup of legacy entries in active and kept agent copies.
Validation at
17b3bb45, based onfc8a229e:npx tsc --noEmit,npm run lint,npm run build,git diff --check: passed.npx vitest run src/__tests__/kiro-hooks.test.ts src/__tests__/hooks.test.ts src/__tests__/hooks-cmd.test.ts src/__tests__/agent-format.test.ts src/__tests__/uninstall.test.ts: 406 passed.npx vitest run --config vitest.e2e.config.ts src/__tests__/e2e/kiro-standalone-hooks.test.ts: 1 passed, using the real CLI and isolated local Git/HOME fixtures.Local host: macOS, Node 22.22.1, Apple Git 2.50.1. Native Windows, live vendor applications and additional provider combinations were not run locally and are left to CI. This record replaces the earlier combined-snapshot validation paragraphs.
Merge with
mainatf70ce259, head1c61f6a7:origin/maininto the branch to clear theskill-data/core/references/troubleshooting.mdconflict with fix(pi): deliver user context to active override files #1340. Both sections are kept, with the Pi section frommainfollowed by the Kiro section. The rest of the diff againstmainis unchanged.npx tsc --noEmit,npm run lint,npm run build,git diff --check: passed.npx vitest run src/__tests__/kiro-hooks.test.ts src/__tests__/kiro.test.ts src/__tests__/hooks.test.ts src/__tests__/hooks-cmd.test.ts src/__tests__/agent-format.test.ts src/__tests__/uninstall.test.ts: 416 passed.npx vitest run: 575 files passed, 1 skipped, 16425 tests passed.npm run test:e2e -- src/__tests__/e2e/kiro-standalone-hooks.test.ts: 1 passed.dist/index.jsin a throwawayHOMEand a local bare team remote, user scope,enabledAgents: [kiro], with a member-edited~/.kiro/agents/reviewer.jsonthat still carries the legacyagentSpawndispatch plus a personalecho personalentry:User-scope custom agents directory, head
e16c9925:legacyAgentDirsread the user scope throughreadConfigFrom, which only loads project partitions, so a user-scopetoolPaths.kiro.agentsdirectory was never searched. It now loads the user config withloadLocalConfig. New unit case inkiro-hooks.test.tsfails on1c61f6a7and passes here.origin/mainagain after fix(doctor): report blocked skill directories and preserve them on uninstall #1335;troubleshooting.mdkeeps the blocked-skills section, then the Kiro section.npx tsc --noEmit,npm run lint,npm run build: passed. Kiro and hooks unit files pass.npm run test:e2e -- src/__tests__/e2e/kiro-standalone-hooks.test.ts src/__tests__/e2e/blocked-skills-directory.test.ts: 3 passed.toolPaths.kiro.agents: work/project/.kiro/agents, agent carrying the legacy dispatch plusecho personal, thenteamai hooks inject:No tests were deleted.
Refs #1221; this PR addresses only its stated independent defect.