fix(server): Stop ends a V2 run whose agent session is already gone #14857
ClosedSunkenInTime(GitHub profile, opens in a new tab)wants to merge 2 commits into
t3code/codex-turn-mapping fromrefs/pull/14857/headopened View on GitHubgithub-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
- apps/server/src/orchestration-v2/Orchestrator.ts line 8102Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -7917,0 +8041,21 @@8041+ providerInstanceId: run.providerInstanceId,8042+ occurredAt: now,8043+ payload: { ...run, status: "interrupted", completedAt: now },8044+ });8045+ // Like any stopped run, capture its checkpoint as the rollback point8046+ // for the next message.8047+ const checkpointScopeId = rootNode.checkpointScopeId;8048+ if (checkpointScopeId !== null) {8049+ yield* Ref.update(effects, (existing) => [8050+ ...existing,8051+ {8052+ id: `effect:checkpoint.capture:${run.id}`,8053+ commandId: CommandId.make(`command:effect:checkpoint.capture:${run.id}`),8054+ threadId: command.threadId,8055+ request: { type: "checkpoint.capture", runId: run.id, scopeId: checkpointScopeId },8056+ } satisfies PendingOrchestrationEffectV2,8057+ ]);8058+ }8059+ if (command.holdQueue === true) yield* holdQueuedRuns;8060+ yield* stopCompletionCohort();8061+ yield* settleBackgroundWork({apps/server/src/orchestration-v2/Orchestrator.ts line 8003OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -7917,0 +7983,21 @@7983+ }7984+ for (const node of projection.nodes.filter(7985+ (candidate) =>7986+ candidate.runId === run.id &&7987+ (candidate.status === "pending" ||7988+ candidate.status === "running" ||7989+ candidate.status === "waiting"),7990+ )) {7991+ yield* emitEvent({7992+ type: "node.updated",7993+ threadId: command.threadId,7994+ runId: run.id,7995+ nodeId: node.id,7996+ providerInstanceId: run.providerInstanceId,7997+ occurredAt: now,7998+ payload: { ...node, status: "interrupted", completedAt: now },7999+ });8000+ }8001+ // Provider-native subagents died with the provider process. App-owned8002+ // children run in their own threads and may still be working.8003+ for (const subagent of projection.subagents.filter(
juliusmarminge added labelsmacroscope-review
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
juliusmarminge closed this
Sign in to join this conversation.


macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed