mirror of
https://github.com/stablyai/orca.git
synced 2026-10-22 16:03:47 +00:00
fix: preserve shell-ready Codex resume delivery
This commit is contained in:
@@ -129,6 +129,26 @@ describe('agent-session create operation ledger', () => {
|
||||
expect(createTerminal).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('waits for Codex shell launch preparation before a structured resume', async () => {
|
||||
const runtime = createRuntime()
|
||||
const createTerminal = vi.spyOn(runtime, 'createTerminal').mockResolvedValue(terminal())
|
||||
|
||||
await runtime.ensureAgentSession({
|
||||
kind: 'explicit',
|
||||
worktree: 'id:worktree-1',
|
||||
agent: 'codex',
|
||||
providerSession: { key: 'session_id', id: 'provider-session-1' }
|
||||
})
|
||||
|
||||
expect(createTerminal).toHaveBeenCalledWith(
|
||||
'id:worktree-1',
|
||||
expect.objectContaining({
|
||||
command: expect.stringContaining("'resume' 'provider-session-1'"),
|
||||
startupCommandDelivery: 'shell-ready'
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
it('selects nested SSH legacy fallback before reading a Pi transcript path locally', async () => {
|
||||
const runtime = createRuntime()
|
||||
const internal = runtime as unknown as {
|
||||
|
||||
@@ -26449,6 +26449,7 @@ export class OrcaRuntimeService {
|
||||
env: startup.env,
|
||||
launchConfig: startup.launchConfig,
|
||||
launchAgent: request.agent,
|
||||
startupCommandDelivery: startup.startupCommandDelivery,
|
||||
presentation: request.presentation ?? 'background',
|
||||
tabId: request.placement?.tabId,
|
||||
leafId: request.placement?.leafId,
|
||||
|
||||
@@ -8444,6 +8444,7 @@ describe('connectPanePty', () => {
|
||||
expect.objectContaining({
|
||||
sessionId: 'restored-session',
|
||||
command: "codex '--dangerously-bypass-approvals-and-sandbox' 'resume' 'codex-session-1'",
|
||||
startupCommandDelivery: 'shell-ready',
|
||||
env: expect.objectContaining({
|
||||
ORCA_PANE_KEY: paneKey,
|
||||
ORCA_AGENT_LAUNCH_TOKEN: expect.stringMatching(new RegExp(`^${UUID_RE}$`))
|
||||
|
||||
@@ -556,6 +556,9 @@ type ColdRestoreAgentResumeStartup = PendingStartupCommand & {
|
||||
agent: ResumableTuiAgent
|
||||
resumeProviderSession: AgentProviderSessionMetadata
|
||||
launchConfig: NonNullable<ReturnType<typeof buildAgentResumeStartupPlan>>['launchConfig']
|
||||
startupCommandDelivery: NonNullable<
|
||||
ReturnType<typeof buildAgentResumeStartupPlan>
|
||||
>['startupCommandDelivery']
|
||||
launchToken: string
|
||||
useLiveEntry: boolean
|
||||
hasSleepingRecord: boolean
|
||||
@@ -5067,6 +5070,7 @@ export function connectPanePty(
|
||||
ORCA_AGENT_LAUNCH_TOKEN: coldRestoreLaunchToken
|
||||
},
|
||||
launchConfig: startupPlan.launchConfig,
|
||||
startupCommandDelivery: startupPlan.startupCommandDelivery,
|
||||
resumeProviderSession: providerSession,
|
||||
launchToken: coldRestoreLaunchToken,
|
||||
useLiveEntry: Boolean(useLiveEntry),
|
||||
@@ -5274,9 +5278,11 @@ export function connectPanePty(
|
||||
...(connectionId && startupOverride?.command && !shouldDeliverStartupViaTerminalPaste
|
||||
? { commandDelivery: 'provider' as const }
|
||||
: {}),
|
||||
...(connectionId && startupOverride?.command
|
||||
? { startupCommandDelivery: 'shell-ready' as const }
|
||||
: {}),
|
||||
...(coldRestoreOverride?.startupCommandDelivery
|
||||
? { startupCommandDelivery: coldRestoreOverride.startupCommandDelivery }
|
||||
: connectionId && startupOverride?.command
|
||||
? { startupCommandDelivery: 'shell-ready' as const }
|
||||
: {}),
|
||||
...(startupOverride?.env
|
||||
? { env: mergeStartupEnvWithPaneIdentity(startupOverride.env) }
|
||||
: {}),
|
||||
@@ -8718,6 +8724,9 @@ export function connectPanePty(
|
||||
? { launchToken: coldRestoreStartup.launchToken }
|
||||
: {}),
|
||||
...(coldRestoreStartup?.agent ? { launchAgent: coldRestoreStartup.agent } : {}),
|
||||
...(coldRestoreStartup?.startupCommandDelivery
|
||||
? { startupCommandDelivery: coldRestoreStartup.startupCommandDelivery }
|
||||
: {}),
|
||||
...(shouldDeclareHiddenAtSpawn() ? { initiallyHidden: true } : {}),
|
||||
...(directSshRetryAttempt ? { admitPtyId: claimCapturedDirectSshRetryPty } : {}),
|
||||
callbacks: outputCallbacks.callbacks
|
||||
@@ -8963,6 +8972,9 @@ export function connectPanePty(
|
||||
: {}),
|
||||
...(coldRestoreStartup?.launchToken ? { launchToken: coldRestoreStartup.launchToken } : {}),
|
||||
...(coldRestoreStartup?.agent ? { launchAgent: coldRestoreStartup.agent } : {}),
|
||||
...(coldRestoreStartup?.startupCommandDelivery
|
||||
? { startupCommandDelivery: coldRestoreStartup.startupCommandDelivery }
|
||||
: {}),
|
||||
...(shouldDeclareHiddenAtSpawn() ? { initiallyHidden: true } : {}),
|
||||
...(directSshRetryAttempt ? { admitPtyId: claimCapturedDirectSshRetryPty } : {}),
|
||||
callbacks: outputCallbacks.callbacks
|
||||
|
||||
@@ -64,6 +64,7 @@ export function buildAgentResumeStartupPlan(args: {
|
||||
expectedProcess: TUI_AGENT_CONFIG[args.agent].expectedProcess,
|
||||
followupPrompt: null,
|
||||
launchConfig,
|
||||
...(args.agent === 'codex' ? { startupCommandDelivery: 'shell-ready' as const } : {}),
|
||||
...(Object.keys(applied).length > 0 ? { sessionOptions: { ...applied } } : {}),
|
||||
...(args.agentEnv ? { env: { ...args.agentEnv } } : {})
|
||||
}
|
||||
|
||||
@@ -591,6 +591,7 @@ describe('tui agent startup plans', () => {
|
||||
})
|
||||
|
||||
expect(plan?.launchCommand).toBe("codex 'resume' 's1'")
|
||||
expect(plan?.startupCommandDelivery).toBe('shell-ready')
|
||||
})
|
||||
|
||||
it('quotes Windows resume argv for cmd.exe when shell is cmd', () => {
|
||||
|
||||
Reference in New Issue
Block a user