Support 16 kHz voice and repair recurring CI failures - #30
Merged
Conversation
dimavrem22
marked this pull request as ready for review
September 7, 2026 20:22
|
| Filename | Overview |
|---|---|
| src/gateway/voice/audio.ts | Introduces negotiated call-format selection and bidirectional conversion between call media and realtime PCM. |
| src/gateway/voice/pcm-resampler.ts | Adds a stateful windowed-sinc PCM16LE resampler with fragmented-sample handling and response-scoped reset behavior. |
| src/gateway/voice/bridge.ts | Defers realtime greeting startup until the call start frame selects the delivered audio format. |
| src/gateway/voice/realtime.ts | Switches realtime audio to 24 kHz PCM and integrates conversion, response flushing, and interruption resets. |
| src/gateway/sessions.ts | Retains hosted side-effect guards until the host is idle and the assistant reports a terminal finish. |
| .github/workflows/tests.yml | Replaces the source SDK checkout and build with installation of the pinned published SDK. |
Sequence Diagram
sequenceDiagram
participant Caller
participant Bridge as Call Bridge
participant Audio as CallAudio
participant RT as Realtime API
Caller->>Bridge: start(media_format)
Bridge->>Audio: select 16 kHz PCM or 8 kHz PCMU
Bridge->>RT: start greeting
Caller->>Bridge: negotiated audio frames
Bridge->>Audio: decode and resample to 24 kHz PCM
Audio->>RT: input_audio_buffer.append
RT->>Audio: 24 kHz output audio deltas
Audio->>Bridge: resample and encode call audio
Bridge->>Caller: outbound media
RT->>Audio: audio done
Audio->>Bridge: flush response tail
Bridge->>Caller: audio done
Reviews (5): Last reviewed commit: "test: restore unassisted hosted SMS scen..." | Re-trigger Greptile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Executive Summary
Enable 16 kHz call audio and repair recurring CI installation and live-test failures.
Description
The call WebSocket advertises
X-Inkbox-Audio-Format: pcm_s16le_16000. The bridge waits for the start frame before speaking, selects the delivered format, and converts mono PCM between 16 kHz call media and the realtime connection's required 24 kHz format. Streaming resampling retains chunk boundaries, filters downsampling aliases, and flushes each response independently. Legacy 8 kHz call descriptors remain supported; unsupported formats terminate clearly.CI now installs the pinned published SDK instead of a source link that fails during dependency resolution. Live discovery reads retry connection establishment failures without repeating submissions. The progress scenario stays active long enough to observe two complete periodic updates, and the auxiliary summary has a bounded 20-second response window. The hosted voice test uses the original single caller request, with no reminder or re-ask; action persistence and single-delivery assertions remain unchanged. Post-call execution and correction prompts explicitly preserve caller-specified message bodies verbatim instead of substituting acknowledgements or summaries. Hosted SMS guards now remain active through host retries and intermediate tool steps; a completed step timestamp is not mistaken for final turn completion.
Reason
Raw call audio should preserve wideband speech, and CI should exercise plugin behavior instead of failing in obsolete setup paths or racing task completion against progress delivery.
Decisions
Testing
npm test: 891 tests passed, including wideband frequency preservation, anti-alias filtering, fragmented samples, response resets, protocol headers, and call-start ordering.npm run lint,npm run typecheck, andnpm run build: passed.python3 -m unittest tests/live/test_a2a_preflight.py: four tests passed, including bounded connection retry and non-retryable errors.Incoming and outgoing realtime calls: expect natural-speed two-way audio and prompt interruption; the outgoing realtime live check also requires a 16 kHz negotiation event correlated to that call. Passed on
6a11507, including the exact-call 16 kHz negotiation assertion and the unchanged two-way speech checks.A2A long-running task: expect a prompt receipt, two nonterminal periodic updates, and the correct final result; all five A2A scenarios passed on
6a11507.Unassisted full-stack validation: all lanes passed on
6a11507(mock/real channels, five A2A scenarios, three voice scenarios, external events). The hosted scenario passed in 76 seconds using the original single caller request: one persisted action before hangup, completed post-call settlement, and exactly one accepted SMS containing the requested marker to the current caller. No caller reminders or re-asks. This supersedes the earlier reminder-assisted hosted result; full SMS-body byte equality is not asserted.Focused post-call completion, durable SMS guard, send boundary, and host-session checks: 83 passed on
6a11507.Guard lifecycle regressions: retry, intermediate tool/unknown finishes, and a timestamp without a terminal finish cannot release the hosted send guard; the original three cases fail against the preceding implementation.