stablyai/orca · critical · Error
Refusing to use an unexpected guest cleanup path
Error message
Refusing to use an unexpected guest cleanup path
What it means
Safety guard in the benchmark's teardown logic: it computes cleanupPaths under `${guestHome}/.orca-wsl/benchmarks/<instanceKey>` and `${guestHome}/.orca-wsl/agent-hooks/instance-<instanceKey>`, then refuses to proceed if any path does not begin with `${guestHome}/.orca-wsl/`. This prevents destructive rm -rf against an unexpected location if HOME resolution or path construction goes wrong.
Source
Thrown at config/scripts/wsl-hook-relay-reattach-benchmark.mjs:347
null
)
wslHookRelayManager.ensureForDistro = previousEnsure
if (singletonProbe.length !== 1 || singletonProbe[0] !== '__bench-singleton-probe__') {
throw new Error(
'jiti duplicated the WSL hook-relay manager graph; reattach patch would not observe pty.ts'
)
}
const guestHome = (
await run('wsl.exe', wslArgs(distro, ['/bin/sh', '-c', 'printf %s "$HOME"']))
).stdout.trim()
const instanceKey = `bench-${process.pid}-${Date.now().toString(36)}`
const benchmarkRoot = `${guestHome}/.orca-wsl/benchmarks/${instanceKey}`
const scriptPath = `${benchmarkRoot}/.orca/agent-hooks/codex-hook.sh`
const endpointPath = `${guestHome}/.orca-wsl/agent-hooks/instance-${instanceKey}/endpoint.env`
cleanupPaths = [benchmarkRoot, `${guestHome}/.orca-wsl/agent-hooks/instance-${instanceKey}`]
if (cleanupPaths.some((cleanupPath) => !cleanupPath.startsWith(`${guestHome}/.orca-wsl/`))) {
throw new Error('Refusing to use an unexpected guest cleanup path')
}
const disabledTuiAgents = MANAGED_AGENT_HOOK_TARGETS.filter(
(target) => target.tuiAgent !== 'codex'
).map((target) => target.tuiAgent)
const bundleVersion = readFileSync(versionPath, 'utf8').trim()
const warnings = []
const relayRefreshes = []
let delivered = 0
// Why: pty.ts refreshes through the production singleton, so route that singleton at the
// benchmark-scoped manager instead of calling the reattach helper from here — a removed or
// mislocated integration call in pty.ts must fail this benchmark.
wslHookRelayManager.ensureForDistro = (refreshedDistro) => {
relayRefreshes.push(refreshedDistro)
manager?.ensureForDistro(refreshedDistro)
}
const { runtime, getController } = createRuntimeStub()View on GitHub (pinned to 1136503c6a)
Solutions
- Run `wsl.exe -d <distro> /bin/sh -c 'printf %s "$HOME"'` and confirm it prints the expected home path.
- Ensure the distro's user profile is intact and HOME is exported in the default shell.
- If you intentionally changed the benchmark layout, update the `.startsWith(guestHome/.orca-wsl/)` guard to match the new root.
- Never widen this guard casually — it exists to prevent accidental deletion outside .orca-wsl.
Example fix
// before
if (cleanupPaths.some((cleanupPath) => !cleanupPath.startsWith(`${guestHome}/.orca-wsl/`))) {
throw new Error('Refusing to use an unexpected guest cleanup path')
}
// after — name the offending path in the message
const bad = cleanupPaths.find((p) => !p.startsWith(`${guestHome}/.orca-wsl/`))
if (bad) {
throw new Error(`Refusing to use an unexpected guest cleanup path: ${bad} (guestHome=${guestHome})`)
} Defensive patterns
Strategy: validation
Validate before calling
// Validate guestHome is non-empty and absolute before computing cleanupPaths
if (!guestHome || !guestHome.startsWith('/') || guestHome.includes('\n')) {
throw new Error(`Unresolvable guest HOME: ${JSON.stringify(guestHome)}`)
} Type guard
function isPathUnderRoot(p: string, root: string): boolean {
const norm = p.replace(/\\/g, '/')
return norm.startsWith(root.endsWith('/') ? root : root + '/')
} Prevention
- Never weaken this guard to 'make the benchmark run' — it prevents destructive rm -rf.
- Confirm `printf %s "$HOME"` output on the target distro before each benchmark run.
- Keep instanceKey to [a-z0-9-] so it cannot break the path prefix.
When it happens
Trigger: guestHome resolves to an empty/unexpected value (e.g. WSL prints an error to stdout instead of $HOME), or instanceKey contains characters that break the path prefix check, making cleanupPaths fall outside the allowed root.
Common situations: WSL distro where `printf %s "$HOME"` returns empty or an error string, a HOME set to something other than the expected user directory, or a future refactor that changes benchmarkRoot/endpointPath without updating the prefix guard.
Related errors
- Timed out waiting for ${description}
- Could not reserve a guest port: ${result.stdout}
- This benchmark requires a Windows host with WSL
- WSL distro '${distro}' needs Node.js 18 or newer to run Orca
- advertised-url-watcher.ts no longer contains \`${marker}\`
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/204fc5e5fef93870.
Report an issue: GitHub.