mirror of
https://github.com/stablyai/orca.git
synced 2026-10-27 00:02:48 +00:00
Fix WSL orchestration CLI preambles (#8561)
This commit is contained in:
@@ -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' })
|
||||
|
||||
@@ -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 }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user