From 6af880e4b85c6bd62ee36d855a5e9a32592765bd Mon Sep 17 00:00:00 2001 From: Jinwoo-H Date: Mon, 17 Aug 2026 00:58:34 -0400 Subject: [PATCH] fix(orchestration): bind legacy escalation dispatch --- ...ration-legacy-compatibility-dispatcher.test.ts | 15 ++++++++++++++- .../runtime/rpc/orchestration-legacy-lifecycle.ts | 7 ++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main/runtime/rpc/orchestration-legacy-compatibility-dispatcher.test.ts b/src/main/runtime/rpc/orchestration-legacy-compatibility-dispatcher.test.ts index 3c087702627..0379646cb52 100644 --- a/src/main/runtime/rpc/orchestration-legacy-compatibility-dispatcher.test.ts +++ b/src/main/runtime/rpc/orchestration-legacy-compatibility-dispatcher.test.ts @@ -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, diff --git a/src/main/runtime/rpc/orchestration-legacy-lifecycle.ts b/src/main/runtime/rpc/orchestration-legacy-lifecycle.ts index c0d700b2ed1..ebf6cfc2869 100644 --- a/src/main/runtime/rpc/orchestration-legacy-lifecycle.ts +++ b/src/main/runtime/rpc/orchestration-legacy-lifecycle.ts @@ -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'