Repository navigation
test(deepgram): observe realtime transcription completion - #134383
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 2:53 PM ET / 18:53 UTC. ClawSweeper reviewWhat this changesThe PR replaces polling-based Deepgram realtime WebSocket test waits with callback-backed completion signals and adds failure-safe session cleanup. Merge readinessKeep open for normal maintainer review. The focused test-only change makes completion observation deterministic while preserving the Deepgram session’s real callback and close paths; current main still has the polling-based tests, and the maintainer label prevents automated cleanup closure. Priority: P3 Review scores
Verification
How this fits togetherThe Deepgram plugin receives realtime WebSocket frames and converts them into partial, final transcript, speech-start, and error callbacks for OpenClaw’s shared transcription session. These tests drive that plugin against a local socket server and verify ordered callback delivery and close-time finalization. flowchart LR
A[Local WebSocket fixture] --> B[Deepgram realtime session]
B --> C[Frame and close handling]
C --> D[Transcript and error callbacks]
D --> E[Completion observation]
E --> F[Assertions and cleanup]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +75. Total +75 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Land the callback-backed waits and ordered delivery markers once exact-head CI is complete, retaining the existing local WebSocket fixture as the real provider-session boundary. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR improves test synchronization rather than reporting a user-facing incident. The supplied local fixture evidence describes the relevant callback and cleanup scenario. Is this the best way to solve the issue? Yes. The changed waits observe the actual provider-session callbacks, while marker frames cover ordered multi-frame assertions that mock-count polling could complete before fully observing. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 33029a1feb0a. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Maintainer source/test review is complete. The latest published ClawSweeper comment is the review-started placeholder, with no findings or Rank-up moves; it is not a substantive review. Independent Codex autoreview, full changed checks, all 69 selected provider/shared WebSocket tests and exact-head CI pass. The missing-signal diagnostic retained the original waitFor timeout, drained both close/finalization timers, emitted Finalize and the retained transcript once, completed real server teardown without unhandled errors, and restored exact source after joined processes. Ordered final-frame markers protect the negative/count cases, and overflow disconnection is asserted before cleanup. Production +0/-0; tests +116/-41. Proceeding through native landing gates under the requested maintainer test-maintenance batch. |
|
Merged via squash.
|
What problem does this PR solve?
Deepgram's local WebSocket tests poll mock call counts after frames have already arrived. Two count-based waits can also complete before the final fixture frame is processed.
Why this approach?
Resolve bounded completion promises from the existing provider callbacks. The two multi-frame negative/count cases wait for a distinct final error marker on the same ordered WebSocket before asserting the complete callback history. Keep the existing fake-clock deadline tests and production timeouts unchanged.
Each changed session owns close in finally. If the no-result finalization case fails before installing its clock, cleanup installs the clock before close and drains the existing five-second fallback window. The overflow case now checks disconnection before test cleanup.
User impact
Test-only change: production +0/-0; tests +116/-41. Eight positive polling observations become callback-backed waits; all 18 Deepgram cases and their existing semantic assertions remain. Local sockets and the real provider/session owners remain in use.
Evidence
All 69 selected Deepgram, ElevenLabs and shared WebSocket tests pass before and after. Full changed-file checks and Codex autoreview pass.
A deliberate missing completion signal produced exactly the original one-second waitFor failure. Before real server teardown, cleanup had drained both timers, emitted one Finalize request and the retained transcript once, and marked the session disconnected. Real server teardown completed, Vitest reported no unhandled errors, and the joined probe restored exact source bytes. This is local transport and failure-cleanup proof, not a live provider result or an elapsed-time benchmark.
node scripts/run-vitest.mjs extensions/deepgram/realtime-transcription-provider.test.ts extensions/elevenlabs/realtime-transcription-provider.test.ts src/realtime-transcription/websocket-session.test.ts