Repository navigation
fix: record an unanswered spawn prompt as the host's decline - #35157
Conversation
A spawn prompt that nobody answered was written to the parent's crew log as a person's decline. With the dashboard as the only surface, the coordinator's wait returned False both when it expired and when a Stop or reap cancelled it, the same value as a Deny. On Telegram and Discord an unpressed wait came back from the delivery seam as a bare False too. ApprovalCoordinator.request and DashboardState.request_approval take an optional on_host_decision. The gateway's spawn gate passes it in its dashboard-only fallback, so an expiry is reported as the host's with cause approval_timeout and a cancel reaches the gate, which records its own host-attributed cancel. Every other caller still reads both as False. The seam's unpressed_wait_answer returns HostSpawnDecision(False, approval_timeout), which covers both channel hooks. No approve or reject outcome changes. A running child's tool prompt answered by a gateway shortcut is the fourth path in the issue and lands separately. Part of #31930
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Each item fixes the mechanism that turned an unanswered spawn prompt into a plain Inventory (5 items) — 5 justifiedIntent: let an operator reading the crew log tell a spawn refusal nobody made (expired, stopped or reaped prompt) apart from a person's Deny. FIX.
[FIRST-PRINCIPLES-REVIEWED] 1c318ce Description read[DESCRIPTION-READ] 674f82e9df56627f4405b328ffe0c7a218d5a494fc94c2c9f5c2455e0060e833 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 expiry hook is opt-in and only the spawn gate passes it, and the gate already records a cancel as the host's. Notes
[DESIGN-REVIEWED] 1c318ce Description read[DESCRIPTION-READ] c8ecfab007e22dc05b7df4366d15102208e309ff3e8ea4980470c9909e734fff 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 |
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: |
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: |
buluoray
left a comment
There was a problem hiding this comment.
Approve on 1c318ce. When nobody answers a spawn prompt (it expires on the dashboard alone, it is cancelled while open there, or a Telegram/Discord wait elapses unpressed), the crew log now records the host as the decider instead of a person; every refusal stays a refusal and every other caller's answer is unchanged. Decisive lines: src/kiro_crew/dashboard/interaction_coordinator.py:195-203, src/kiro_crew/slack/gateway_runtime/turn_approvals.py:599-612, src/kiro_crew/messaging/spawn_approval_delivery.py:228-229, src/kiro_crew/slack/gateway_runtime/subagent_wiring.py:363-388, src/kiro_crew/subagent_manager/admission/pump.py:1307-1310,1350-1361,1420-1426
Problem / Motivation
Goal: A spawn prompt that ends with nobody answering it (its window closes on the dashboard or on a chat channel, or a Stop or reap cancels it while it is open on the dashboard) is recorded in the crew log as the host's decision, not as a person declining.
When a sub-agent spawn needs approval and nobody answers, the parent's crew log writes
approval/decidedasrejectedwith noby, which reads as "a person said no". It happens when the dashboard is the only surface and its wait expires, when a Telegram or Discord prompt's wait elapses with no press, and when the run is stopped or reaped while a dashboard-only prompt is open.Why it matters
The crew log is the record an operator reads to learn who decided what. An expired or stopped prompt shown as a person's decline blames a person for a refusal nobody made, on the most common install shape: the dashboard alone, where an attended prompt waits two hours.
Not a goal
What changed (motivation → approach → change)
The spawn gate already writes
by: hostwhen its approval callback returns aHostSpawnDecision, and writes its own host-attributed cancel when its wait is cancelled (#31954). Three waits handed it a plainFalseinstead, the same value as a person's Deny:False: a person'srejectedcause: approval_timeoutFalse: a person'srejectedFalse: a person'srejectedcause: approval_timeoutApprovalCoordinator.request(dashboard/interaction_coordinator.py) andDashboardState.request_approval(state_parts/dashboard_services.py) take an optionalon_host_decision. Only the spawn gate's dashboard-only fallback inturn_approvals.pypasses it, so every other caller (tool prompts, task runner gates, cron, the dashboard half of the owner-DM race) still reads an expiry and a cancel asFalse. The channel seam'sunpressed_wait_answer(messaging/spawn_approval_delivery.py) returnsHostSpawnDecision(False, "approval_timeout")for an unpressed wait on a still-permitted channel, which covers both channel hooks at once; their return types name it.messagingmay not import the subagent facade, soHostSpawnDecisionmoves unchanged fromsubagent_parts/delivery.pyinto the leaf modulesubagent_host_decision.py, andsubagent.pyre-exports it. The subagent, messaging, gateway and dashboard specs say the same.Backwards compatibility
Compatible: the new keyword is optional and only the spawn gate passes it, and a
HostSpawnDecisiondecline is falsy, so every spawn that was refused is still refused and every other caller's answer is unchanged.A Stop or reap while a dashboard-only prompt is open now ends the way the same cancel already ends on Slack, Telegram and Discord: the reaper's own teardown stops and reports the run, and the gate no longer writes a
spawn rejectederror or aspawn_runrejectedaudit row for a refusal nobody made.Reader: src/kiro_crew/sel_reader.py:recent -- subagent -- the audit log loses only the
rejectedrow a cancelled dashboard-only prompt wrote; the crew log records the gate's host-attributed cancel, as on the other surfaces (test_spawn_approval_no_surface.py::TestADashboardOnlyPromptEndsAsTheHosts)Tests
test_spawn_approval_no_surface.py::TestADashboardOnlyPromptEndsAsTheHostsdrives the real gateway callback over a real dashboard wait: an expired prompt is reported as the host's withapproval_timeout, and a cancel while it is open is raised to the gate instead of answeringFalse.HostSpawnDecision(False, "approval_timeout")instead ofFalse(test_spawn_approval_delivery_governance.py,test_discord_spawn_approval_delivery.py,test_spawn_approval_delivery.py).on_host_decisionkeyword.test_messaging_commands.py::TestLayering::test_the_host_spawn_decision_comes_from_a_leaf_modulepins thatsubagent_host_decision.pyimports nothing fromkiro_crewand holds the classkiro_crew.subagentre-exports.Proof: PROVEN test/test_discord_spawn_approval_delivery.py::test_an_unpressed_wait_on_a_still_authorized_channel_still_denies, test/test_slack_gateway.py::TestInteractiveApproval::test_parent_session_routes_tool_approval_when_spawn_resolver_misses, test/test_spawn_approval_delivery.py::TestTelegramDeliveryHook::test_a_generation_rotation_between_spawn_and_press_expires_the_prompt, test/test_spawn_approval_delivery_governance.py::TestAMidWaitDenyFallsThrough::test_a_timeout_on_a_still_permitted_channel_is_a_host_decline, test/test_spawn_approval_delivery_governance.py::TestTheSeamOwnsTheReading::test_the_helper_declines_while_permitted_and_answers_none_once_denied (head 1c318ce)
Determinism: the 15 changed tests passed 20/20 at
-n0, 10/10 at-n 4 --dist loadgroup --max-worker-restart=2besidetest_spawn_approval_delivery.pyandtest_discord_spawn_approval_delivery.py, and in a shuffled order (seed 27788).Manual verification
N/A — unit coverage runs the real gateway callback over a real dashboard wait and both real channel hooks; no surface renders anything new.
Related Issues
Part of #31930
Sibling sweep
Swept: git grep -n "register_channel_delivery(" -- src; git grep -n "request_approval(" -- src; git grep -n "unpressed_wait_answer" -- src
Sibling: src/kiro_crew/telegram/dispatch/spawn_approval.py -- changed here
Sibling: src/kiro_crew/discord/transport_dispatch_spawn_approval.py -- changed here
Sibling: src/kiro_crew/subagent_manager/run.py -- tracked in #31930
Sibling: src/kiro_crew/telegram/renderer_approval.py -- not affected -- only a tool prompt's failed post marks a key undelivered; a spawn prompt posts its own card and falls through when that post fails
Pattern harvest
Rule candidate: review-prompt
Pattern: an approval wait that maps an expiry or a cancel to the same
Falsea person's Deny returns, for a caller that records who decidedChecklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)