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.
This commit is contained in:
Vyacheslav Scherbinin
2026-11-11 03:01:39 -08:00
committed by GitHub
parent 02e8b0c2a8
commit fbda1db91e
4 changed files with 10 additions and 5 deletions
@@ -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 = {
@@ -84,7 +84,7 @@ export async function call(
}
export async function openChat(sessionId: string): Promise<FakeConnection> {
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!)
@@ -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
@@ -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')
}