mirror of
https://github.com/stablyai/orca.git
synced 2026-10-29 16:17:51 +00:00
* fix(codex): trust extended-length resume paths * test(codex): cover both sides of extended-length resume folding The provenance fix folds the extended drive spelling on the rollout path and the trusted sessions root, and runs per entry in the legacy id scan. Only the rollout-path side had coverage, so pin the rest: - normal-form rollout under an extended-length trusted home (root side) - compressed .zst sibling derived from an extended-length persisted path, where a folded comparison copy could leak into the returned path - legacy id-scan entries: extended-length accepted, device namespace refused All three fail with the production change reverted. * docs(codex): state accurately what the resume path fold rejects The helper's comment called the rejected spellings "arbitrary device namespaces", but \?\UNC\ is the extended-length form of \server\share\ — a network share, not a device. Reading it as a security decision hides that UNC is simply not folded yet, so say what is actually excluded. Also trim the two new test comments to one line to match the file. * fix(codex): reject rollout alternate data streams * fix(codex): preserve resume provenance guard --------- Co-authored-by: OrcaWin <alpha-eng@stably.ai> Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
47 lines
1.7 KiB
TypeScript
47 lines
1.7 KiB
TypeScript
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
|
|
import { dirname, join, toNamespacedPath } from 'node:path'
|
|
import { tmpdir } from 'node:os'
|
|
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
import { prepareCodexSessionResume } from './codex-session-resume-preparation'
|
|
|
|
const windowsIt = process.platform === 'win32' ? it : it.skip
|
|
const cleanupPaths: string[] = []
|
|
|
|
afterEach(() => {
|
|
for (const cleanupPath of cleanupPaths.splice(0)) {
|
|
rmSync(cleanupPath, { recursive: true, force: true })
|
|
}
|
|
})
|
|
|
|
describe('Codex session resume on native Windows', () => {
|
|
windowsIt('resumes an extended-length rollout from its ordinary trusted home', async () => {
|
|
const homePath = mkdtempSync(join(tmpdir(), 'orca-codex-resume-'))
|
|
cleanupPaths.push(homePath)
|
|
const rolloutPath = join(
|
|
homePath,
|
|
'sessions',
|
|
'2026',
|
|
'07',
|
|
'20',
|
|
'rollout-019f81b9-19a9-7651-a8d1-352d9420bd11.jsonl'
|
|
)
|
|
mkdirSync(dirname(rolloutPath), { recursive: true })
|
|
writeFileSync(rolloutPath, '{"type":"session_meta"}\n')
|
|
const transcriptPath = toNamespacedPath(rolloutPath)
|
|
const resolveVerifiedResumeHome = vi.fn(async () => homePath)
|
|
|
|
await expect(
|
|
prepareCodexSessionResume({
|
|
sessionId: '019f81b9-19a9-7651-a8d1-352d9420bd11',
|
|
transcriptPath,
|
|
trustedCodexHomes: [homePath],
|
|
getSelectedAccountCodexHome: () => null,
|
|
systemCodexHomePath: homePath,
|
|
sharedRuntimeCodexHomePath: null,
|
|
resolveVerifiedResumeHome
|
|
})
|
|
).resolves.toEqual({ outcome: 'resume', codexHomePath: homePath })
|
|
expect(resolveVerifiedResumeHome).toHaveBeenCalledWith({ homePath, transcriptPath })
|
|
})
|
|
})
|