From dcddee3f85585499cd755fb3f1ea5768f5185d42 Mon Sep 17 00:00:00 2001 From: Jinwoo-H Date: Wed, 11 Nov 2026 23:54:07 -0500 Subject: [PATCH] fix(orchestration): keep locator fields when stripping copies; never let the optional receipt page block remote release --- .../worker-output-copy-removal-worker-source.ts | 3 +++ .../legacy-remote/remote-attachment-archive-read.ts | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/runtime/orchestration/db/worker-terminal/worker-output-copy-removal-worker-source.ts b/src/main/runtime/orchestration/db/worker-terminal/worker-output-copy-removal-worker-source.ts index 79552d18a7f..8b835b7cc2a 100644 --- a/src/main/runtime/orchestration/db/worker-terminal/worker-output-copy-removal-worker-source.ts +++ b/src/main/runtime/orchestration/db/worker-terminal/worker-output-copy-removal-worker-source.ts @@ -19,6 +19,9 @@ try { "UPDATE worker_terminal_archives SET content = CASE WHEN json_valid(content) THEN json_patch('{\\"version\\":3}', json_object(" + "'agent', json_extract(content, '$.agent'), " + "'processIncarnation', json_extract(content, '$.processIncarnation'), " + + "'sessionId', json_extract(content, '$.sessionId'), " + + "'transcriptPath', json_extract(content, '$.transcriptPath'), " + + "'wslDistro', json_extract(content, '$.wslDistro'), " + "'fallbackReason', json_extract(content, '$.fallbackReason'))) " + "ELSE '{\\"version\\":3}' END WHERE dispatch_id = ? AND " + workerData.copyPredicate ); diff --git a/src/main/runtime/orchestration/legacy-remote/remote-attachment-archive-read.ts b/src/main/runtime/orchestration/legacy-remote/remote-attachment-archive-read.ts index 0cee4fb0599..256e3534cb7 100644 --- a/src/main/runtime/orchestration/legacy-remote/remote-attachment-archive-read.ts +++ b/src/main/runtime/orchestration/legacy-remote/remote-attachment-archive-read.ts @@ -35,12 +35,16 @@ export async function readRemoteAttachmentArchive(args: { }) } -/** Release receipts carry the output only while its original is still readable. */ +/** Release receipts carry the output only while its original is still readable and steady. */ export function readRemoteAttachmentOutputIfAvailable( args: Parameters[0] ): ReturnType { return readRemoteAttachmentArchive(args).catch((error: unknown) => { - if (error instanceof OrchestrationError && error.code === 'archive_unavailable') { + // A transcript written during the read only drops the optional page; it never blocks release. + if ( + error instanceof OrchestrationError && + (error.code === 'archive_unavailable' || error.code === 'source_changed') + ) { return null } throw error