fix(stt): bound provider lifecycles - #163
Conversation
|
Thanks, Enver. Your continued work on the STT path is much appreciated, and this one closes a real hole: an abandoned caller pinned an admission slot until the provider settled. The fix is sound and the tests are thorough. Two asks before I merge:
One judgment call I leave to you: a cancelled request is audited as |
|
Thanks, @AltanS. C now uses native |
Summary
Bounds STT provider work to the request that owns it.
AbortSignal.timeoutand caller-firstAbortSignal.any, while preserving the winning source/reason needed to distinguish caller cancellation from a provider deadline.Failure modes fixed
An abandoned caller could previously leave a two-slot admission occupied until a noncooperative provider settled. Codex work could also extend beyond its intended lifecycle budget across auth, retries, response bodies, or identity probing, making failure handling unbounded. This change releases abandoned admissions and carries the owning lifecycle through those paths.
Compatibility
Wire and audit schemas remain unchanged; caller cancellation now completes promptly through the existing
400 stt.unreadable/ auditinvalidmapping with the known audio byte count, rather than waiting for a late provider outcome. The 8MiB request cap, OpenAI's no-retry policy and 256KiB response cap, Codex identity order, and Codex's single retry are unchanged. The numeric admission limit remains two, but it now bounds requests Collie is still waiting on rather than every provider operation still in flight. Owned fetch and response-body work aborts with the caller lifecycle; owned Codex brokers retain explicit disposal, while shared broker work is intentionally not canceled. Noncooperative late work remains rejection-observed, with nonblocking best-effort response-reader cleanup. There is no request-intake streaming or request-body/upload deadline,Bun.serveor server-timeout manipulation, or server, web, configuration, dependency, version, or changelog change.Validation
collie-ctlsuite.cd web && NODE_OPTIONS=--no-experimental-webstorage bun run test— 181 files passed, 5029 tests passed, 30 todo.DOMException(..., "TimeoutError")mapping toSttCancelledError.The native Darwin full root test reaches only the unchanged upstream Linux
systemd-runassertion atscripts/collie-cli.test.sh:1308; GitHub Ubuntu CI is required for that assertion. Tests use injected fetches, brokers, and streams, with no external provider or network calls, Codex process, browser, or microphone.