fix(orchestration): keep dispatch.task_id on the workerShow receipt

exposeDispatchContext renamed task_id to taskId, and every shipped CLI
prints value.dispatch.task_id, so an older paired CLI against an updated
host printed task=undefined. Publish both spellings. exposeWorker's dropped
columns have no reader in main's src/cli, which reads only state and stage.
This commit is contained in:
Jinwoo-H
2026-09-04 15:30:44 -04:00
parent a2796a5b88
commit 5f92f8c220
2 changed files with 29 additions and 2 deletions
@@ -119,7 +119,31 @@ describe('worker-show receipt shape', () => {
expect(exposed).not.toHaveProperty('host_scope')
expect(exposed).not.toHaveProperty('launch_token_hash')
expect(exposed).not.toHaveProperty('capability_hash')
// The row shipped raw beside a camelCase `worker`; no snake_case key may survive.
expect(Object.keys(exposed).filter((key) => key.includes('_'))).toEqual([])
// The row shipped raw beside a camelCase `worker`; only the one spelling an older
// paired CLI still prints may survive.
expect(Object.keys(exposed).filter((key) => key.includes('_'))).toEqual(['task_id'])
})
// A paired CLI and host update independently, so an older CLI reads this receipt.
// These are the fields it prints: src/cli/handlers/orchestration/
// worker-observation-handlers.ts:18-19,25.
it('keeps every field an older paired CLI prints', () => {
const dispatch = exposeDispatchContext({
id: DISPATCH_ID,
run_id: 'run-1',
task_id: 'task-1',
status: 'dispatched'
} as DispatchContextRow)
expect(dispatch).toMatchObject({ id: DISPATCH_ID, task_id: 'task-1', status: 'dispatched' })
expect(
exposeWorker({
state: 'ready',
stage: 'input_accepted',
effects: '[]',
residual_resources: '[]',
start_options: '{}'
} as WorkerDispatchRow)
).toMatchObject({ state: 'ready', stage: 'input_accepted' })
})
})
@@ -123,6 +123,9 @@ export function exposeDispatchContext(dispatch: DispatchContextRow) {
id: dispatch.id,
runId: dispatch.run_id,
taskId: dispatch.task_id,
// Every shipped CLI prints `dispatch.task_id`, and mixed client/host versions are the
// normal state, so the rename ships beside the spelling old clients still read.
task_id: dispatch.task_id,
contractVersion: dispatch.contract_version,
assigneeHandle: dispatch.assignee_handle,
assigneePaneKey: dispatch.assignee_pane_key,