Skip to content

live coverage: moderations, OpenAI audio, DashScope legacy, Gemini Live realtime; whole-repo quality round - #38

Merged
CMGS merged 7 commits into
mainfrom
feat/live-coverage
Aug 20, 2026
Merged

live coverage: moderations, OpenAI audio, DashScope legacy, Gemini Live realtime; whole-repo quality round#38
CMGS merged 7 commits into
mainfrom
feat/live-coverage

Conversation

@CMGS

@CMGS CMGS commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

What

Live coverage — four mock-only surfaces go live (de55b64)

  • OpenAI moderations, TTS (per-character units) and STT (whole seconds; the whisper run exercised the vendor-duration path) get live-matrix cases.
  • The DashScope legacy native wire (Protocol::Dashscope) runs against the real intl endpoint.
  • The realtime bridge's Gemini Live dialect connects for real: the Live socket is one bidi RPC authed by key (no Bearer), frames are binary, the model rides the setup frame, and a turn is admitted on clientContent.turnComplete — the dialect's own generation signal — so the old cannot-gate 501 is gone; usageMetadata settles non-estimated.

loc round (ca58229) — whole-repo audit: 541 pub items swept (zero dead), 11 mechanisms adjudicated (all earned), two cuts applied (the CSE-orphaned search_get inlined; the video read routes' shared head folded into admit_video_job), three audit-flagged coverage gaps got tests (unpinned video/search model fails config load; Kling {code,message} envelope → 502 on submit and poll; a delivered sync video reply must not register its task_id as an async job).

Codex rounds (fc89987, 729f983) — bidirectional review to convergence:

  • The wire dialect keys on the account's preset kind (Account.kind, stamped at providers: expansion) falling back to the raw provider label — a provider named gemini-prod now still speaks the Live socket; the same fix covers the video and search dialects.
  • The bridge rewrites setup.model to the entitled served model (the setup frame was a billing/entitlement bypass).
  • realtimeInput audio turns and a second clientContent during an active generation answer an in-band error until they have an admission point (no reservation queue — the minimal fix Codex prescribed).
  • The abort estimate counts Gemini serverContent parts, so a disconnect after delivery bills instead of refunding.
  • Round-3 verdict: CONVERGED (all four findings resolved as written; no speculative hardening added).

Net: rust prod +122, tests +20, docs/harness +154.

E2E (live, real keys, billing oracle per row)

Full matrix on the final code: 129/133 effective-green — 125/129 in the main run plus gemini-rt and 3 Ollama cases re-verified green after an environment fix (the Ollama container had been cleaned up mid-run). The remaining 4:

  • kling-v1-6: 429 Account balance not enough — the trial package was deliberately burned to exhaustion in the PR 36 verification; vendor-side, re-arms on recharge.
  • Skipped: Bedrock group (the long-term key 401s on a direct curl since 08-19 — needs a new key); Google CSE (API closed to new customers, removed in PR 37).
  • Highlights: gemini realtime settles 146/24 tokens non-estimated with the transcript through the gateway; whisper bills 2 s off the vendor's own duration; DashScope legacy wire matches the oracle; sora/wan/hailuo/xai video, brave search, realtime OpenAI, and all 11 chat vendors green as before.

Performance

A/B bench vs main (b545e5e), 10 interleaved reps both orders: serial 51.2→51.1 ms/2000 (−0.3 %), p50 25 µs identical, concurrent 202.7k→203.9k rps (+0.6 %), big-payload p50 −0.3 % / p99 −1.4 %. The final commit touches only a gemini-session frame check. No regression.

Gates

cargo fmt --check / clippy -D warnings / cargo test --workspace: 544 passed / 0 failed; ruff clean on the harness. Docs updated: providers.md (gemini realtime row, kind-based dialect keys), api.md (realtime dialect contract), development.md (matrix scope).

CMGS added 7 commits August 20, 2026 03:14
…ni Live realtime

Four mock-only surfaces go live. OpenAI moderations and TTS/STT get
matrix cases (characters and whole seconds land as billed units — the
whisper run exercised the vendor-duration path). The DashScope legacy
native wire runs against the real intl endpoint. The realtime bridge's
Gemini dialect connects for real: the Live socket is one bidi RPC authed
by key with the model in the setup frame, its frames are binary, and a
turn is admitted on clientContent.turnComplete — the dialect's own
generation signal — so the old cannot-gate 501 goes away; usageMetadata
settles the turn non-estimated (verified live: prompt 146 / completion
24 audio tokens, transcript through outputAudioTranscription).
…he video reads

The whole-repo audit (541 pub items swept, 11 mechanisms adjudicated)
returned two cuts: SearchEngine::search_get lost its second caller with
the CSE removal and folds back into the Brave arm; the two video read
routes shared a verbatim admit+resolve+poll head that now lives whole in
admit_video_job. Three audit-flagged coverage gaps get their tests:
unpinned video/search models fail config load, a Kling business-error
envelope is a 502 on submit and poll, and a delivered sync video reply
must not register its task_id as an async job.
…s, estimates

Codex round: the wire dialect now keys on the account's preset kind
(Account.kind, stamped at providers: expansion) falling back to the raw
provider label, so a provider named gemini-prod still speaks the Live
socket — the same fix covers the video and search dialects. The bridge
rewrites a gemini setup.model to the entitled served model (the socket
carries no model, so the setup frame was a billing/entitlement bypass),
refuses realtimeInput loudly until audio turns have an admission point,
and the abort estimate counts gemini's serverContent parts so a
disconnect after delivery bills instead of refunding.
Codex round 2: a clientContent.turnComplete arriving while a turn is
pending would relay ungated and bill unreserved once the interrupted
turn consumed the reservation; it now answers the same in-band error as
realtimeInput. Docs carry the dialect contract.
The wire_kind insertion had orphaned base_url's doc onto the wrong item;
the synthesized account's push-time kind was dead (the provider loop
stamps every matching account two lines later); the output-delta doc
names both dialects; the stale azure→Sora doc claim goes.
…apshot

The Live API may send cumulative usageMetadata on any server frame; only
reading it off the turnComplete frame degraded a split delivery to the
prompt=0 output estimate. Each usage-bearing frame overwrites one
snapshot, every boundary consumes it — used only when the boundary
itself is bare, so same-frame usage and the estimate/refund fallbacks
are unchanged.
A session dropped before turnComplete used to bill the byte estimate
with prompt=0 even when a periodic usageMetadata frame had already
reported real counts. A leftover snapshot now bills real prompt, audio
modality shares, and max(reported, delivered-estimate) completion; the
estimate/refund path is unchanged when no snapshot exists. The audio
extraction takes the usage object directly (gemini_audio_tokens) instead
of wrapping it in a synthetic frame.
@CMGS
CMGS merged commit ae5e240 into main Aug 20, 2026
2 checks passed
@CMGS
CMGS deleted the feat/live-coverage branch August 20, 2026 03:16
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