Fix WSL orchestration CLI preambles (#8561)

This commit is contained in:
Jinjing
2026-07-13 05:39:52 -07:00
committed by GitHub
parent 6eda9cdb27
commit 17f032dbd5
13 changed files with 228 additions and 19 deletions
@@ -1369,6 +1369,22 @@ describe('orchestration RPC methods', () => {
)
})
it('uses the target pane CLI command for the returned preamble', async () => {
setup()
const task = db.createTask({ spec: 'work' })
vi.spyOn(runtime, 'getTerminalOrchestrationCliCommand').mockReturnValue('orca-ide')
const result = (await call('orchestration.dispatch', {
task: task.id,
to: 'term_wsl',
returnPreamble: true
})) as { preamble: string }
expect(runtime.getTerminalOrchestrationCliCommand).toHaveBeenCalledWith('term_wsl')
expect(result.preamble).toContain('orca-ide orchestration send')
expect(result.preamble).not.toMatch(/(^|\s)orca orchestration/m)
})
it('injects preamble through the agent prompt path instead of raw terminal send', async () => {
setup()
const task = db.createTask({ spec: 'line one\nline two' })
+10 -4
View File
@@ -495,7 +495,10 @@ export const ORCHESTRATION_METHODS: RpcMethod[] = [
taskSpec: task.spec,
coordinatorHandle: params.from ?? 'coordinator',
workerHandle: params.to ?? 'worker',
devMode: params.devMode
devMode: params.devMode,
...(params.to
? { cliCommand: runtime.getTerminalOrchestrationCliCommand(params.to) }
: {})
})
return { dispatch: null, injected: false, dryRun: true, preamble }
}
@@ -540,7 +543,8 @@ export const ORCHESTRATION_METHODS: RpcMethod[] = [
taskSpec: task.spec,
coordinatorHandle: params.from ?? 'coordinator',
workerHandle: to,
devMode: params.devMode
devMode: params.devMode,
cliCommand: runtime.getTerminalOrchestrationCliCommand(to)
})
let injected = false
@@ -583,6 +587,7 @@ export const ORCHESTRATION_METHODS: RpcMethod[] = [
if (!task) {
throw new Error(`Task not found: ${params.task}`)
}
const workerHandle = ctx?.assignee_handle ?? 'worker'
const preamble = buildDispatchPreamble({
taskId: task.id,
// Why: prefer the existing dispatch context's id if we have one
@@ -591,8 +596,9 @@ export const ORCHESTRATION_METHODS: RpcMethod[] = [
dispatchId: ctx?.id ?? 'ctx_preview',
taskSpec: task.spec,
coordinatorHandle: params.from ?? 'coordinator',
workerHandle: ctx?.assignee_handle ?? 'worker',
devMode: params.devMode
workerHandle,
devMode: params.devMode,
...(ctx ? { cliCommand: runtime.getTerminalOrchestrationCliCommand(workerHandle) } : {})
})
return { dispatch: ctx ?? null, preamble }
}