From bb73d36a9d203f3a0fa932d080636417d25bbdc2 Mon Sep 17 00:00:00 2001 From: Merge Sim Date: Tue, 8 Sep 2026 15:06:56 -0700 Subject: [PATCH] fix dispatch session identity propagation --- .../db/dispatch-context/dispatch-context-store.ts | 2 ++ src/main/runtime/orchestration/db/dispatch-row-writer.ts | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/runtime/orchestration/db/dispatch-context/dispatch-context-store.ts b/src/main/runtime/orchestration/db/dispatch-context/dispatch-context-store.ts index 38905f30434..a285b1805fe 100644 --- a/src/main/runtime/orchestration/db/dispatch-context/dispatch-context-store.ts +++ b/src/main/runtime/orchestration/db/dispatch-context/dispatch-context-store.ts @@ -15,6 +15,7 @@ export function createDispatchContext( params: { taskId: string assigneeHandle: string + assigneeAgentSessionId?: string | null // Why: pane key is the remint-stable identity behind the handle — lets worker_done ownership survive handle reissue. assigneePaneKey?: string launchTokenHash?: string @@ -64,6 +65,7 @@ export function createDispatchContext( contractVersion: CURRENT_CONTRACT_VERSION, launchTokenHash: launchTokenHash ?? null, assigneeHandle, + assigneeAgentSessionId: params.assigneeAgentSessionId, assigneePaneKey: assigneePaneKey ?? null, processIncarnation: processIncarnation ?? null, creatorDispatchId, diff --git a/src/main/runtime/orchestration/db/dispatch-row-writer.ts b/src/main/runtime/orchestration/db/dispatch-row-writer.ts index 9ee6cdf7fa7..41b6a724e81 100644 --- a/src/main/runtime/orchestration/db/dispatch-row-writer.ts +++ b/src/main/runtime/orchestration/db/dispatch-row-writer.ts @@ -18,7 +18,7 @@ export const DISPATCH_CONTEXT_CLAIM_SQL = `INSERT INTO dispatch_contexts ( creator_dispatch_id, creator_handle, creator_pane_key, status, failure_count, depth, dispatched_at ) -SELECT ?, run_id, id, ?, ?, ?, ?, ?, ?, ?, ?, 'dispatched', ?, ?, datetime('now') +SELECT ?, run_id, id, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'dispatched', ?, ?, datetime('now') FROM tasks WHERE id = ? AND status = 'ready' AND NOT EXISTS ( @@ -99,7 +99,6 @@ export function claimDispatchContextRow( params.depth, params.taskId, params.assigneeHandle, - params.assigneeAgentSessionId ?? null, params.assigneePaneKey, params.assigneePaneKey, params.paneSuffix,