Repository navigation
fix(approvals): give each background tool approval its own id - #25905
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The new id is minted where the background callback registers the approval, the same way the task gate already mints Notes
What this change shipsInventory (5 items) — 4 justifiedIntent: let parallel sub-agents each get approval answered for their own request (FIX, closes #25874).
[FIRST-PRINCIPLES-REVIEWED] f2bb57f Description read[DESCRIPTION-READ] a03ffe09816c6367e1e37191bebb5e18386e308627875ff10380e0567e501d87 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the fix makes the registry key unique at the one place background tool approvals register it, while the backend is still answered with its own request id and spawn ids keep their current form. Notes
[DESIGN-REVIEWED] f2bb57f Description read[DESCRIPTION-READ] 2158f6c3e63501ecee532f2b273cdc2fa1b5840952570d94220ba483a0f646f5 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 |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
f59de77 to
72413c5
Compare
|
Windows shard 2 fails on three tests this PR does not touch: |
|
Rebased onto the main-red fix (#25947); CI re-running. |
72413c5 to
f2bb57f
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved on behalf of the watch holder (bolichen). Design and First Principles pass on this head, UX skipped or pass, no conflict, no open change request.
Backports these main PRs to release/0.11.0, in pick order. Each was a `git cherry-pick -x` of its squash commit on main: - fix(memory): read memory.db off the writer lock, split background pool (#24290) (cherry picked from commit fed830c) - fix(dashboard): bound the pre-prompt build's wait to enter the memory pool (#24414) (cherry picked from commit 520cf2c) - fix(memory): keep the shared -wal when another process closes the memory store (#25852) (cherry picked from commit dc63bb6) - fix: read the page-cache prefetch in a child to keep sqlite locks (#26302) (cherry picked from commit 81dde23) - perf(memory): score facts from a term index and prebuild after restart (#25328) (cherry picked from commit 6824348) - fix(desktop): retry a failed netstat before Windows recovery gives up (#25792) (cherry picked from commit 043dd9f) - fix(cli): say a gateway still serves the port when restart's replacement is refused (#25366) (cherry picked from commit 2e13127) - fix(cli): refuse to stop or restart a gateway the desktop app supervises (#25705) (cherry picked from commit bbf0910) - fix(hooks): approve kiro-cli read-only file searches after the deny tiers (#25150) (cherry picked from commit a0c0bd4) - fix(settings): refuse a config save that config.local.json overrides (#26216) (cherry picked from commit 7f8688e) - fix(workflows): write non-finite floats as null so runs open (#26085) (cherry picked from commit 3591282) - fix(approvals): give each background tool approval its own id (#25905) (cherry picked from commit 51ef3bb) - fix(chat): record file changes for kiro-cli v3 write tools (#25650) (cherry picked from commit 5369270) - fix(sandbox): stop blaming a host-wide OOM kill on a per-tree limit (#25647) (cherry picked from commit 791d2a2) - fix(acp): replay history when a KAS resume restores no turns (#25521) (cherry picked from commit 47c71cb) Conflicts resolved by hand: - #26302: test/spawn_audit_helpers.py adds only the page_cache.py entry (the embeddings_child.py entry names a module 0.11.0 lacks); test/test_page_cache_prefetch.py takes main's file. - #25328: test/test_dashboard_server_composition_contract.py lazy-import count 93 -> 96 (the three names it adds). - #25705: test/test_cli_restart_refused_message.py takes main's file. - #26085: dashboard/handlers/workflows.py adds import math, keeps the release typing import. Left out: #23920 (already on release/0.11.0), #26144 (needs sandbox_launch_mark from #24709), #26088 (fences a main-only port).
Backports these main PRs to release/0.11.0, in pick order. Each was a `git cherry-pick -x` of its squash commit on main: - fix(memory): read memory.db off the writer lock, split background pool (#24290) (cherry picked from commit fed830c) - fix(dashboard): bound the pre-prompt build's wait to enter the memory pool (#24414) (cherry picked from commit 520cf2c) - fix(memory): keep the shared -wal when another process closes the memory store (#25852) (cherry picked from commit dc63bb6) - fix: read the page-cache prefetch in a child to keep sqlite locks (#26302) (cherry picked from commit 81dde23) - perf(memory): score facts from a term index and prebuild after restart (#25328) (cherry picked from commit 6824348) - fix(desktop): retry a failed netstat before Windows recovery gives up (#25792) (cherry picked from commit 043dd9f) - fix(cli): say a gateway still serves the port when restart's replacement is refused (#25366) (cherry picked from commit 2e13127) - fix(cli): refuse to stop or restart a gateway the desktop app supervises (#25705) (cherry picked from commit bbf0910) - fix(hooks): approve kiro-cli read-only file searches after the deny tiers (#25150) (cherry picked from commit a0c0bd4) - fix(settings): refuse a config save that config.local.json overrides (#26216) (cherry picked from commit 7f8688e) - fix(workflows): write non-finite floats as null so runs open (#26085) (cherry picked from commit 3591282) - fix(approvals): give each background tool approval its own id (#25905) (cherry picked from commit 51ef3bb) - fix(chat): record file changes for kiro-cli v3 write tools (#25650) (cherry picked from commit 5369270) - fix(sandbox): stop blaming a host-wide OOM kill on a per-tree limit (#25647) (cherry picked from commit 791d2a2) - fix(acp): replay history when a KAS resume restores no turns (#25521) (cherry picked from commit 47c71cb) - fix(kas): auto-approve granted built-ins after Crew's own checks (#25339) (cherry picked from commit dba4de5) - fix(kas): mount web_search as the engine's remote_web_search (#26435) (cherry picked from commit 65c21b5) - fix(kas): answer a spec's shell.allowedCommands at the gate, after Crew's checks (#25539) (cherry picked from commit 39d07d9) - fix(kas): relay an MCP server's boolean env flags, never its secrets (#25331) (cherry picked from commit b734a68) - fix(security): read the -c script past options and redirections (#26087) (cherry picked from commit fea0920) - fix(kas): refuse a shell command a denyByDefault spec does not allow (#26501) (cherry picked from commit 9f0d02f) - fix(kas): name a deniedCommands deny aimed at a redirect as not carried (#26489) (cherry picked from commit 4951c0c) - fix(security): delete the curl-upload deny rule (#26469) (cherry picked from commit 70e206e) Conflicts resolved by hand: - #26302: test/spawn_audit_helpers.py adds only the page_cache.py entry (the embeddings_child.py entry names a module 0.11.0 lacks); test/test_page_cache_prefetch.py takes main's file. - #25328: test/test_dashboard_server_composition_contract.py lazy-import count 93 -> 96 (the three names it adds). - #25705: test/test_cli_restart_refused_message.py takes main's file. - #26085: dashboard/handlers/workflows.py adds import math, keeps the release typing import. - #25339: platform/governance.py keeps the release rule for a missing ceiling (main's enterprise-baseline clause is not on 0.11.0). - #26435: harness-parity.md H6 row edited in place on the release text. - #25539: its acp-client.md and agent-spec-fields.md lines are left out; the paragraphs they edit are not on 0.11.0 (security.md carries it). - #25331: the test and two doc mentions use hoist_managed_servers / resume=, the 0.11.0 names of main's renamed hoist_servers_for_session. - #26087: security package line budget 32,552 -> 32,714 (re-measured). - #26501: kas_permissions.py comment keeps 0.11.0's shapes (main's subagent rules are absent); its acp-client.md line is left out, and the agent-spec-fields.md toolsSettings row says denyByDefault is gate-enforced. - #26489: its agent-spec-fields.md sentence is added to the 0.11.0 row. - #26469: test_denied_commands_security.py keeps 0.11.0's comment; count 113 -> 112. Test fixes (host-dependent tests made hermetic; none loosens an assertion): - tmpdir_helpers.short_tmp_path: a tmp_path override for modules whose code judges a path by its components (a .kiro/crew data-home part); an agent session's TMPDIR under ~/.kiro/crew made every test path the data home. Used by the file-explorer, design-tweak (both), spawn-offload, launch-copy, home-pin, native-skill and auto-improvement-members tests; the sage ancestor-chain test creates its dir under /tmp for the same reason. - pi-gate tests and the remote-session Python 3.9 test take the first real binary on PATH (playwright_cli_installer_helpers._native_tool_on_path): a mise shim under a scratch HOME hangs or writes to stdout. - snapshot-merge ACL test names its own uid; nobody (65534) is the overflow uid inside a user namespace and cannot be named in an ACL. - installer-step and push_guard interrupt tests spawn with SIGINT at its default; a background pytest run starts with SIGINT ignored, which a shell trap and Python both keep. Left out: #23920 (already on release/0.11.0), #26144 (needs sandbox_launch_mark from #24709), #26088 (fences a main-only port), #25346 (11 of its tests fail on 0.11.0: the kiro-cli skill scope it compares against differs there), #26397 (needs #26152's new download route, not on 0.11.0), #26428 (not merged).
…26487) Backports these main PRs to release/0.11.0, in pick order. Each was a `git cherry-pick -x` of its squash commit on main: - fix(memory): read memory.db off the writer lock, split background pool (#24290) (cherry picked from commit fed830c) - fix(dashboard): bound the pre-prompt build's wait to enter the memory pool (#24414) (cherry picked from commit 520cf2c) - fix(memory): keep the shared -wal when another process closes the memory store (#25852) (cherry picked from commit dc63bb6) - fix: read the page-cache prefetch in a child to keep sqlite locks (#26302) (cherry picked from commit 81dde23) - perf(memory): score facts from a term index and prebuild after restart (#25328) (cherry picked from commit 6824348) - fix(desktop): retry a failed netstat before Windows recovery gives up (#25792) (cherry picked from commit 043dd9f) - fix(cli): say a gateway still serves the port when restart's replacement is refused (#25366) (cherry picked from commit 2e13127) - fix(cli): refuse to stop or restart a gateway the desktop app supervises (#25705) (cherry picked from commit bbf0910) - fix(hooks): approve kiro-cli read-only file searches after the deny tiers (#25150) (cherry picked from commit a0c0bd4) - fix(settings): refuse a config save that config.local.json overrides (#26216) (cherry picked from commit 7f8688e) - fix(workflows): write non-finite floats as null so runs open (#26085) (cherry picked from commit 3591282) - fix(approvals): give each background tool approval its own id (#25905) (cherry picked from commit 51ef3bb) - fix(chat): record file changes for kiro-cli v3 write tools (#25650) (cherry picked from commit 5369270) - fix(sandbox): stop blaming a host-wide OOM kill on a per-tree limit (#25647) (cherry picked from commit 791d2a2) - fix(acp): replay history when a KAS resume restores no turns (#25521) (cherry picked from commit 47c71cb) - fix(kas): auto-approve granted built-ins after Crew's own checks (#25339) (cherry picked from commit dba4de5) - fix(kas): mount web_search as the engine's remote_web_search (#26435) (cherry picked from commit 65c21b5) - fix(kas): answer a spec's shell.allowedCommands at the gate, after Crew's checks (#25539) (cherry picked from commit 39d07d9) - fix(kas): relay an MCP server's boolean env flags, never its secrets (#25331) (cherry picked from commit b734a68) - fix(security): read the -c script past options and redirections (#26087) (cherry picked from commit fea0920) - fix(kas): refuse a shell command a denyByDefault spec does not allow (#26501) (cherry picked from commit 9f0d02f) - fix(kas): name a deniedCommands deny aimed at a redirect as not carried (#26489) (cherry picked from commit 4951c0c) - fix(security): delete the curl-upload deny rule (#26469) (cherry picked from commit 70e206e) Conflicts resolved by hand: - #26302: test/spawn_audit_helpers.py adds only the page_cache.py entry (the embeddings_child.py entry names a module 0.11.0 lacks); test/test_page_cache_prefetch.py takes main's file. - #25328: test/test_dashboard_server_composition_contract.py lazy-import count 93 -> 96 (the three names it adds). - #25705: test/test_cli_restart_refused_message.py takes main's file. - #26085: dashboard/handlers/workflows.py adds import math, keeps the release typing import. - #25339: platform/governance.py keeps the release rule for a missing ceiling (main's enterprise-baseline clause is not on 0.11.0). - #26435: harness-parity.md H6 row edited in place on the release text. - #25539: its acp-client.md and agent-spec-fields.md lines are left out; the paragraphs they edit are not on 0.11.0 (security.md carries it). - #25331: the test and two doc mentions use hoist_managed_servers / resume=, the 0.11.0 names of main's renamed hoist_servers_for_session. - #26087: security package line budget 32,552 -> 32,714 (re-measured). - #26501: kas_permissions.py comment keeps 0.11.0's shapes (main's subagent rules are absent); its acp-client.md line is left out, and the agent-spec-fields.md toolsSettings row says denyByDefault is gate-enforced. - #26489: its agent-spec-fields.md sentence is added to the 0.11.0 row. - #26469: test_denied_commands_security.py keeps 0.11.0's comment; count 113 -> 112. Test fixes (host-dependent tests made hermetic; none loosens an assertion): - tmpdir_helpers.short_tmp_path: a tmp_path override for modules whose code judges a path by its components (a .kiro/crew data-home part); an agent session's TMPDIR under ~/.kiro/crew made every test path the data home. Used by the file-explorer, design-tweak (both), spawn-offload, launch-copy, home-pin, native-skill and auto-improvement-members tests; the sage ancestor-chain test creates its dir under /tmp for the same reason. - pi-gate tests and the remote-session Python 3.9 test take the first real binary on PATH (playwright_cli_installer_helpers._native_tool_on_path): a mise shim under a scratch HOME hangs or writes to stdout. - snapshot-merge ACL test names its own uid; nobody (65534) is the overflow uid inside a user namespace and cannot be named in an ACL. - installer-step and push_guard interrupt tests spawn with SIGINT at its default; a background pytest run starts with SIGINT ignored, which a shell trap and Python both keep. Left out: #23920 (already on release/0.11.0), #26144 (needs sandbox_launch_mark from #24709), #26088 (fences a main-only port), #25346 (11 of its tests fail on 0.11.0: the kiro-cli skill scope it compares against differs there), #26397 (needs #26152's new download route, not on 0.11.0), #26428 (not merged). Co-authored-by: w <w@k.local>
Problem / Motivation
Goal: When two sub-agents ask for approval at the same time, each approval card answers its own request.
Two sub-agents run in parallel and each asks to run a tool. Both requests reach the dashboard with the same approval id (
1), because the backend numbers its requests per connection and each sub-agent's first request is1. The second request replaces the first in the dashboard's list of background approvals. The first Approve click can answer the other request, the second click returns404 not found or expired, and the remaining sub-agent waits until its approval times out.Why it matters
Anyone who runs sub-agents in parallel in the normal approval mode can hit this. A click looks ignored, one sub-agent stalls for the whole approval window, and the request a card answers may not be the one shown on it.
Not a goal
What changed (motivation → approach → change)
Each background tool approval now registers under its own id. The cause was that the gateway's background approval callback registered the backend's request id as is, so two runtimes asking at once shared one registry key.
1-c0a5af7791cfspawn:<agent id>The backend is still answered through the event's own request id, so nothing changes on the agent side. Spawn ids keep their form because the spawn card and the slot resolver read it. The change is in
slack/gateway_runtime/turn_approvals.py, and the Slack race path and the dashboard-only path both use the new id.Backwards compatibility
Compatible: the approval id stays an opaque string to every client; the feed, the chat card and the slot approve route all send back the id they received.
Removes nothing: no field, route or accepted value is removed; only the id string a background tool approval registers under is longer.
Tests
test/test_background_approval_id_collision.py: two sub-agent requests with the same backend id1both stay listed under distinct ids, and resolving each card's id releases both waiters. A second test pins that aspawn:id is registered unchanged.test/test_slack_gateway.py: two existing tests now check that the registered id starts with the backend id.Proof: PROVEN test/test_background_approval_id_collision.py::test_same_request_id_from_two_children_gets_two_live_approvals, test/test_slack_gateway.py::TestInteractiveApproval::test_parent_session_routes_tool_approval_when_spawn_resolver_misses, test/test_slack_gateway.py::TestInteractiveApproval::test_all_slots_trusted_does_not_auto_approve (head f59de77)
Determinism: the new tests passed 5 runs in a row and in reversed order; they use no sleeps or real timeouts.
Manual verification
Run in an isolated dev pod: one
spawn_runcall with two parallel tasks (date > /tmp/kc25485-a.txt,date > /tmp/kc25485-b.txt), normal approval mode, both approvals answered throughPOST /api/approvals/{id}/approveas the bell does.1,11-c0a5af7791cf,1-ba44d22e4540GET /api/approvalsRelated Issues
Closes #25874
Sibling sweep
Swept: git grep -nE ".request_approval(" -- src/
Sibling: src/kiro_crew/slack/gateway_runtime/turn_approvals.py -- changed here
Sibling: src/kiro_crew/slack/gateway_runtime/service_boot.py:605 -- not affected -- the task gate already mints a unique task-gate id per call
Pattern harvest
Rule candidate: review-prompt
Pattern: a registry shared across connections keyed by a connection-scoped JSON-RPC id
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)