Repository navigation
feat(dashboard): name what keeps a slot attached in its 409 - #22272
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
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: |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the change only adds fields to the existing 409 body, read after the verdict, and each read fails on its own field without changing the refusal. Notes
[DESIGN-REVIEWED] bda9220 Description read[DESCRIPTION-READ] 18ea0904890ed8de82d9bb9689375bdda3da8781fb1b5c30b7f27b63390644de 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 Nothing blocks. The new 409 fields have no reader in the code yet, but the description says so and defers rendering to #22357. The fields are additive and easy to remove. Notes
What this change shipsInventory (8 items) — 7 justifiedIntent: a user whose slot keeps refusing with "sub-agents are running" can see which run or row is holding it. This is an ADDITION (diagnostic detail on an existing refusal).
[FIRST-PRINCIPLES-REVIEWED] bda9220 Description read[DESCRIPTION-READ] 303b6df6dbabcc501836b7cf7b68ff6ba8f64a0b16d9fc4d79962a0190a01c4e 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: |
b3fc518 to
69a9433
Compare
|
Dispositions for the advisory findings on b3fc518; addressed in 69a9433 (the branch is squashed to one commit, per the two-commit gate). First Principles, item 3 (the queued read duplicated First Principles, item 6 (the Design Review (a fourth source added to the predicate would refuse while naming nothing): the |
|
Dispositions for the advisory notes on 69a9433 (Design PASS, First Principles CONCERNS): First Principles, item 1 (no in-repo reader of the new fields): not changed. #22248 asks for exactly this body ("Done when: the 409 body carries these beside the existing First Principles, item 2 ( Design Review (a stopped |
iamwhatever
left a comment
There was a problem hiding this comment.
REQUEST_CHANGES (tracking issue needed) at 69a9433.
The change is safe. The detail is read only after the unchanged verdict (slot_guards.py L62). It carries ids and states only. A failing read degrades its own field, because _queued_runs already returns a partial listing on error. Continue passes the guard's response through unchanged. CI is green, and the AI items have reasoned replies.
One deferred item has no issue. The Goal says a user whose slot keeps refusing can see what to stop, but nothing in the product shows the new fields: the dashboard only checks the code string (useSessionActions.ts L391), and session-control maps the refusal to target_busy. Your reply calls rendering them "a UI choice for a separate change", but I found no open issue for it. Please open one for showing these fields to the user, and link it in the PR description.
— crew-pr-reviewer (r113)
|
Thanks. Opened #22357 for showing the new 409 fields to the user: in the dashboard (the session reload error handler in |
69a9433 to
bda9220
Compare
iamwhatever
left a comment
There was a problem hiding this comment.
APPROVE at bda9220.
The r113 item is cleared: showing the new fields to the user is tracked in #22357, which covers both the dashboard handler and session-control, and it is linked in the description. This head is a rebase of 69a9433 with an identical patch.
The change is safe. The detail is read only after the unchanged verdict (slot_guards.py L61-L75), carries ids and states only, and a failing queued read becomes a partial listing (run_control.py L81-L96). Continue passes the guard's response through unchanged. Every AI lane on this head is clean or answered, and all checks are green.
— crew-pr-reviewer (r125)
Problem / Motivation
Goal: The
slot_subagents_running409 says which runs and task rows keep the slot attached, so a user whose slot keeps refusing can see what to stop.Every guarded slot action (Continue, reload, agent, model, effort and workspace switches, reset conversation, edit-resend) answers
409 {"error": "sub-agents are running", "code": "slot_subagents_running"}while the session has children. The body names nothing. When the guard holds because of a row that will never finish (#17158: a stopped sub-agent parked inretry_wait), the user cannot tell which of the session's runs or rows is responsible, andkirocrew spawnhas onlyrunandlist.Why it matters
A slot that refuses forever with no name attached leaves the user guessing, or editing the task store by hand.
Not a goal
chat_utils.subagents_attached_async) is unchanged.errorstring andcodestay as they are, so no copy or locale changes. Showing them to the user is tracked in Show what keeps a slot attached when a guarded action is refused (dashboard and session-control) #22357.target_busyerror and keep doing so. Carrying the detail there is part of Show what keeps a slot attached when a guarded action is refused (dashboard and session-control) #22357 too.What changed (motivation → approach → change)
Gap: the refusal is built from a boolean, so it has nothing to name. Approach: after the verdict, read each of the three sources the predicate itself reads and put them in the body, reusing the reads that already exist.
dashboard/chat_api/slot_guards.py:_subagents_attached_responsekeepserrorandcodeand adds the result of a new_subagents_attached_detail:runs: the unfinished in-memory runs fromrunning_agents_for(the summary the guard already reads), as{id, state}withstaterunningorstalled;nullwhen that probe could not answer, the case the guard fails closed on.queued: the accepted spawns with no run yet, read throughhandlers.messaging._queued_runs(the helperGET /api/spawn?queued=1already serves the listing with: task-store rows plus window entries with no row), as{id, state}.queued_partial: that listing's own flag, true when it is capped or its read failed.deliveries_inflight: the slot's_subagent_deliveries_inflight.subagent_manager/admission/types.py/taskq_bridge_reads.py:QueuedRungainsstate, the task-store state of the row it was read from (queued,retry_wait,recovering,admitted), empty for a window entry with no row (the 409 shows that asqueued).GET /api/spawnbuilds its payload field by field, so its wire shape is unchanged.dashboard/chat_api/continue_turn.py: Continue turned the guard's response into aSlotContinueRefusal(message, code)and rebuilt a two-field body, which dropped any extra field.SlotContinueRefusalnow carries the guard's own response (response=), and the Continue endpoint returns it as is. Session-control'sretry_targetstill reads onlymessage,codeandstatus.code, the shape the error-code contract ratchet (test_error_code_contract.py) requires.dashboard/chat_handlers.pyimports_subagents_attached_detailbeside the otherslot_guardsnames: composed owner functions read the facade's globals, so_subagents_attached_responseresolves it there.dashboard/chat_utils_completion.py: thesubagents_attacheddocstring says a new probe needs a field in_subagents_attached_detailtoo.docs/system-specs/modules/session.mddescribes the body.The body carries ids and states only: no task text, agent name or result. It is read after the verdict, so a run that ended in between is simply absent, and a read that raises costs its own field, never the 409.
Exposure: no route, listener or auth check changes. The fields go only to a caller that already passed the route's own auth and slot/app ownership checks, and they name only that slot's session's children.
Backwards compatibility
Compatible:
error,codeand the 409 status are unchanged, and the new fields are additions a client that reads onlycode(the dashboard, session-control) never sees.Removes nothing:
QueuedRungains a defaulted field andSlotContinueRefusala keyword-onlyresponse; no key, field, function or validator is removed or tightened.Tests
Failing first on origin/main de80cdc (all six red), passing with the change (
test/test_slot_subagents_running_detail.py):test_the_409_names_each_unfinished_run_and_its_state: two running runs, one stalled, throughPOST /api/chat/slots/{slot}/continue; the body names both with their state,errorandcodeare unchanged, and the runs' task text and agent name are not in the body.test_the_409_names_each_queued_row_with_its_store_state: aretry_waitrow and a window entry come back asretry_waitandqueued, with the listing'spartialflag.test_the_409_counts_the_deliveries_still_in_flight: no runs, no rows, two deliveries in flight.test_an_unanswered_probe_reads_as_unknown_and_still_refuses: a failed running probe givesruns: null, and a registry whose listing read fails givesqueued_partial: true.test_a_listing_that_raises_costs_its_field_not_the_refusal.TestAgainstARealStore::test_a_parked_row_with_no_run_is_named_with_its_store_state: a realSubagentManagerand task store; a row claimed, started and released toretry_waitwith no registered run is named{"id": "parked0", "state": "retry_wait"}.Run locally: every test file that names
slot_subagents_running,_subagents_attached_response,SlotContinueRefusal,QueuedRun,queued_runs_asyncor the queued-run reads, plus the chat-handlers, chat-utils, handlers-messaging and subagent-parts composition contracts, the taskq bridge bindings, the store-off-loop glue suite and the Static Ratchet Gate's files (1795 passed). black, isort, flake8 and mypy on the touched files; the comment-history, brand, feature-map, harness-parity, memory-store-seam, loop-bound-locks, testpaths-coverage and docs-lint gates.Manual verification
N/A: unit coverage sufficient. The endpoint tests drive the real Continue route through aiohttp's test server, and one test reads a real task store through the real registry.
Related Issues
Fixes #22248
Follow-up: #22357 (show these fields to the user in the dashboard and session-control).
Pattern harvest
Not generalizable: one refusal body gains the facts its own guard already reads.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.