mirror of
https://github.com/stablyai/orca.git
synced 2026-11-14 01:47:24 +00:00
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:
+3
-2
@@ -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 = {
|
||||
|
||||
+1
-1
@@ -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!)
|
||||
|
||||
+4
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user