fix(orchestration): a start answered after its Run was reset says so

This commit is contained in:
Jinwoo-H
2026-11-11 01:27:48 -05:00
parent aec5ffb331
commit 6ca9720175
@@ -147,7 +147,7 @@ export async function startRemoteOwnedWorker(
}
const started = StartedOnServer.safeParse(receipt)
if (started.success) {
recordRemoteStart(db, {
const recorded = recordRemoteStart(db, {
conversationId: link.conversation_id,
taskId,
dispatchId: started.data.dispatchId,
@@ -155,6 +155,13 @@ export async function startRemoteOwnedWorker(
peerRunId: started.data.run?.id,
agent: started.data.agent ?? null
})
if (!recorded) {
throw new OrchestrationError(
'run_not_found',
`Run ${run.id} was reset, or its pairing with ${server.name} re-made, while this start was waiting, so this Orca records nothing for the worker it started there (Dispatch ${started.data.dispatchId}).`,
{ server: server.name }
)
}
prepareWorkerStartCard(
runtime,
ctx.orchestrationCaller