mirror of
https://github.com/stablyai/orca.git
synced 2026-10-25 08:04:05 +00:00
fix(orchestration): bind legacy escalation dispatch
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { createHash } from 'node:crypto'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import type Database from '../../sqlite/sync-database'
|
||||
import { applyEscalationToDispatch } from '../orchestration/coordinator-escalation-triage'
|
||||
import {
|
||||
cleanupLegacyCompatibilityDispatcherHarnesses,
|
||||
COORDINATOR_HANDLE,
|
||||
@@ -51,7 +52,10 @@ describe('legacy compatibility through RpcDispatcher', () => {
|
||||
harness.dispatcher,
|
||||
request(
|
||||
'orchestration.send',
|
||||
escalationParams(harness),
|
||||
{
|
||||
...escalationParams(harness),
|
||||
payload: JSON.stringify({ taskId: harness.taskId })
|
||||
},
|
||||
evidence('worker', valid),
|
||||
`${transport}-${valid}`
|
||||
),
|
||||
@@ -75,6 +79,15 @@ describe('legacy compatibility through RpcDispatcher', () => {
|
||||
legacyCompatibility: { replayed: false }
|
||||
}
|
||||
})
|
||||
const message = (response as { result: { message: { id: string; payload: string } } }).result
|
||||
.message
|
||||
expect(JSON.parse(message.payload)).toMatchObject({
|
||||
taskId: harness.taskId,
|
||||
dispatchId: harness.dispatchId
|
||||
})
|
||||
applyEscalationToDispatch(harness.db, harness.db.getMessageById(message.id)!, () => {})
|
||||
expect(harness.db.getTask(harness.taskId)?.status).toBe('ready')
|
||||
expect(harness.db.getDispatchContextById(harness.dispatchId)?.status).toBe('failed')
|
||||
expect(counts(harness.db)).toEqual({
|
||||
...before,
|
||||
messages: before.messages + 1,
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { RpcRequest } from './core'
|
||||
import type { OrcaRuntimeService } from '../orca-runtime'
|
||||
import type { MessageType } from '../orchestration/db'
|
||||
import { OrchestrationError } from '../orchestration/orchestration-error'
|
||||
import { bindCoordinatorMutationPayload } from '../orchestration/dispatch-message-binding'
|
||||
import type { LegacyCompatibilityAuthority } from './orchestration-legacy-authority'
|
||||
import {
|
||||
inferLegacyWorkerOutcome,
|
||||
@@ -89,7 +90,11 @@ export async function handleLegacyLifecycleSend(args: {
|
||||
body: params.body,
|
||||
type: params.type as MessageType,
|
||||
priority: params.priority,
|
||||
payload: params.payload
|
||||
payload: bindCoordinatorMutationPayload(
|
||||
params.type as MessageType,
|
||||
params.payload,
|
||||
dispatch.id
|
||||
)
|
||||
},
|
||||
lifecycle:
|
||||
params.type === 'heartbeat'
|
||||
|
||||
Reference in New Issue
Block a user