From fbda1db91e42fc15be20f2ff236d1302605e4c81 Mon Sep 17 00:00:00 2001 From: Vyacheslav Scherbinin Date: Wed, 11 Nov 2026 18:01:39 +0700 Subject: [PATCH] test(orchestration): keep scripted Codex homes in each test directory (#40964) The scripted Codex fixture hard-coded /home/dev/.codex as the account home on every platform. Startup now reads hook configuration from the account home, so coordinator-worker tests stalled on macOS before the scripted connection opened. Build the fake account home inside each test's temporary fixture root and pass that root to every attach caller. --- .../structured-chat-coordinator-fake-codex-fixture.ts | 5 +++-- .../structured-chat-coordinator-mail-rig.test-fixture.ts | 2 +- .../structured-sessions/structured-chat-worker-reuse.test.ts | 5 ++++- .../structured-chat-worker-start-unknown.test.ts | 3 ++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-coordinator-fake-codex-fixture.ts b/src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-coordinator-fake-codex-fixture.ts index 2eff229a0bf..c60f52afbba 100644 --- a/src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-coordinator-fake-codex-fixture.ts +++ b/src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-coordinator-fake-codex-fixture.ts @@ -1,3 +1,4 @@ +import { join } from 'node:path' import type { CodexAppServerConnection, CodexAppServerConnectionHandlers @@ -142,7 +143,7 @@ export function operationId(): string { return `${Date.now()}-${operations.toString(16).padStart(32, '0')}` } -export function attachParams(sessionId: string) { +export function attachParams(sessionId: string, fixtureRoot: string) { const params = { location: { executionHostId: 'local' as const, @@ -152,7 +153,7 @@ export function attachParams(sessionId: string) { }, provider: 'codex' as const, agent: 'codex' as const, - accountHome: { variable: 'CODEX_HOME' as const, path: '/home/dev/.codex' }, + accountHome: { variable: 'CODEX_HOME' as const, path: join(fixtureRoot, 'codex-home') }, runtimeKind: 'native' as const } const envelope = { diff --git a/src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-coordinator-mail-rig.test-fixture.ts b/src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-coordinator-mail-rig.test-fixture.ts index fad7fa3988c..dc51981640f 100644 --- a/src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-coordinator-mail-rig.test-fixture.ts +++ b/src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-coordinator-mail-rig.test-fixture.ts @@ -84,7 +84,7 @@ export async function call( } export async function openChat(sessionId: string): Promise { - const attached = await host.attach({ callerKey: 'test-surface' }, attachParams(sessionId)) + const attached = await host.attach({ callerKey: 'test-surface' }, attachParams(sessionId, root)) expect(attached, JSON.stringify(attached)).toMatchObject({ ok: true }) await host.setSessionTabVisibility(sessionId, true) threadBySession.set(sessionId, codex.connections.at(-1)!.threadId!) diff --git a/src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-worker-reuse.test.ts b/src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-worker-reuse.test.ts index 98d99c44e50..3b2524898c6 100644 --- a/src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-worker-reuse.test.ts +++ b/src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-worker-reuse.test.ts @@ -39,7 +39,10 @@ vi.mock( }) => { const rig = await import('./structured-chat-coordinator-mail-rig.test-fixture') const { attachParams } = await import('./structured-chat-coordinator-fake-codex-fixture') - const attached = await rig.host.attach(args.caller, attachParams(args.envelope.sessionId)) + const attached = await rig.host.attach( + args.caller, + attachParams(args.envelope.sessionId, rig.root) + ) await rig.host.setSessionTabVisibility(args.envelope.sessionId, true) rig.threadBySession.set(args.envelope.sessionId, rig.codex.connections.at(-1)!.threadId!) return attached diff --git a/src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-worker-start-unknown.test.ts b/src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-worker-start-unknown.test.ts index 512842d2619..88b7e69d6db 100644 --- a/src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-worker-start-unknown.test.ts +++ b/src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-worker-start-unknown.test.ts @@ -10,6 +10,7 @@ import { db, host, openChat, + root, runtime } from './structured-chat-coordinator-mail-rig.test-fixture' @@ -34,7 +35,7 @@ it('keeps a minted worker start unknown after one preamble handover without an e } as never) vi.spyOn(sessionCreate, 'createStructuredAgentSessionForWorktree').mockImplementation( async (args) => { - const attached = await host.attach(args.caller, attachParams(args.envelope.sessionId)) + const attached = await host.attach(args.caller, attachParams(args.envelope.sessionId, root)) if (!attached.ok) { throw new Error('scripted worker attach refused') }