Repository navigation
fix(work-ledger): dispatch (bind, session_create) always arms or reports a patrol - #19742
Conversation
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: |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that a terminal-stopped loop someone else armed on the slot, such as a channel or dashboard PR watch, should be silently replaced by the default patrol. [DESIGN-REVIEWED] 62852e7 Description read[DESCRIPTION-READ] 6c1797c411e2cbf0887b25e5de35c2b04089cb359080a4623b636316a3eeb964 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 to check. What this change shipsInventory (10 items) — 10 justifiedIntent: a conductor that dispatches more work (by bind or session_create) always ends up with a patrol reading its workers, or the same reply tells it why there isn't one. This is a FIX (#19741), plus phase-2 additions that
[FIRST-PRINCIPLES-REVIEWED] 62852e7 Description read[DESCRIPTION-READ] 6c237ca7bde40948f62fbba3566283e27c653d9af48c5b51753e62342fe92216 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: |
a50c998 to
b1bb640
Compare
b1bb640 to
9910885
Compare
9910885 to
9f51d5d
Compare
|
Dispositions for the review lanes on
|
|
Dispositions for Design CONCERNS on
|
9f51d5d to
b9bf536
Compare
…orts it A bind arms the default work-ledger patrol when the conductor holds no ACTIVE loop. An inactive loop the system stopped (its subject went terminal, a bound ran out) counts as none and is replaced, whoever armed it. A loop a person stopped is kept and the arm is refused with reason user-stopped. An active loop is left alone. The member-slot outside-arm refusal is unchanged. The bind route now returns patrol_reason next to patrol, and the MCP reply renders patrol=<outcome> (<reason>) plus the arm-yourself note on every bind. A reply missing the field reads patrol=unknown with the note. The goal-conductor skill and the member operating-mode block state the rule once: dispatch means monitor, default watch="work-ledger". Fixes #19741
b9bf536 to
7f2a169
Compare
A create is a dispatch. After a create commits (not a dry run), the route runs the same conductor_patrol.ensure_patrol on its caller and returns patrol, patrol_reason and patrol_note. The session_create MCP reply ends with patrol=<outcome> (<reason>), shared with the bind reply through conductor_patrol.reply_line. A caller that holds no work ledger gets nothing armed (no-ledger): a work-ledger watch would read nothing and fire on its timer, so the reply tells it to arm a loop on the session it opened instead. A crew/member caller is still refused as an outside arm: the route has the session key, not the turn, so it cannot tell the member's own turn from a cron, app or sub-agent turn on the same key. The member arms its own loop with monitor_start, as its operating-mode block says. Refs #19741
7f2a169 to
62852e7
Compare
|
Dispositions for the lanes on
|
…erged Six RFC index rows describe an implementation PR that has since merged or died. Merged: consolidation-fresh-conversation (kirodotdev#22207), crewmate-dashboard-upkeep-skill (kirodotdev#19069, kirodotdev#19866), conductor-default-patrol (kirodotdev#19742, kirodotdev#27948) and terminal-exit-closes-tab (kirodotdev#14511). Closed unmerged: conversation-trust-follows-founder (kirodotdev#13109) and workflow-library-removal (kirodotdev#19040), whose rows still call them open. Merged rows lead with what landed and relabel the old "Verified at" sentence as the baseline. For the two closed PRs the row keeps its original text behind an update line that says the PR is closed and that the feature is still not on main, since only a maintainer can re-judge the in-progress status. Only one symbol per row was re-checked, at d775742, and the row says which. Two documents now list their PRs in implementation-prs.
…erged Six RFC index rows describe an implementation PR that has since merged or died. Merged: consolidation-fresh-conversation (kirodotdev#22207), crewmate-dashboard-upkeep-skill (kirodotdev#19069, kirodotdev#19866), conductor-default-patrol (kirodotdev#19742, kirodotdev#27948) and terminal-exit-closes-tab (kirodotdev#14511). Closed unmerged: conversation-trust-follows-founder (kirodotdev#13109) and workflow-library-removal (kirodotdev#19040), whose rows still call them open. Merged rows lead with what landed and relabel the old "Verified at" sentence as the baseline. For the two closed PRs the row keeps its original text behind an update line that says the PR is closed and that the feature is still not on main, since only a maintainer can re-judge the in-progress status. Only one symbol per row was re-checked, at d775742, and the row says which. Two documents now list their PRs in implementation-prs.
…erged Six RFC index rows describe an implementation PR that has since merged or died. Merged: consolidation-fresh-conversation (kirodotdev#22207), crewmate-dashboard-upkeep-skill (kirodotdev#19069, kirodotdev#19866), conductor-default-patrol (kirodotdev#19742, kirodotdev#27948) and terminal-exit-closes-tab (kirodotdev#14511). Closed unmerged: conversation-trust-follows-founder (kirodotdev#13109) and workflow-library-removal (kirodotdev#19040), whose rows still call them open. Merged rows lead with what landed and relabel the old "Verified at" sentence as the baseline. For the two closed PRs the row keeps its original text behind an update line that says the PR is closed and that the feature is still not on main, since only a maintainer can re-judge the in-progress status. Only one symbol per row was re-checked, at d775742, and the row says which. Two documents now list their PRs in implementation-prs.
Problem / Motivation
Goal: a session that dispatches work always ends up with a patrol reading its workers, or is told in the same reply why it has none.
A conductor's own
monitor_startloop (watch="work-ledger") stopped withmonitor_terminalwhen every ledger item closed. The conductor then created and bound new items. Eachwork_ledger_record action=bindreply readRecorded bind. item=... state=open verdict=(none)and nothing more. No patrol was re-armed, so the new workers' reports went unread until a person noticed.Why it matters
The maintainer rule is: whenever a conductor or crewmate dispatches work, the dispatching session MUST have a monitor running, on every backend. Today a conductor whose loop finished one round dispatches the next round with nobody watching, and the tool reply hides it.
Not a goal
What changed (motivation → approach → change)
Symptom → cause, both reproduced by failing tests before the fix (
test/test_bind_patrol_rearm.py):conductor_patrol.ensure_patrolre-armed a stopped loop only when it was the gateway's owndefault_patrol. A conductor's own loop stoppedmonitor_terminalansweredexisting, and no arm was attempted.mcp_workbuilt the bind reply fromitemalone, so the route'spatrol/patrol_notenever reached the agent, though the tool description promised them.Change:
ensure_patrolreturns(outcome, reason):unsupported (no-ledger)armed (no-loop)_stopped_row_is_replaceableallowlist a directive re-arm already uses) → replaced,armed (replaced-system-stopped)refused (user-stopped)existing (active-work-ledger | active-other-watch)refused (outside-arm-refused), gate unchangedpatrol_reasonnext topatrol.session_create(POST /api/session-control/create, not a dry run) is a dispatch too and runs the sameensure_patrolon its caller, with the same fields.patrol=<outcome> (<reason>)plus a note when no work-ledger watch is active (conductor_patrol.reply_line,patrol_note). A reply missing the field readspatrol=unknownwith the note.monitor-architecture.md) updated to match; the RFC text is main's.Why a member cannot be self-armed from these routes: the member-slot gate admits only a SELF-arm, proven by
initiator_slot_key. Onlysession_directive_applysupplies it, for a human-started turn or the slot's own loop wake. The bind and create routes see the kernel-verified session KEY, not the turn, and a cron injection, an app-driven turn or a sub-agent on a member slot sends the same key. Reaching the directive path from bind/create would mean addingwork_ledger_record/session_createtosession_directive.DIRECTIVE_TOOLS(pinned toCORE_MCP_SERVER) and teachingmcp_core.derive_directiveto derive without re-running the call, since today it re-runs the tool, which would replay a side-effecting bind or create. That is a change to the directive provenance gate, so it is left out.Product shape: implements phase 2 (section 9) of
docs/request-for-change/rfc-conductor-default-patrol.md, revision v2, statuspartial, merged on main by #19893. That RFC records the system-stopped re-arm, arming onsession_createwhen the caller holds a ledger, the no-ledger note, the reply reason, and option D as out of scope (section 9.6). This PR does not edit the RFC.Backwards compatibility
Compatible: the bind and create replies gain fields and a trailing line; no field is removed or renamed, and every request main accepts is still accepted.
Removes nothing: no route, field, record or capability is taken away. A person-stopped loop is still never revived; only its reported outcome moves from
existingtorefused (user-stopped).Tests
test/test_bind_patrol_rearm.py(new): a system-stopped own loop is replaced on bind; a user-stopped loop is refused, not re-armed; an active loop is left alone; no loop arms one; a crew/member slot refuses the outside arm with its reason; the realAutoNudgeServiceadmits the default over a finished own loop; the bind MCP reply always carries the outcome, including a reply missing the field.test/test_session_create_patrol.py(new): the create route arms for a ledger-holding caller, replaces a system-stopped loop, leaves an active one alone, refuses a crew/member caller and writes no loop on it, arms nothing for a ledger-less caller and keeps its stopped row, arms nothing on a dry run; the create MCP reply ends with the outcome.test/test_conductor_patrol.py: person-stopped rows now answerrefused (user-stopped).test/test_context_composition_contract.py: member-mode golden re-pinned for the one added clause.Manual verification
N/A — unit coverage drives the real route handlers, the real authorizer and the real loop store. The arm path reads the slot key, mode and memory mode only, never the backend, so the result is the same for every backend.
Related Issues
Fixes #19741
Pattern harvest
Rule candidate: review-prompt
Pattern: an MCP tool reply formatted from a subset of the route's response silently drops fields the tool description promises; assert every documented reply field reaches the rendered text.
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.