Repository navigation
fix(openai): prevent realtime transcription memory growth - #118204
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 6:03 PM ET / 22:03 UTC. ClawSweeper reviewWhat this changesThe PR bounds unresolved OpenAI realtime-transcription items, retained transcript text, and terminal item identity history, then clears state and closes the transport when a limit is exceeded. Merge readinessThis remains necessary: current Priority: P1 Review scores
Verification
How this fits togetherThe OpenAI realtime-transcription plugin converts provider WebSocket events into ordered partial and final transcript callbacks for voice sessions. Its provider-local ledger associates commits, predecessors, partial text, and terminal outcomes before events reach the shared WebSocket session and the voice consumer. flowchart LR
A[OpenAI realtime WebSocket events] --> B[OpenAI transcription provider]
B --> C[Provider-owned item ledger]
C --> D{Within item and text limits?}
D -- Yes --> E[Ordered transcript callbacks]
D -- No --> F[Clear ledger and close transport]
E --> G[Shared voice session]
F --> G
Decision needed
Why: The implementation is coherent and avoids unbounded retention, but it deliberately changes an exceptionally long or malformed session from automatic recovery to a visible terminal failure; that availability contract requires maintainer product and operational acceptance. Before merge
Agent review detailsSecurityNone. PR surfaceSource +167, Tests +738. Total +905 across 3 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk options
Maintainer options:
Technical reviewBest possible solution: Keep the bounds and first-terminal precedence in the OpenAI provider, and merge only if maintainers accept visible session termination plus an explicit reconnect as the correct recovery for exceptional terminal-history saturation. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible with high confidence: current Is this the best way to solve the issue? Yes, subject to the explicit availability decision: provider-local ownership is the narrowest maintainable repair because the OpenAI plugin alone owns AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7866ecae4b85. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
* origin/main: feat(gateway): track event-loop degradation persistence and add concurrency benchmark (#118193) fix(config): preserve secret ownership when configuration rows move (#118149) fix(cron): deliver failure alerts after persistence (#118200) chore(lint): clear 172 lint:all baseline violations in five batches (#118098) perf(gateway): remove streaming hot-path rescans (#118192) test(gateway): use in-memory task registry (#118191) test(macos): fix three races in the bounded process suites (#118196) refactor(migrate-hermes): consolidate test fixtures (#118182) test(android): share Wear transport fixtures (#118177) test(ui): deduplicate control UI e2e setup (#118180) fix(plugins): unblock prerelease validation (#118103) test(cli): reduce redundant process launches (#118141) test(gateway): compact terminal observer fixtures (#118179) fix(agents): make requested threads sidebar-visible (#118073) test(plugins): canonicalize native resolver fixtures (#118174) test: deduplicate agent runner fixtures (#118176) refactor(policy): consolidate doctor test fixtures (#118173) fix(plugins): remove disabled channel plugin configuration on uninstall (#118127) refactor(matrix): consolidate monitor test fixtures (#118175)
|
Owner decision for the final ClawSweeper rank-up move: I accept the explicit reconnect-at-bound contract for settled OpenAI transcription identities. The provider keeps terminal identities for the full connection generation and closes visibly at 4,096 items or 256 KiB rather than silently evicting identities, weakening first-terminal precedence, or retaining state without a bound. This is intentionally provider-local with no config or environment-variable surface. Exact head |
…transcript-bounds-20260802 * commit '565d0b4a24d741954393c4c2a79867a2680707b8': test(openai): isolate terminal history bounds test(openai): cover terminal history saturation fix(openai): preserve terminal history precedence test(openai): cover tombstone eviction ordering fix(openai): retain active predecessor satisfaction test(openai): cover rejected terminal failures fix(openai): preserve terminal error precedence test(openai): cover pre-commit terminal events fix(openai): tombstone pre-commit terminal events test(openai): pin first transcript terminal outcome fix(openai): ignore post-terminal transcript events test(openai): cover realtime transcription bounds fix(openai): bound realtime transcription state
Related: #116201
What Problem This Solves
Long-lived OpenAI realtime transcription sessions could retain item-correlation history and transcript text without a session-level bound when terminal or predecessor events were delayed or missing.
Why This Change Was Made
OpenAI-specific ordering remains provider-owned and keyed by
item_id. The provider now bounds:Overflow has one explicit owner: clear retained provider state, close the transport, and report one terminal error. Terminal identities are not silently evicted, so the first per-item terminal outcome remains authoritative for the connection generation. Duplicate or late deltas, completions, failures, and commits cannot recreate released state. Explicit reconnect starts a fresh ledger.
Owner decision: accept visible reconnect-at-bound for exceptionally long sessions. This is preferable to unbounded retention or silently weakening terminal precedence. The limit is provider-local and intentionally has no config or environment-variable surface.
Root cause: the ordering ledger introduced for asynchronous completion retained settled items for the socket lifetime and had no aggregate partial/final text budget. Architectural owner:
extensions/openai/realtime-transcription-provider.ts.Production delta: +198/-31 lines. Tests: +740/-2 lines across two focused files. The production growth is the bounded provider-local state owner, UTF-8 accounting, terminal close path, and late-event precedence. No shared provider abstraction was added.
User Impact
Healthy voice sessions preserve current transcript ordering without accumulating unbounded provider state. Malformed, stalled, or exceptionally long event streams fail visibly and can establish a fresh provider connection instead of growing memory indefinitely or delivering a duplicate terminal transcript.
No provider, config, environment-variable, protocol, public SDK, or docs surface changes.
Evidence
Exact reviewed head:
15195713985f5b069f53bbb769a9dc621ed4c7e9.tbx_01kz277881hwbjw5f9z8ztwz00.git diff --check: passed. All branch commits are signed.Review Fixes
The branch addresses every prior ClawSweeper finding: