A routed bead restarts its Worker between steps and starts extra sessions that find no work #26
Loading…
Reference in a new issue
No description provided.
Delete branch "worker/gascitypacks-ad5"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
mol-worker-workis now one step with six parts instead of six steps, so a Worker session holds an in-progress step from claim to hand-over. gc stops a session that holds no step (the gap between two steps) and wakes a fresh Claude for the next one, and its demand count could also start extra pool sessions at each boundary. A held step is assigned work the whole run, so one routed bead costs one session.roles/formulas/mol-worker-work.toml: steps merged into Parts 1 to 6 of stepwork, plus aHaltingsection. The step closes once as passed (Part 6) or as failed (halt). A Resuming note tells a restarted Worker to read the worktree and never re-run Part 2, which resets the branch.gc hook --claim --drain-ack --json, so a seat that finds nothing is stopped by gc instead of lingering as phantom capacity. The skill tells the Worker to hold the step and what"action":"drain"means.tests/gnu-tools.shfollows the Part 2 rename.tests/formula.shnow asserts a single step, Parts 1 to 6 and Halting in order, exactly onegc.outcome=pass(Part 6) and the fail close in Halting, no earlydrain-ack, the Resuming guard, the worktree check first in Parts 3 to 6, and--drain-ackin the nudge and skill.Verified:
tests/formula.sh(underenv -i; this checkout predates the--citypin, so a Worker'sGC_*env made gc compile the city's cached roles pack),worktree-setup,worktree,gnu-tools,merge,upgrade,view-beads,view-mail,gc lint .and the changelog v1 checker (valid=true) all pass. Govetandtestforforgejo/pass.Bead: gascitypacks-ad5
Reviewed at
03944cc7b5and merged as501562b445. The fix is right and I found it safe for every Worker. The cause it names for the first effect is not the one the city's log shows, and the upstream write-up the bead asks for is not in the pull request; both are below, and the first must be corrected in the repository before the next release. The Worker's fuller draft of the summary, with line references and a text for upstream, stayed in its worktree and never reached the pull request; its first cause and the first two items of its upstream text are the ones corrected here.What I checked
lint,scriptsandchangelog, all successful.mainwas still ata02b60b, so the squash is the head's tree. On it I ran what.forgejo/workflows/test.yamlruns:gc lint .with gc at the city's pin,tests/formula.sh, the seven script tests,go vetandgo testinforgejo/, and the checker the changelog action runs (1.6.0): valid, and no release is due.tests/formula.shfails withmain's formula, agent or skill, andtests/gnu-tools.shwithmain's formula.tests/formula.shalso fails on a close as passed in Part 4, a drain-ack in Part 4, no Resuming note, no worktree check in Part 5, a second step, no close in Part 6, a bare claim left in the skill, and a halt that does not detach. It does not notice Part 6 withoutgc runtime drain-ack, or the close moved to the top of Part 6.Causes
The city runs the v2 reconciler: every session pass in the trace is a
v2-pass, and the session rows carrywork_ladder.session_reconciler.goandsession_wake.go, which the README names for the stop, are the legacy reconciler's.no-wake-reasondrain. At each boundary the pass woken by the close admits astopwith no drain begun (22:01:16.113Z, 7 ms afterexecution.step_completed), and the session row gets the restart hand-off anchored to the next step:continuation_reset_pendingtrue,reset_committed_at, a newsession_key,currently_processing_bead_idfrom gcg-67587 to gcg-67588,stateasleep. The controller therefore did read the next step as the session's work. In the code:gc hook --claimpins the group's open siblings to the claiming session (cmd/gc/cmd_hook_claim.go:2186-2252). When a step closes, the next one is assigned work that is not the row's current bead, which setsRequiresFreshCycle(cmd/gc/compute_awake_set.go:585-587). Forwake_mode = "fresh", A13 then stops the session and hands it to a new conversation, unless the session has already claimed that bead itself (cmd/gc/reconcile_arms_fresh_cycle.go:29-78,cmd/gc/reconcile_arms_lifecycle.go:163-176). What holds of the pull request's reading: no Worker acknowledged anything, and every finalized stop is recorded as "drain acknowledged" (cmd/gc/reconcile_effect_stop.go:556-570). A realno-wake-reasondrain looks different in the log:drain_intent_reasonon the row, thendraining, two to three minutes after a redundant seat drained.cmd/gc/demand_claimed_work.go:11-48): each was created right after a first step closed, from a demand reading 10.8 s and 25.3 s old. The other five (gcg-67590 twice, gcg-68613, gcg-68611, gcg-68615) cannot be: those steps were pinned to the Worker before they were ever ready, so no read of ready rows lists them, stale or not. All five were created in the pass in which the Worker's fresh-cycle stop landed, or in the next one (22:01:28.094Z, 22:04:18.870Z, 22:05:37.007Z, the last with a demand reading 3 s old). The code that fits iscmd/gc/pool_desired_state.go:455-491: for a fresh-mode pool, work assigned to a session whose row is asleep plans a clean session for that work, and the hand-off leaves the row asleep (cmd/gc/reconcile_arms_lifecycle.go:174). The trace does not name the tier, so this attribution is by reading.no-wake-reasondrain on it three times and cancelled each as demand appeared (23:06:59, 23:07:46, 23:07:48 CET), then wrote nothing to its row for 28 minutes. An awake seat without work stands for new demand (cmd/gc/compute_awake_set.go:381-401,cmd/gc/pool_desired_state.go:588-663and850-920), and its trigger was never bound to the new step, so no claim nudge was due (cmd/gc/warm_bind_nudge.go:121-216). Why v2 did not bind it I could not settle by reading.Does the change remove them
implementand not closed its step; each closed it within six seconds of the nudge. Nothing is closed or claimed between parts any more, and the one close is a script in Part 6. A Worker can still end its turn inside the step. It then holds the step and waits for a nudge, as now, and a claim it runs when nudged returns that step.I walked the first claim, a restart and re-claim, the drain, Part 6, a halt, a rework round, two beads routed at once and the city's pool of one. I found no path on which a Worker now lingers with a seat, exits holding a claimed step, takes a step of another bead, or waits forever. A claim repeated in the middle of the step returns the step: the adoption tier runs first (
cmd/gc/cmd_hook_claim.go:617-635), the drain-ack fence answersworkwithstarted_claim_held(2008-2043), andgc runtime drain-ackrefuses a seat's own acknowledgement while it holds started work (cmd/gc/cmd_runtime_drain.go:954-979). gc's own graph worker starts with the same claim (internal/bootstrap/packs/core/assets/prompts/graph-worker.md:19).To correct before the next release
README.md:38,CHANGELOG.md:12,roles/formulas/mol-worker-work.toml:4-8and80-82,roles/agents/worker/skills/worker/SKILL.md:15andtests/formula.sh:4-5. gc does not stop a session for holding no step. It restarts a fresh-mode session whose next step is not one it claimed itself, and it plans a clean session while that session's row is asleep. A changelog entry is frozen once its version is tagged, so this comes before the release.tests/formula.sh: assert that Part 6 runsgc runtime drain-ackafter the close, and that nothing but the acknowledgement follows the close.roles/formulas/mol-worker-work.toml:84-90: say that Part 1 runs again after every restart, since the context is new, and that a Worker goes from one part to the next without ending its turn.roles/commands/worktree/check/help.md:5still says that a step ofmol-worker-workruns the check.gc bd showprints it, and the default limit on the output of a Bash call in Claude Code is 30,000 characters. Keep the formula under it.For gc, as it can be filed
Against gc 6bd609f5bfb4, v2 reconciler, a pool agent with
wake_mode = "fresh".gc.continuation_groupwithgc.session_affinity = "require".gc hook --claimpins the open siblings to the claiming session (cmd/gc/cmd_hook_claim.go:2186-2252). When step N closes, step N+1 is the session's assigned work and not itscurrently_processing_bead_id, soRequiresFreshCycleis set (cmd/gc/compute_awake_set.go:585-587) and A13 stops the session and starts a new conversation (cmd/gc/reconcile_arms_fresh_cycle.go:29-78). The pass is woken by the close, 7 ms later in our trace, so the session never claims first: four to five fresh model starts in a six-step run, each without the context the group exists to keep. Expected: no cycle onto a bead of the same root and continuation group as the bead the row is processing.current_claim_bead_idis written; the stop lands at 22:55:16.212Z, nine seconds into the step. The effect's fresh read looks only at the previous bead (cmd/gc/reconcile_effect_fresh_cycle.go:30-67). Expected: decide the guard ofreconcile_arms_fresh_cycle.go:35again on the fresh row before the stop.cmd/gc/pool_desired_state.go:455-491plans a clean session for work assigned to an asleep fresh-mode row. The fresh cycle's hand-off writesstate = asleepwithcontinuation_reset_pending(cmd/gc/reconcile_arms_lifecycle.go:163-176) and the same row is started again a pass later, so the clean session finds the work assigned and drains:session.demand_claim_divergence,benign, trigger statusopenorin_progress, five of seven in our window. Expected: no such request while the asleep row carriescontinuation_reset_pending.cmd/gc/demand_claimed_work.gocuts the rows the claim read shows assigned; a closed step is in neither read. Two of seven in our window, from readings 10.8 s and 25.3 s old.gcg-session-d1d096abb0a6ed97200cf9be8f9a5cafansweredno_workat 22:05:46Z without acknowledging. Itsno-wake-reasondrain was begun and cancelled three times as demand appeared; then nothing was written to its row for 28 minutes while a step stayed ready, routed and unassigned, and no other seat was started. Itsgc.trigger_bead_idkept naming a closed bead. Expected: bind the seat to the new work and nudge it, or do not count a seat that answereddrainas capacity.session.stoppedsays "drain acknowledged" for every finalized stop (cmd/gc/reconcile_effect_stop.go:556-570), the fresh cycle included, where nothing was drained or acknowledged. Expected: the stop's own reason.gcg-session-f64b84e70935f068566f17c8c93fbedeandgcg-session-0be00b9f90dff61dcc3d73e9788d02f8each ended a turn with the step's work done and the step not closed, and sat at the prompt, 11 and 16 minutes by the Operator's observation, until a nudge by hand at 23:08Z. For the 19 and 18 minutes they held the claim, the ladder entry stayed atrung: started,attempts: 0,next90 s after the claim. Why the ladder did not nudge I could not settle by reading.When the city takes the release
execution.step_startedandexecution.step_completedfor the step whosegc.step_refismol-worker-work.workthere is nosession.stopped, and the row keepsgeneration2 withcontinuation_reset_pendingnever true. Not gone: asession.stoppedinside that span, or a secondexecution.step_startedfor the same step.session.createdfor each routed bead and nosession.demand_claim_divergence. Not gone: that event. Itstrigger_status_at_drainsays which kind:closedis the stale probe after a short run,in_progressa clean session planned while the Worker restarted.session.demand_claim_divergenceis followed, for the same session, bydrain_ack_aton its row andsession.closedwithin about a minute. Not gone: nosession.stoppedafter it,drain_intent_reasonset and cleared on its row, or aworkstep ready, routed and unassigned for more than five minutes while a session of its pool is active.Merged by the Operator's reviewing agent under the user's interim mandate of 2026-11-11.