mirror of
https://github.com/stablyai/orca.git
synced 2026-10-21 16:03:26 +00:00
Why: WSL filesystem access can stall when a distro hangs, and stalled operations must degrade gracefully rather than misreport as "not found". Distinguish gate refusals (timeout, capacity, unavailable) from actual missing files so callers can retry or fall through to alternatives. Fail fast when stuck I/O holds a permit to prevent caller pileup. Route-level sequencing and waiter deadlines keep one stalled distro from blocking others.
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
|
|
const mocks = vi.hoisted(() => ({
|
|
resolve: vi.fn<() => Promise<string | null>>()
|
|
}))
|
|
|
|
vi.mock('./session-file-resolver', () => ({
|
|
resolveSessionFilePath: mocks.resolve
|
|
}))
|
|
|
|
import { readNativeChatTranscriptTail } from './transcript-tail-reader'
|
|
import { WslTranscriptFsError } from './wsl-transcript-fs-gate'
|
|
|
|
describe('native chat transcript tail under WSL gate refusals', () => {
|
|
beforeEach(() => {
|
|
mocks.resolve.mockReset()
|
|
})
|
|
|
|
it('reports a gate refusal as a retryable error, not a missing transcript', async () => {
|
|
mocks.resolve.mockRejectedValueOnce(new WslTranscriptFsError('timeout', 'slow share'))
|
|
|
|
await expect(
|
|
readNativeChatTranscriptTail({ agent: 'codex', sessionId: 'session-id', limit: 10 })
|
|
).resolves.toEqual({ error: 'slow share' })
|
|
})
|
|
|
|
it('rethrows non-gate resolver failures', async () => {
|
|
mocks.resolve.mockRejectedValueOnce(new Error('resolver crashed'))
|
|
|
|
await expect(
|
|
readNativeChatTranscriptTail({ agent: 'codex', sessionId: 'session-id', limit: 10 })
|
|
).rejects.toThrow('resolver crashed')
|
|
})
|
|
})
|