fix dispatch session identity propagation

This commit is contained in:
Merge Sim
2026-09-08 15:06:56 -07:00
parent a0cfed369a
commit bb73d36a9d
2 changed files with 3 additions and 2 deletions
@@ -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,
@@ -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,