Repository navigation
feat(session-control): session_continue picks up a peer session's cut-short turn - #19590
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Before merge, check one thing: a patrol that calls Suggestions
[DESIGN-REVIEWED] c7beb6f Description read[DESCRIPTION-READ] 8f0375aa3e187bbf3674f728cf0188b18a712138e19d3cf8cfcc819465258a55 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Check before merge: What this change shipsInventory (7 items) — 6 justifiedIntent: an agent that dispatched a worker can pick up that worker's turn after a gateway restart or a killed process cut it short, without re-sending the prompt. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] c7beb6f Description read[DESCRIPTION-READ] ef6300e0730e7492295eb178b7ea69db66c9d23512f159a2dfad6f654ed03925 That sha256 names the PR description this verdict read. 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: |
…-short turn Adds a kirocrew-dashboard MCP tool and POST /api/session-control/continue. It calls continue_slot_turn without require_interrupted, the way the Continue button does, so a force-quit turn that left no error row (and that session_retry refuses as turn_not_failed) can be picked up. continue_slot_turn now returns which body it queued, and the result and the allowed audit line report it as body=resumed|continued. retry_target and continue_target share one authorize / re-check / dispatch helper. The tool takes no prompt text, is blocked for channel agents, and is in no auto-grant tuple, so a member or conductor is asked before each call. Supersedes #15459, rebuilt on main after #15436 merged. Closes #15446 Co-authored-by: Pearce Kieser <5055971+Pearcekieser@users.noreply.github.com>
548efba to
c7beb6f
Compare
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#ce473fca]: Dispositions for the advisory notes on 548efba, plus the fix pushed as c7beb6f.
|
chenmingwei23
left a comment
There was a problem hiding this comment.
[code-review-sage]
Ship summary: no blocking issues; no must-fix or should-fix findings.
Problem: after a gateway restart or killed process, an agent that dispatched a worker has no way to pick up the worker's cut-short turn. session_retry refuses it with turn_not_failed because a force-quit leaves no error row, and re-sending the prompt duplicates it. Solution: a session_continue(target) tool and POST /api/session-control/continue route that call the same continue_slot_turn the Continue button uses, without require_interrupted. Retry and continue now share one helper (_continue_turn_of_target), so every refusal (running, queued, approval pending, sub-agents attached, session_start_repeat, relay archive, ownership fence, re-check under the slot lock) applies unchanged. The design is proportionate and the strongest alternative (extending session_retry) is correctly rejected because retry's turn_not_failed guard is deliberate.
Checked and found sound: the directive_user_origin=False path keeps agent-initiated turns from gaining the human flag; the tool takes only target, so no prompt text can be injected; the route is strict-internal; the tool is in CHANNEL_AGENT_BLOCKED_TOOLS and in no member/conductor grant tuple (so each call asks for approval); session_retry keeps its result shape and refusal codes, and only its allowed audit line gains a body detail; continue_slot_turn's new str return is ignored by the only other caller; the audit/operation naming flows through authorize_target and the re-check consistently; tool lists, schema table, titles, composition-contract pins and docs are all updated, and the PR description matches the diff in both directions. CI checks are green on this head.
Findings: none.
This is review feedback only and not an approval; the merge decision stays with the human reviewers.
CrysisDeu
left a comment
There was a problem hiding this comment.
Reviewed head. session_continue reuses session_retry's full authorize_target + under-lock re-check, refuses running/queued/approval-pending/empty, and the refusals are tested. 21 files are all registration points and pinned tables. CI green. Approving.
One wording fix, please: body == "continued" is rendered as "its last turn had ended, so it was told to carry on" (mcp_dashboard.py:2929-2931, and "ended cleanly" in docs/session-control.md). A force-quit turn leaves no error row and also yields continued, so a conductor would read a crashed worker as finished. Suggest: "no interruption was recorded, so it was told to carry on (a force-quit turn looks like this too)". Also default resp.get("body") to "" rather than the "had ended" sentence.
Posted by code-reviewer (Kiro Crew member) on behalf of @CrysisDeu. Full report on file.
Problem / Motivation
Goal: an agent can pick up a session it dispatched after that session's turn was cut short by a gateway restart or a killed process, the same way a person presses Continue.
A force-quit turn runs no cleanup, so it leaves no error row and reads like a finished turn. The dashboard's Continue control (
POST /api/chat/slots/{slot}/continue) handles it. Agents have no equivalent:session_retryrefuses exactly this case withturn_not_failed, and re-sending the prompt withsession_sendadds a second copy of the request and does not tell the model it was interrupted.Why it matters
Conductor and patrol sessions restart their workers after every gateway restart. Today they re-send the last prompt by hand, which duplicates it in the worker's transcript and makes the model start over instead of checking what it already did.
Not a goal
target.session_retry.What changed (motivation → approach → change)
The Continue endpoint already chooses between two bodies: the interrupted pick-up when
_is_interruptedsays the last turn was cut short, and a carry-on message otherwise.session_retry(#15436) reaches that samecontinue_slot_turnwithrequire_interrupted=True. The smallest correct verb is the same call without that flag, so every refusal the button makes applies unchanged.continue_slot_turn(dashboard/chat_handlers.py) returns which body it queued,"resumed"or"continued". Its only other caller, the Continue endpoint, ignores the value.retry_targetand the newcontinue_target(dashboard/session_control.py) share one helper,_continue_turn_of_target: window load, prewarm,authorize_target, the relay-archive refusal, the synchronous re-check under the slot lock, and the audit line, which now recordsbody. The two verbs differ only inrequire_interruptedand the operation name.POST /api/session-control/continue(handler indashboard/handlers/session_control.py, registered inserver_runtime/mcp_routes.py, added to_STRICT_INTERNAL_API_PATHS).session_continue(target)inmcp_dashboard.py(strict identity). The reply names the body sent. It joinsCHANNEL_AGENT_BLOCKED_TOOLS,MCP_DASHBOARD_SCHEMASandmcp_tool_titles.json.agent.py: a comment records that the tool is withheld from the conductor and member grant tuples, and why.session_continuesection in the user pagedocs/session-control.md, the tool count indocs/index.md, and rows indocs/architecture/mcp.md,docs/feature-map/README.mdanddocs/system-specs/modules/session-control.md.Supersedes #15459 by @Pearcekieser (co-author). Review of #15459: the design is right (Continue's path without
require_interrupted, report the body, one shared helper), but it was stacked on #15436, which merged reshaped (theTooltable,load_target_window, the relay-archive refusal instead ofremote_target_unsupported), so its second commit no longer applied; this PR rebuilds that commit on main and ports its tests.Backwards compatibility
Compatible: a new tool and a new route.
retry_targetkeeps its result shape and refusal codes; its allowed audit line gains abodydetail, andcontinue_slot_turnnow returns a string that the Continue endpoint ignores.Removes nothing: the diff only adds a verb and a return value.
Tests
test/test_session_control_continue.py(new, ported from #15459):body: continuedis in the result and the audit line.session_retryrefuses this same shape, so this is the case the tool exists for.body: resumed.session_start_repeat, relay archive, and a target that becomes channel-linked while the slot lock is awaited.Updated: the tool lists in
test_mcp_dashboard_registration.py,test_mcp_dashboard_folders.pyandtest_session_control.py, and the session-control group count intest_session_control_doc.py. Thesession_retrytests pass unchanged on the shared helper.Mutation check: setting
require_interrupted=Trueincontinue_targetreddens 4 tests; makingcontinue_slot_turnalways return"continued"reddens 1.Manual verification
N/A, unit coverage sufficient: the route and the tool are thin wrappers over
continue_slot_turn, which the Continue button already exercises, and the tests drive it on real slots with only the turn dispatcher stubbed.Related Issues
Closes #15446
Supersedes #15459
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.
Decision for the owner
Whether
session_continueshould join_MEMBER_DASHBOARD_GRANTSthe waysession_retrydid, so a crew member's unattended patrol can restart its own workers without an approval prompt. This draft leaves it out of every grant because, unlikesession_retry, it does not refuse a cleanly finished turn, and adding an auto-approval is a widening the owner should choose.