diff --git a/src/main/runtime/orca-runtime-structured-agent-session-create-intent.test.ts b/src/main/runtime/orca-runtime-structured-agent-session-create-intent.test.ts index 746341ead83..c1e5f2522ff 100644 --- a/src/main/runtime/orca-runtime-structured-agent-session-create-intent.test.ts +++ b/src/main/runtime/orca-runtime-structured-agent-session-create-intent.test.ts @@ -1,5 +1,5 @@ import { prepareAdoptedTranscript } from '../native-chat/agent-session-wire/structured-agent-session-adopted-import' -import { mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises' +import { mkdir, mkdtemp, realpath, rm, writeFile } from 'node:fs/promises' import { tmpdir } from 'node:os' import { dirname, join } from 'node:path' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' @@ -122,8 +122,10 @@ describe('structured agent-session create intent', () => { envelope: { sessionId: 'new-chat', clientOperationId: 'operation-1' }, worktree: 'id:another-workspace', agent: 'claude', - resumeFrom: { providerSessionId: 'provider-session-alpha-1', - cliSource: { workspaceId: 'another-workspace', paneKey: 'missing-pane' } } + resumeFrom: { + providerSessionId: 'provider-session-alpha-1', + cliSource: { workspaceId: 'another-workspace', paneKey: 'missing-pane' } + } }) ).rejects.toMatchObject({ refusal: { @@ -350,7 +352,7 @@ describe('structured agent-session create intent', () => { describe('adopting a conversation recorded outside Orca', () => { it('resolves OMP history with the configured launch environment', async () => { - const root = await mkdtemp(join(tmpdir(), 'orca-omp-create-intent-')) + const root = await mkdtemp(join(await realpath(tmpdir()), 'orca-omp-create-intent-')) try { const accountHome = join(root, 'account', 'agent') const ambientData = join(root, 'ambient-data') @@ -451,7 +453,7 @@ describe('adopting a conversation recorded outside Orca', () => { }) it('adopts the original Pi file into a folder workspace and refuses another folder', async () => { - const accountHome = await mkdtemp(join(tmpdir(), 'orca-pi-adopt-intent-')) + const accountHome = await mkdtemp(join(await realpath(tmpdir()), 'orca-pi-adopt-intent-')) vi.stubEnv('PI_CODING_AGENT_DIR', accountHome) try { const file = join( @@ -496,17 +498,23 @@ describe('adopting a conversation recorded outside Orca', () => { expect(intent.adopt).toEqual({ providerHandle: { transport: 'jsonl-rpc', agent: 'pi', nativeId: file }, transcriptPath: file, - source: { providerSessionId: '0198c2a4-7d1e-7c3a-9a4b-1f2e3d4c5b6a', workspaceCwd: '/repos/workspace-1' } + source: { + providerSessionId: '0198c2a4-7d1e-7c3a-9a4b-1f2e3d4c5b6a', + workspaceCwd: '/repos/workspace-1' + } }) workspaceDirectory = '/different-folder' const refused = await runtime.resolveStructuredAgentSessionCreateIntent({ - envelope: { sessionId: 'session-2', clientOperationId: 'operation-2' }, - worktree: 'id:workspace-1', - agent: 'pi', - resumeFrom: { providerSessionId: '0198c2a4-7d1e-7c3a-9a4b-1f2e3d4c5b6a' } - }) - expect(await prepareAdoptedTranscript(refused)).toMatchObject({ ok: false, refusal: { code: 'agent_session_identity_required' } }) + envelope: { sessionId: 'session-2', clientOperationId: 'operation-2' }, + worktree: 'id:workspace-1', + agent: 'pi', + resumeFrom: { providerSessionId: '0198c2a4-7d1e-7c3a-9a4b-1f2e3d4c5b6a' } + }) + expect(await prepareAdoptedTranscript(refused)).toMatchObject({ + ok: false, + refusal: { code: 'agent_session_identity_required' } + }) } finally { vi.unstubAllEnvs() await rm(accountHome, { recursive: true, force: true }) diff --git a/src/main/runtime/orca-runtime-tests/repository-project-operations-part-02.spec.ts b/src/main/runtime/orca-runtime-tests/repository-project-operations-part-02.spec.ts index 9cde689889d..81c9e856da7 100644 --- a/src/main/runtime/orca-runtime-tests/repository-project-operations-part-02.spec.ts +++ b/src/main/runtime/orca-runtime-tests/repository-project-operations-part-02.spec.ts @@ -1,3 +1,4 @@ +import { realpath } from 'node:fs/promises' import { describe, expect, it, vi } from 'vitest' import { DEFAULT_REPO_BADGE_COLOR, @@ -350,7 +351,9 @@ describe('OrcaRuntimeService', () => { }) it('preserves existing badgeColor on runtime cloneRepo folder->git dedupe upgrade', async () => { - const destination = await mkdtemp(join(tmpdir(), 'orca-runtime-folder-upgrade-')) + const destination = await mkdtemp( + join(await realpath(tmpdir()), 'orca-runtime-folder-upgrade-') + ) const clonePath = join(destination, 'repo-badge-color') const spawnSpy = vi.spyOn(gitRunner, 'gitSpawnAfterWindowsEnvironmentReady') spawnSpy.mockImplementation(() => {