Skip to content

Commit 8ff0536

Browse files
committed
fix(gateway): drop predecessor lifecycle owner at recovery admission
A late predecessor terminal with the recorded run id must not bypass the timestamp guard after recovery admission rewrites the row to running.
1 parent de32a34 commit 8ff0536

3 files changed

Lines changed: 7 additions & 0 deletions

File tree

‎src/auto-reply/reply/restart-recovery-claim.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,9 @@ export function createReplyRestartRecoveryClaimController(params: {
333333
sourceTurnId && params.sameChannelThreadRequired === true ? true : undefined,
334334
restartRecoverySourceIngress: sourceTurnId ? "channel" : undefined,
335335
restartRecoverySourceReplyDeliveryMode: params.sourceReplyDeliveryMode,
336+
// Admission rewrites the row to running for the recovery run; the
337+
// predecessor's lifecycle owner must not survive into the new turn.
338+
lifecycleRunId: undefined,
336339
runtimeMs: undefined,
337340
startedAt: updatedAt,
338341
status: "running",

‎src/config/sessions/session-transcript-turn-lifecycle.types.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export type SessionTranscriptTurnLifecyclePatch = {
4646
restartRecoveryRuns?: SessionEntry["restartRecoveryRuns"];
4747
/** Durable tombstones merged with the fresh row inside the SQLite write transaction. */
4848
restartRecoveryTerminalRunIds?: SessionRestartRecoveryState["restartRecoveryTerminalRunIds"];
49+
lifecycleRunId?: SessionEntry["lifecycleRunId"];
4950
runtimeMs?: number;
5051
startedAt?: number;
5152
status?: SessionRunStatus;

‎src/gateway/server-methods/chat-restart-recovery.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,9 @@ export function buildRestartSafeChatTranscriptState(params: {
356356
restartRecoveryDeliveryReceiptState: undefined,
357357
restartRecoveryDeliveryToolCallId: undefined,
358358
status: "running",
359+
// Admission rewrites the row to running for the retried turn; the
360+
// predecessor's lifecycle owner must not survive into the new turn.
361+
lifecycleRunId: undefined,
359362
startedAt: params.startedAt,
360363
endedAt: undefined,
361364
restartRecoveryDeliveryContext: undefined,

0 commit comments

Comments
 (0)