Repository navigation
kiro universal agent-config format: task-init's hook merge and task-remove's strip break on an upgraded .kiro/agents/*.json (#267) - #270
Merged
Conversation
…emove's strip break on an upgraded .kiro/agents/*.json: handle the array shape (#267) kiro-cli's V3 engine can rewrite `.kiro/agents/*.json` into its "universal" format, where `hooks` is an array of `{name, trigger, action: {type, command}, timeout}`. task-init's merge failed on every agent with `Cannot index array with string "agentSpawn"`, and the strip in `lib/loadout-artifacts.sh` silently skipped the array, leaving every radio hook behind on task-remove / task-config set. - `kiro-radio-hooks-jq-merge` / `kiro-radio-stray-hook-verify` (all three kiro installers, drift-guarded): recognise radio entries by command in either shape, add missing ones in the shape the file already uses (`radio-<trigger>`, timeout 10), never convert between formats. - `_la_strip_agent_hooks`: drops radio entries from the array too, and drops `hooks` once empty. - `aw_kiro_warn_upgrade_gate` and the kiro steering docs / README lose the "true cannot be merged into yet" caveat. Fixtures in `tests/fixtures/kiro-universal/` are unedited `kiro-cli agent upgrade` output (kiro-cli 2.32.0), inputs in `v2/`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
Spec compliance (#267)All three asks are delivered:
The #257 warning no longer carries the Code-review findingsNo blockers. CI ran and passed for head Nits, to fix in this PR if cheap:
Verdictclean-with-nits. Nit 1 is the only one with real behaviour behind it. PM can merge as is, or forward nit 1 in a single round. |
…emove's strip break on an upgraded .kiro/agents/*.json: hook-less universal configs get an array, name collisions documented (#267) Review round 1 on PR #270. - A universal config with no `hooks` key fell into the object branch and became a hybrid, which kiro-cli's upgrade reports as "out of sync (not rebuilt)". The merge now takes the shape from `permissions` when `hooks` is absent. That is the field kiro-cli keys the hooks shape on (probed on 2.32.0). `kiroUpgrade` cannot be the marker: a V3-only config has no fingerprint. - Duplicate hook names: kiro-cli 2.32.0 accepts them (`agent validate`, `agent upgrade`, `agent list`). Recorded in a comment; nothing avoids them. - New real fixture `no-hooks.json`, generated under a scratch HOME, plus two tests. Both fail on the previous head, and the second also fails with the marker swapped to `kiroUpgrade`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #267
What changed
kiro-radio-hooks-jq-merge+kiro-radio-stray-hook-verify, byte-identical across kiro-gh / kiro-local / kiro-notion,tools/check-drift.shclean): radio entries are recognised by command in either shape (.commandor.action.command). Missing ones are added in the shape the file already uses. In the universal shape that is{name: "radio-<trigger>", trigger, action: {type: "command", command}, timeout: 10}. Configs are never converted between formats. The stale-radio-command warning reads the array too._la_strip_agent_hooksinlib/loadout-artifacts.sh): drops radio entries from an arrayhooks, keeps the user's own entries verbatim, and dropshooksonly once it is empty.truecaveat is gone fromaw_kiro_warn_upgrade_gate, the three kiro steering templates and the README. The warning still namesfalseas the fix.toolsand addspermissions/kiroUpgrade. So removal keeps it with only the radio hooks stripped (the existing keep-bias), and--purgestill deletes it.How the fixtures were produced
tests/fixtures/kiro-universal/*.jsonare the unedited output ofkiro-cli agent upgrade --no-backup <dir>on kiro-cli 2.32.0, run over the minimal inputs kept inv2/. Those inputs are in task-init's own shape, with the radio commands copied verbatim from what kiro-gh's installer writes.tests/fixtures/kiro-universal/README.mdhas the regeneration recipe.kiro-cli agent upgradeandkiro-cli agent validate, with an explicit scratch directory as the target, under a scratchTASK_FORCE_HOMEand withTASK_FORCE_ROLEunset. I did not run anykiro-cli settingswrite.~/.kirohas a modification time later than 07:22 today, which is before this session started. The global agent configs and symlinks are unchanged. Neither this repo nor its worktree has a.kiro/.kiro-cli agent validate.kiro-cli agent upgrade --dry-runstill reports that configalready universal, so thekiroUpgradefingerprint is not tripped.validaterejects a malformed array entry, so the shape check is real.Tests
./run_tests.sh: 1383/1383 pass (round 1).tools/check-drift.sh: clean.shellcheck -xon the changed shell files: clean.--loadoutdefault.task-remove(apply and--dry-run, plus a radio-only config) and throughtask-config set.kiro-gh/bin/task-init, 4 of the 5 kiro-gh installer tests went red. The fifth, "object configs stay objects", guards the opposite mistake. A merge mutated to normalise every config to the universal shape turned it red.Review round 1 (changes-requested): both nits
Nit 1: a hook-less universal config. It used to get an object
hooks, a hybrid. It now gets an array.has("permissions"), nothas("kiroUpgrade"). I probed kiro-cli 2.32.0 withagent upgrade --dry-run, which classifies each file:hooksin any file that haspermissionsis reportedout of sync (not rebuilt), whether or notkiroUpgradeis present. An array is accepted in every case.permissionsfrom an upgraded file and it becomes upgradeable again. DropkiroUpgradeinstead and it staysalready universal.allowedTools) carries no fingerprint. SokiroUpgradewould give exactly that file the hybrid.permissions, so fresh installs keep object hooks.no-hooks.jsonis realkiro-cli agent upgradeoutput of a hook-less v2 config. It has nohookskey, and does havepermissionsandkiroUpgrade.hookswith the threeradio-<trigger>entries, and nothing else in the file changes.kiroUpgradedropped still gets an array. This pinspermissionsas the marker.c0d13d8. The second one also fails with the marker swapped tohas("kiroUpgrade").Nit 2: duplicate hook names. kiro-cli 2.32.0 does not reject them.
agent validate,agent upgrade --dry-runandagent listall accept a config with two hooks namedradio-stop. A one-line comment in the merge region now says so. Not tested: whether both of the hooks fire in a live session. Note thatagent validatecannot settle any of this. It accepted every variant I tried, the hybrid included, and it exits 0 even when it prints an error.How kiro-cli was run this round: every run had HOME pointed at a scratch dir, a scratch
TASK_FORCE_HOMEandTASK_FORCE_ROLEunset. Under a scratch HOME thekiro-clilauncher fails, because it looks for$HOME/.local/bin/kiro-cli-chat. So I called/Applications/Kiro CLI.app/Contents/MacOS/kiro-cli-chat(2.32.0) directly. kiro-cli wrote its state (.kiro/settings/cli.json,data.sqlite3) into the scratch HOME. The only files in the real~/.kiromodified today are chat sessions from another repo (recommender-systems). I also regenerated the three round-0 fixtures under the scratch HOME, and they came out byte-identical to the committed ones.The three installers are still drift-identical.
Upgrading: removal needs no re-run, since
lib/takes effect through the symlinks. Re-runtask-init <kiro loadout>to get the merge fix and the updated steering doc.🤖 Generated with Claude Code