Skip to content

Commit 8c38173

Browse files
committed
fix(session): reset stopping counter on fresh turn, run vote interruptibly
1 parent 6d892ff commit 8c38173

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

  • packages/core/src/session/runner

‎packages/core/src/session/runner/llm.ts‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,12 @@ const layer = Layer.effect(
134134
step = 1
135135
// Fresh input starts a new turn; an empty inbox is the
136136
// would-be-idle observation just before a vote, which must
137-
// keep the count of the turn that ran.
137+
// keep the count of the turn that ran. Moves and compactions
138+
// carry the count across the handoff, and granted steers never
139+
// reach here (delivery "steer").
138140
if (pending !== undefined) executedSteps = 0
141+
if (pending !== undefined && pending.type !== "move" && pending.type !== "compaction")
142+
stoppingContinuations = 0
139143
}
140144
if (pending?.type === "move")
141145
return DrainResult.Moved({ continuation: continuing ? { step, stoppingContinuations } : undefined })
@@ -189,10 +193,11 @@ const layer = Layer.effect(
189193
continue
190194
}
191195
if (!force && !continuing && (!pending || (pending.delivery === "queue" && promotable === "steer"))) {
192-
// Already inside advanceToStep's uninterruptible mask. Like the
193-
// compaction precedent below, continue loops back to promotion.
194-
// The increment funds exactly the steer just admitted.
195-
if (yield* maybeContinueStopping(sessionID, executedSteps, stoppingContinuations)) {
196+
// The vote runs interruptibly so untrusted voters can't stall
197+
// abort/shutdown; only the drain-state mutation below stays masked.
198+
// Like compaction, continue loops back to promotion, and the
199+
// increment funds exactly the steer just admitted.
200+
if (yield* restore(maybeContinueStopping(sessionID, executedSteps, stoppingContinuations))) {
196201
stoppingContinuations++
197202
continue
198203
}

0 commit comments

Comments
 (0)