fix(claude): steers sent during compaction no longer abort it #25848
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- @@ -10357,4 +10357,11 @@1035710357 } satisfies PendingOrchestrationEffectV2,1035810358 ...otherProviderInterrupts,1035910359 ]);10360- return undefined;10360+ // A steer still waiting to reach the provider is cancelled, so the interrupt never queues behind it.10361+ return {10362+ effectTypes: ["provider-turn.steer"],10363+ reason: `Run ${run.id} was interrupted before its steer was sent.`,10364+ } satisfies {10365+ readonly effectTypes: ReadonlyArray<OrchestrationEffectRequestV2["type"]>;10366+ readonly reason: string;10367+ };
juliusmarminge added labelsbugfix
juliusmarminge added labelspr:gate-failed
- @@ -8259,3 +8329,5 @@82598329 yield* Ref.update(activeTurn, (current) =>82608330 current?.providerTurnId === input.context.providerTurnId ? null : current,82618331 );8332+ // After the turn is cleared, so a steer cannot be held on it once this runs.8333+ yield* dropHeldSteers(input.context);@@ -11730,0 +11811,21 @@11811+ Ref.getUnsafe(queryContext) !== existing11812+ ) {11813+ return "ended" as const;11814+ }11815+ if (11816+ currentTurn.compaction?.status !== "running" &&11817+ currentTurn.heldSteers.length === 011818+ ) {11819+ return "offer" as const;11820+ }11821+ currentTurn.heldSteers.push(held);11822+ return "held" as const;11823+ }),11824+ );11825+ if (delivery === "ended") {11826+ return yield* steerNotSent(turnInput.providerTurnId);11827+ }11828+ if (delivery === "held") {11829+ // Returning frees the thread's outbox so Stop can reach interruptTurn, which sends11830+ // held steers first. Committed now: this scope's release would otherwise drop it.11831+ pdfReservation.commit();
- @@ -7958,0 +8002,21 @@8002+ providerTurnId: context.providerTurnId,8003+ dropped,8004+ });8005+ });8006+ // Callers hold sdkMessageLock, so a newer steer cannot overtake the held ones.8007+ const releaseHeldSteers = Effect.fnUntraced(function* (context: ActiveClaudeTurnContext) {8008+ for (;;) {8009+ const steer = context.heldSteers[0];8010+ if (steer === undefined) return;8011+ if (8012+ (yield* Ref.get(activeTurn)) !== context ||8013+ (yield* Ref.get(queryContext)) !== steer.live8014+ ) {8015+ return yield* dropHeldSteers(context);8016+ }8017+ context.heldSteers.shift();8018+ yield* offerSteer({ ...steer, providerTurnId: context.providerTurnId }).pipe(8019+ Effect.catchCause((cause) =>8020+ Effect.logWarning("orchestration-v2.claude-held-steer-offer-failed", {8021+ providerTurnId: context.providerTurnId,8022+ cause: Cause.pretty(cause),@@ -11566,3 +11643,6 @@1156611643 detail: `Claude provider turn ${turnInput.providerTurnId} is not the active turn.`,1156711644 });1156811645 }11646+ // Like an unheld steer, a held one reaches Claude before the interrupt.11647+ if (currentTurn.heldSteers.length > 0) {11648+ yield* sdkMessageLock.withPermits(1)(releaseHeldSteers(currentTurn));@@ -11731 +11815,21 @@11815+ if (11816+ currentTurn.compaction?.status !== "running" &&11817+ currentTurn.heldSteers.length === 011818+ ) {11819+ return "offer" as const;11820+ }11821+ currentTurn.heldSteers.push(held);11822+ return "held" as const;11823+ }),11824+ );11825+ if (delivery === "ended") {11826+ return yield* steerNotSent(turnInput.providerTurnId);11827+ }11828+ if (delivery === "held") {11829+ // Returning frees the thread's outbox so Stop can reach interruptTurn, which sends11830+ // held steers first. Committed now: this scope's release would otherwise drop it.11831+ pdfReservation.commit();11832+ yield* Effect.logInfo("orchestration-v2.claude-steer-held-for-compaction", {11833+ providerTurnId: turnInput.providerTurnId,1173111834 });11835+ return;@@ -11731,6 +11821,17 @@11821+ currentTurn.heldSteers.push(held);11822+ return "held" as const;11823+ }),11824+ );11825+ if (delivery === "ended") {11826+ return yield* steerNotSent(turnInput.providerTurnId);11827+ }11828+ if (delivery === "held") {11829+ // Returning frees the thread's outbox so Stop can reach interruptTurn, which sends11830+ // held steers first. Committed now: this scope's release would otherwise drop it.11831+ pdfReservation.commit();11832+ yield* Effect.logInfo("orchestration-v2.claude-steer-held-for-compaction", {11833+ providerTurnId: turnInput.providerTurnId,1173111834 });11835+ return;1173211836 }11733- yield* Ref.update(steeredTurns, (current) => {11734- const next = new Set(current);11735- next.add(turnInput.providerTurnId);11736- return next;11837+ yield* offerSteer({
tanstack-source added labelsbug
juliusmarminge added labelstakeover:in-progress
juliusmarminge added labelstakeover:blocked
juliusmarminge removed labelstakeover:in-progress
Sign in to join this conversation.
Approvability#
Verdict: Needs Human Approval
Macroscope's review found this PR requires human approval — This change defers Claude steers until compaction ends. Unresolved review concerns require resolution of delivery outcomes for cancelled or dropped messages and attachment-budget handling.
Needs human approval because:
- 2 blocking correctness issues found at or above your repo's Minimum Blocking Severity
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in [Settings](https://app.macroscope.com/pingdotgg/settings#Repos). You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).