test: read the failed reuse start's dispatch without a cast

This commit is contained in:
Jinwoo-H
2026-11-13 16:57:46 -05:00
parent cc72034e5f
commit 2ef1f74bcd
@@ -62,17 +62,18 @@ describe('a worker-start that fails', () => {
exitCode: null
})
const task = h.db.createTask({ spec: 'follow up on the PR', runId: h.activeRunId })
const receipt = (await h.call('orchestration.workerStart', {
const receipt = await h.call('orchestration.workerStart', {
task: task.id,
from: 'term_coord',
terminal: 'term_reused'
})) as { state: string; dispatchId: string }
expect(receipt.state).toBe('failed')
})
expect(receipt).toMatchObject({ state: 'failed' })
const dispatchId = h.db.getDispatchContext(task.id)?.id
const [lost] = h.db.getUnreadRunMailbox(h.activeRunId, 100, ['escalation'])
expect(lost?.body).not.toContain('worker-read')
await expect(
h.call('orchestration.workerRead', { dispatch: receipt.dispatchId })
h.call('orchestration.workerRead', { dispatch: dispatchId })
).rejects.toMatchObject({
code: 'worker_never_started',
message: expect.stringContaining('never started: Agent did not become ready')