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