Repository navigation
feat(crew): release a crewmate's stale workers and resume them on send - #23574
Conversation
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The fix items resume or wake the worker on their own. The dashboard moon marker has no named person it helps. Notes
What this change shipsInventory (5 items) — 3 justifiedIntent: a crewmate's idle or archived workers pick their conversation back up and still report back to it. This is an ADDITION (a fix shape on top of #23010).
[FIRST-PRINCIPLES-REVIEWED] 1fbf8ed Description read[DESCRIPTION-READ] 72c689082fe953c48fd7a182b70f0c3bf2014a03c834e119db5e18baf4357226 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: each of the three stale-worker failures gets a fix that goes through existing code ( Notes
[DESIGN-REVIEWED] 1fbf8ed Description read[DESCRIPTION-READ] df7bcaf67f509bedfa2bd3500e43bed45b41b9f810baa63be8c6ec053f43ab35 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 |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks. The one new element, the moon marker, appears in both screenshots, and the blind reader got its meaning right ("asleep, paused or inactive"), though they rated that only a guess. Notes
[UX-REVIEWED] 1fbf8ed Description read[DESCRIPTION-READ] c1798f2fdde9a0d1b2889a22b16470858fd0b93f68e027d850ddca77f4b15340 That sha256 names everything this verdict read: the PR description, plus the 5 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 findings (all downgraded on adjudication)GPT 6.1 flagged blocking issues on This comment is updated in place on each push. Review detailsBLOCKING -- src/kiro_crew/dashboard/state_parts/slots_frame.py:821 -- Idle expiry leaves the worker’s sidebar state stale
Adjudication (Opus 5.5) — is blocking on each finding proportionate?F1 (LOW): the only effect is that the sidebar does not show the asleep (moon) icon for a while. The worker still resumes correctly on the next send whatever the icon shows. Conditions I confirmed: the idle sweep removes the session at False positive or not applicable? A repository writer can comment: |
3d225cc to
be47107
Compare
No cap on how many workers a crewmate opens; a stale one is handled: - session_send from a crewmate's conductor to an archived worker of its own revives it first, under session_revive's ownership fence, then sends. A refused revive, and every other caller, keeps target_not_found. - After a restart or a revive, the crew log's gateway-written lineage naming the crewmate thread lets the worker report back (mate_thread_wakes._lineage_names); transcript metadata alone wakes nobody. - session_status rows carry process: live | released, read from SessionManager.has_session; a worker tab shows a released one with a marker, even on a row with no activity time. Updates session.md, crew-mode.md and session-control.md.
be47107 to
1fbf8ed
Compare
Problem / Motivation
Goal: A crewmate can open as many workers as its work needs, and a worker that went idle or was archived picks up again on the crewmate's next message and still reports back.
With the crewmate conductor/worker split (#23010), a crewmate hands each job to a worker session it opens. Three things go wrong once those workers age:
session.timeout_secshas its process stopped by the idle sweep. Nothing tells the crewmate (or the user) that the worker is stopped rather than gone, so it opens a fresh worker instead of resuming the one that holds the context.dashboard.idle_slot_sweep_daysis archived like any tab. The crewmate's nextsession_sendto it answerstarget_not_found, so the conversation and its kit are abandoned._lineage_minted/_reports_to_creator) is gone, so a restored worker's turn end no longer wakes the crewmate's thread: the report is silently lost.Why it matters
Every crewmate that runs longer than an hour hits the idle sweep. Without this, a crewmate either piles up duplicate workers or loses the report of a worker that finished after a restart, and the user sees a crewmate that stopped answering about work it delegated.
Not a goal
max_memory_mb.session_sendto a closed session keepstarget_not_found.session_revive's ownership fence.What changed (motivation → approach → change)
handlers/session_control.api_session_control_sendfirst callssession_revive.revive_own_archived_worker. It acts only when the caller's attested record is a crewmate conductor (mate_worker.is_conductor_execution) and the target is not open, and it runs the existingrevive_session, so revive's own fence still decides: the caller must have created the session AND the gateway-written lineage must name it as parent. A refusal keeps the target as given, so the send answers exactly as before.mate_thread_wakes.reporting_creatoraccepts the crew log's session tree (_lineage_names, viasession_tree._slot_tree_parent, gateway-written at the child's first turn) as the witness when the in-memory one is gone. A_created_byread from transcript metadata alone still wakes nobody.process: live | released.session_status.process_statereadsSessionManager.has_sessionon the slot's effective key.created_session_statusrows carry it, andslots_frame.serialize_slotadds it to worker tabs (slots withcreated_by).SessionRowshows a moon marker (session-row-released, "Asleep: wakes on the next message") on a released worker, also on a row with no activity time.crew-mode.md(stale workers released, not capped; the lineage fallback),session-control.md(revive on send; theprocessfield),session.md(idle cleanup of a worker session).Backwards compatibility
Compatible:
processis a new optional field onsession_statusrows and slot payloads;session_sendonly changes for a conductor whose own archived worker passes revive's fence, where it previously answeredtarget_not_found.Removes nothing: the change adds a field, a marker and a revive path; no field, route, record or reader is narrowed.
Tests
test/test_crewmate_stale_workers.pytest_an_idle_worker_is_released_then_resumed_in_the_same_conversation: the idle sweep releases the worker's process,process_statereadsreleased, the conversation pointer is kept, the next turn cold-starts the same key asking to resume that sid, and the worker's kit still comes from the same execution record.test_a_conductor_messaging_its_archived_worker_revives_it_first: the conductor's send revives its own archived worker first.test_a_refused_revive_and_any_other_caller_keep_target_not_found: a refused revive and a non-conductor caller keeptarget_not_found.test_a_restored_worker_reports_when_the_lineage_names_its_crewmate: the crew-log lineage stands in for the in-memory witness.test_transcript_metadata_alone_still_wakes_nobody: transcript metadata alone still wakes nothing.website/src/test/ChatSidebar.releasedWorker.test.tsx: the marker shows on a released worker with its accessible name, not on a live worker or an ordinary session, and also on a row with no activity time (reddens when the meta-group gate dropss.process === 'released').Manual verification
Rendered the built SPA (stubbed API) with a creator, a live worker, a released worker and an ordinary session, in light and dark: only the released worker carries the moon marker, beside its timestamp.
Screenshots / video
Light and dark, flat sidebar: the third row is a released worker.
Related Issues
Follows #23010.
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.