Repository navigation
fix: record a host spawn-approval decision as the host's - #31954
Conversation
c6c63cf to
49a3604
Compare
49a3604 to
c17d4eb
Compare
|
Rebased: main moved in docs/system-specs/modules/subagent.md and the crew log emitter spec since this head went green (76ec06a -> b65af1a); CI re-running. The one test red on the previous head ( [operator: bolichen97] |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The defect is item 1 of the linked #16574, with a crew-log test that fails on base. The fix is at the cause: the callback's bare What this change shipsInventory (6 items) — 6 justifiedIntent: when the host answered a spawn approval itself, the operator's audit log says so instead of naming a person. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 9147e7d Description read[DESCRIPTION-READ] 2530006cdb29bc44532bcc55b3e08e7434e7b7cf95dd5c6122a8e8224089b5d3 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 host-versus-person split happens where the decision is made, tool approvals are unchanged, and Notes
[DESIGN-REVIEWED] 9147e7d Description read[DESCRIPTION-READ] 3c1c34af067ec6901a7c1607a2120b1177c3d2407d2095d9866a9e290d4ec759 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: |
|
[operator: bolichen97] The red on c17d4eb is main's, not this change's. #32183 raises the budget to main's measured size. This PR waits for it to merge, then rebases onto it and re-runs CI. |
The spawn gate wrote approval/decided with no `by` after every normal return of the spawn approval callback, which reads as a person's answer. The callback often answers alone: an auto-approve source, --approval, the YOLO override, slot trust, no UI, or a Slack prompt whose window closed. The spawn callback now returns a HostSpawnDecision(approved, cause) when the gateway answered with nobody asked, learned through a new optional on_host_decision hook on _interactive_approval that only the spawn gate passes. A bare bool still means a person answered, so tool approvals and every approve/reject outcome are unchanged. The gate records `by: host`, with `cause: approval_timeout` for an expired Slack prompt. Closes #16574
c17d4eb to
9147e7d
Compare
|
Rebased: main moved in docs/system-specs/modules/subagent.md, src/kiro_crew/slack/gateway_runtime/subagent_wiring.py since this head went green (b65af1a -> f58c3cf); CI re-running. The only red on the previous head, [operator: bolichen97] |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved: PR Readiness passed on 9147e7d, and all five review lanes (Opus 5.5, GPT 6.1, Design, UX, First Principles) report no blocking finding on this head. No conflict and no open change request.
The spawn gate wrote approval/decided with no `by` after every normal return of the spawn approval callback, which reads as a person's answer. The callback often answers alone: an auto-approve source, --approval, the YOLO override, slot trust, no UI, or a Slack prompt whose window closed. The spawn callback now returns a HostSpawnDecision(approved, cause) when the gateway answered with nobody asked, learned through a new optional on_host_decision hook on _interactive_approval that only the spawn gate passes. A bare bool still means a person answered, so tool approvals and every approve/reject outcome are unchanged. The gate records `by: host`, with `cause: approval_timeout` for an expired Slack prompt. Closes #16574 (cherry picked from commit 7cb813b) Backport note: turn_approvals.py, its composition-contract signature and the slack-gateway.md list add on_host_decision without the requester parameter and its card line (feat #31393, not on release), so the doc entry is numbered 6 on release.
Problem / Motivation
Goal: A spawn approval the host answered by itself is recorded in the crew log as the host's decision, not a person's.
The spawn gate writes
approval/decidedwith nobyand nocauseafter every normal return of the spawn approval callback, which by definition means a person answered. That callback often answers alone: whensubagentis inhooks.auto_approve_sources, under--approval yolo, under the YOLO override, under slot trust, with no UI at all, and when a Slack prompt's window closes. Each of those shows up in theapprovalsfold as a person's decision (item 1 of #16574; items 2 and 3 shipped in #30999).Why it matters
An operator who audits who approved a spawn is told a person decided when nobody was asked. A wrong
byis worse than none: it sends the reader to a surface and a person that were never involved.Not a goal
What changed (motivation → approach → change)
approval/decidedbeforebyby(unchanged)--approval, YOLO override, slot trust, no UIbyby: hostby, nocauseby: host,cause: approval_timeoutCause. The callback returns a bare
bool, so the gate cannot tell its own answer from a person's.Change. The spawn callback returns a
HostSpawnDecision(approved, cause)when the gateway answered alone, and a bareboolstill means a person answered._interactive_approvaltakes an optionalon_host_decisionhook that each answer-alone rung calls; only the spawn gate's instance passes it, so tool approvals are unchanged and still return a plainbool.HostSpawnDecisionis falsy for a decline, so a plainifcannot read a host no as a yes.HostSpawnDecisionsits besideSpawnApprovalUnreachableinsubagent_parts/delivery.pyand is served fromsubagent.py, the import path its callers use. The approve/reject outcome is the same on every path. Thecrew-log-emitter,slack-gatewayandsubagentspecs say which answers are the host's.Backwards compatibility
Compatible: a person's answer is still a bare
boolrecorded withoutby, the newon_host_decisionkeyword is optional, and no spawn is approved or rejected differently.Removes nothing: no field, key or path is taken away; host-decided entries only gain
by: hostand, for an expired Slack prompt, acause.Tests
test_spawn_approval_crew_log.py::test_an_answer_the_callback_gave_with_nobody_asked_is_the_hosts: a host decline is writtenby: hostwith its cause, the spawn is still rejected, and the decision is falsy.test_spawn_approval_no_surface.py::TestHostDecisionsAreReported: the real_interactive_approvalreports the auto-approve source,--approval yoloand the YOLO override as host approvals without raising a prompt, and an unanswered Slack prompt as a host decline withapproval_timeout.test_gateway_subagent_wiring.py::test_a_spawn_the_gate_answered_with_nobody_asked_returns_a_host_decision: the wiring turns a reported answer into aHostSpawnDecisionand leaves a person's answer a bareTrue.test_spawn_approval_delivery.py,test_spawn_approval_no_surface.py,test_gateway_subagent_wiring.py,test_slack_gateway_composition_contract.py) follow the changed callback line and signature.Proof: not provable -- prove.py timed out
By hand instead: with
pump.pyput back toorigin/main, the crew-log test fails (KeyError: 'by'); with theon_host_decisionreport removed from_interactive_approval, all fourTestHostDecisionsAreReportedcases fail.Determinism: the new and changed tests passed 20 runs at
-n0, 10 runs at-n 4 --dist loadgroupbeside their own files, and a shuffled order (seed 3217).Manual verification
N/A — unit coverage sufficient: the change is the value of two crew-log fields, pinned at the gate, at the wiring and on the real approval callback.
Screenshots / video
N/A — no user-visible frontend surface is touched.
Related Issues
Closes #16574
Sibling sweep
Swept: git grep -nE "request_approval(|unpressed_wait_answer(|_on_spawn_approval(" -- src/kiro_crew
Sibling: src/kiro_crew/slack/gateway_runtime/turn_approvals.py -- changed here
Sibling: src/kiro_crew/dashboard/interaction_coordinator.py -- tracked in #31930
Sibling: src/kiro_crew/messaging/spawn_approval_delivery.py -- tracked in #31930
Sibling: src/kiro_crew/subagent_manager/run.py -- not affected -- a running child's tool prompt is recorded by its own writer, not this callback
Pattern harvest
Rule candidate: review-prompt
Pattern: a callback returns a bare bool that merges "a person decided" with "the code decided" while its caller records who decided
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)