Skip to content

Reserve and settle pending realtime transcription work - #4455

Open
404oops wants to merge 1 commit into
fix/realtime-active-eligibilityfrom
fix/realtime-transcription-settlement
Open

404oops wants to merge 1 commit into
fix/realtime-active-eligibilityfrom
fix/realtime-transcription-settlement

Conversation

@404oops

@404oops 404oops commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

Reserve a bounded transcription window before forwarding its configuration or audio. Retain immutable committed-item identities separately from bounded completed-item history. Pause audio while an exhausted window settles, then renew its reservation. Include pending transcriptions in disconnect and response-completion settlement decisions.

Record completion once. Failure, timeout, missing usage and upstream closure use a conservative fixed fallback and release credit after recording. Capacity overflow closes the connection without evicting older unresolved identities. Distinguish missing provider realtime models from explicitly unpriced ones, and refuse unpriced models before forwarding buffered frames.

Billing policy for review: enabling input transcription reserves 64 items at $0.10896 each, or $6.97344 before deployment cost factors. The window uses the largest supported transcription cost factor and retains unused capacity until consumption or connection closure. Failed or unreported items charge the fixed per-item budget. Reservations are budgets, not caps on reported usage. These choices can refuse low-balance accounts and can charge more than actual usage when final usage is unavailable. All limits and fallback behavior are documented.

Validation: the transcription layer passed 108 relay tests; the final combined relay passed 110 tests after the completed-history helper reuse and continuation patch. Mock-provider tests cover delayed transcription-only disconnects, response.done while transcription remains pending, duplicate/late events, failure/timeout/upstream close, shared-budget exclusion, window backpressure and renewal, explicit unknown/missing/dated models, and an expensive oldest identity followed by 64 more pending items. Tests assert exact charges and hold release. No paid provider calls were made; actual provider incidence and financial loss are not measured.

Final combined validation at 7adeb371e177a9532bac5d78a3f83318d1af4757: 625 backend tests, 122 SDK conversation/history/transport tests, 10 built-SDK mock-provider tests and 3 cross-platform API checks passed. Backend build, SDK declaration checks and lint passed; repository typecheck reports no new errors with 23 known baseline errors. No paid/live provider traffic or production rollout test was run.

Stack: follow-up 5/7, overall 11/13. Based on #4454 (fix/realtime-active-eligibility). Review and merge bottom-up. The existing six-PR stack ends at #4441.

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 95.07%
⬇️ -0.03 pp
40849 / 42966
🔵 Statements 93.24%
⬇️ -0.03 pp
44864 / 48116
🔵 Functions 92.78%
⬇️ -0.05 pp
7712 / 8312
🔵 Branches 84.72%
⬇️ -0.10 pp
31354 / 37006
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/backend/services/realtime/OpenAIRealtimeRelayService.ts 90%
⬆️ +1.13 pp
82.98%
⬆️ +1.12 pp
94.21%
⬆️ +2.46 pp
92.9%
⬆️ +0.93 pp
241, 263, 353, 364, 477, 512, 594, 628, 650-651, 653, 655-656, 673, 687, 693, 705, 904, 906, 976-989, 995, 1007, 1044, 1082, 1118-1119, 1150, 1168-1169, 1205, 1208, 1278-1279, 1294, 1375, 1393, 1485-1486, 1493, 1519, 1562-1563, 1586-1591, 1595, 1602-1606, 1643, 1670, 1717, 1728, 1751-1752, 1773, 1781-1782, 1786-1790, 1793, 1805-1806, 1824, 1831, 1844-1845, 1853-1855, 1861-1863, 1889, 1906-1917, 1922, 1954
Generated in workflow #3278 for commit d5b0970 by the Vitest Coverage Report Action

@404oops
404oops added this pull request to stack #4442 November 1, 2026 18:24
@404oops
404oops force-pushed the fix/realtime-transcription-settlement branch from 455a796 to d5b0970 Compare November 1, 2026 18:26
@404oops 404oops closed this Nov 1, 2026
@404oops 404oops reopened this Nov 1, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant