Repository navigation
fix: route native chat orchestration by agent session identity #19648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5d374e9
1e6f94d
7817970
f80202b
d4ee902
a0cfed3
bb73d36
7062cfa
5e3df53
4315204
ebd6360
281e4a1
b79c81c
e724bea
f3e1118
1680534
eafcb48
cc3a18c
98069cb
429011f
9c23b61
301ad25
4027bf5
3a24b10
9d3e85a
2ab2405
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ import { getOptionalStringFlag, getRequiredStringFlag } from '../../flags' | |
| import { RuntimeClientError } from '../../runtime-client' | ||
| import { abbreviateOrchestrationTasks } from '../../../shared/orchestration-task-summary' | ||
| import { callOrchestrationMutation } from './mutation-request' | ||
| import { resolveCoordinatorTerminalHandle } from './terminal-identity' | ||
| import { orchestrationSessionPayload, resolveCoordinatorTerminalHandle } from './terminal-identity' | ||
|
|
||
| const TASK_STATUS_VALUES = [ | ||
| 'pending', | ||
|
|
@@ -17,7 +17,10 @@ const TASK_STATUS_VALUES = [ | |
|
|
||
| export const ORCHESTRATION_TASK_HANDLERS: Record<string, CommandHandler> = { | ||
| 'orchestration task-create': async ({ flags, client, cwd, json }) => { | ||
| const callerTerminalHandle = await resolveCoordinatorTerminalHandle(flags, cwd, client) | ||
| const session = orchestrationSessionPayload() | ||
| const callerTerminalHandle = session.agentSessionId | ||
| ? undefined | ||
| : await resolveCoordinatorTerminalHandle(flags, cwd, client) | ||
| const result = await callOrchestrationMutation<{ task: { id: string; status: string } }>( | ||
| client, | ||
| flags, | ||
|
|
@@ -29,7 +32,8 @@ export const ORCHESTRATION_TASK_HANDLERS: Record<string, CommandHandler> = { | |
| deps: getOptionalStringFlag(flags, 'deps'), | ||
| parent: getOptionalStringFlag(flags, 'parent'), | ||
| run: getOptionalStringFlag(flags, 'run'), | ||
| callerTerminalHandle | ||
| callerTerminalHandle, | ||
| ...session | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
| ) | ||
| printResult(result, json, (r) => `Created ${r.task.id} [${r.task.status}]`) | ||
|
|
@@ -38,9 +42,11 @@ export const ORCHESTRATION_TASK_HANDLERS: Record<string, CommandHandler> = { | |
| 'orchestration task-list': async ({ flags, client, cwd, json }) => { | ||
| const brief = flags.has('brief') | ||
| const run = getOptionalStringFlag(flags, 'run') | ||
| const callerTerminalHandle = run | ||
| ? undefined | ||
| : await resolveCoordinatorTerminalHandle(flags, cwd, client) | ||
| const session = orchestrationSessionPayload() | ||
| const callerTerminalHandle = | ||
| run || session.agentSessionId | ||
| ? undefined | ||
| : await resolveCoordinatorTerminalHandle(flags, cwd, client) | ||
| const result = await client.call<{ | ||
| tasks: { | ||
| id: string | ||
|
|
@@ -60,7 +66,8 @@ export const ORCHESTRATION_TASK_HANDLERS: Record<string, CommandHandler> = { | |
| ready: flags.has('ready') ? true : undefined, | ||
| brief: brief ? true : undefined, | ||
| run, | ||
| callerTerminalHandle | ||
| callerTerminalHandle, | ||
| ...session | ||
| }) | ||
| // Why: only older runtimes (no spec_truncated) skip server-side abbreviation and need this client-side fallback. | ||
| const needsClientAbbreviation = | ||
|
|
@@ -106,7 +113,9 @@ export const ORCHESTRATION_TASK_HANDLERS: Record<string, CommandHandler> = { | |
| status, | ||
| result: getOptionalStringFlag(flags, 'result'), | ||
| run: getOptionalStringFlag(flags, 'run'), | ||
| callerTerminalHandle: await resolveCoordinatorTerminalHandle(flags, cwd, client) | ||
| ...(orchestrationSessionPayload().agentSessionId | ||
| ? orchestrationSessionPayload() | ||
| : { callerTerminalHandle: await resolveCoordinatorTerminalHandle(flags, cwd, client) }) | ||
| } | ||
| ) | ||
| printResult(result, json, (r) => `Updated ${r.task.id} -> ${r.task.status}`) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Require a complete session payload before disabling terminal routing.
If
ORCA_AGENT_SESSION_IDis set andORCA_AGENT_SESSION_RUNTIME_FENCEis absent, these branches omitfromand sendruntimeFence: Number(undefined), which isNaN. This breaks the terminal compatibility path for an incomplete native environment. BuildorchestrationSessionPayload()once, and use itsagentSessionIdto choose session routing.src/cli/handlers/orchestration/run-handlers.ts#L26-L26: derive the native payload fromorchestrationSessionPayload()instead of converting an optional fence.src/cli/handlers/orchestration/run-handlers.ts#L40-L40: apply the same complete-payload check fororchestration.runUse.src/cli/handlers/orchestration/run-handlers.ts#L54-L54: apply the same complete-payload check fororchestration.runCurrent.📍 Affects 1 file
src/cli/handlers/orchestration/run-handlers.ts#L26-L26(this comment)src/cli/handlers/orchestration/run-handlers.ts#L40-L40src/cli/handlers/orchestration/run-handlers.ts#L54-L54