Skip to content

H-6763: Improve voice preview reliability diagnostics - #9378

Merged
lunelson merged 10 commits into
mainfrom
kostandin/h-6763-voice-preview-reliability
Sep 1, 2026
Merged

H-6763: Improve voice preview reliability diagnostics#9378
lunelson merged 10 commits into
mainfrom
kostandin/h-6763-voice-preview-reliability

Conversation

@kostandinang

@kostandinang kostandinang commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🌟 What is the purpose of this PR?

This PR hardens the disabled-by-default OpenAI voice preview introduced by the lower H-6763 stack. It adds actionable, privacy-safe diagnostics and closes failure-handling gaps so developers can distinguish permission, device, network, timeout, abort, provider-response, transcription, and playback failures.

The scope is reliability and observability only. It does not enable production voice or add the authentication, distributed quotas, replay/recovery, completion, and projection contracts required for production use.

🔗 Related links

🚫 Blocked by

🔍 What does this change?

  • Defines a sanitized voice-error taxonomy covering microphone permission/device failures, aborted requests, network errors, timeouts, invalid responses, and unavailable preview endpoints.
  • Adds validated UUID request correlation plus content-free timing diagnostics across browser connection/transcription/playback, website voice routes, and the existing Brunch inspection join.
  • Adds valid Server-Timing metrics while explicitly excluding audio, SDP, transcripts, prompts, canonical speech, credentials, and provider response bodies from diagnostics.
  • Makes startup and teardown deterministic across timeout, disconnect, stale-event, malformed-response, provider-error, and reconnect paths; aborts remain classified as request-aborted while SDP is read or applied.
  • Prevents late answer delivery from overwriting active playback or a speech failure.
  • Adds a fully local mocked boundary test spanning WebRTC setup, transcript delivery, the composer/Brunch boundary, canonical response selection, speech streaming, and playback.
  • Updates the website README, Petrinaut user guide, ADR-0009, and Brunch steering documentation.

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • does not modify any publishable blocks or libraries, or modifications do not need publishing

📜 Does this require a change to the docs?

The changes in this PR:

  • require changes to docs which are made as part of this PR

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

⚠️ Known issues

  • Production voice remains disabled; this PR does not close the production gates recorded in ADR-0009.
  • Verification uses local mocks and fixtures. No live microphone, OpenAI Realtime/Speech request, or configured remote Brunch conversation was exercised.
  • Existing production-build chunk-size warnings are unchanged.

🐾 Next steps

  • Land after H-6763: Speak finalized Brunch responses with OpenAI #9357 as part of the H-6763 stack.
  • Address authentication, distributed quotas, replay/recovery, production telemetry, completion, and projection contracts before enabling production voice.
  • Capture a credentialed browser witness separately from deterministic automated coverage.

🛡 What tests cover this?

  • yarn workspace @apps/petrinaut-website test:unit — 17 files and 109 tests, including the mocked browser-to-playback boundary.
  • yarn workspace @apps/petrinaut-website lint:tsc and lint:eslint — website type and lint coverage.
  • Focused regressions cover startup, permission/device failures, network failures, request aborts, timeouts, malformed/provider responses, request-ID validation, teardown, reconnect/stale-event rejection, media cleanup, and late delivery races.
  • Brunch app and transport unit suites cover the inspection join used by voice diagnostics.
  • CI covers package builds, formatting, documentation, architecture checks, and Semgrep.

❓ How to test this?

  1. Check out this branch with H-6763: Speak finalized Brunch responses with OpenAI #9357 beneath it.
  2. Run yarn workspace @apps/petrinaut-website test:unit.
  3. Run yarn workspace @apps/petrinaut-website lint:tsc and yarn workspace @apps/petrinaut-website lint:eslint.
  4. Confirm the local integration test crosses the mocked browser → voice route → transcript → composer/Brunch → canonical speech → playback path.
  5. Confirm serialized diagnostics contain request IDs, timing, stage, operation, and sanitized error codes, but none of the private fixture payloads.
  6. Do not point tests at a remote Brunch endpoint or real OpenAI credentials without separate approval.

📹 Demo

Not included. This PR changes reliability, diagnostics, and automated coverage rather than the interaction design, and no credentialed external voice flow was run.

@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
petrinaut Ready Ready Preview Sep 1, 2026 3:49pm UTC
petrinaut-docs Ready Ready Preview Sep 1, 2026 3:49pm UTC
2 Skipped Deployments
Project Deployment Actions Updated
hash Ignored Ignored Preview Sep 1, 2026 3:49pm UTC
hashdotdesign-tokens Ignored Ignored Preview Sep 1, 2026 3:49pm UTC

Request Review

@github-actions github-actions Bot added area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team area/apps labels Aug 27, 2026
@CLAassistant

CLAassistant commented Aug 27, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Comment thread apps/petrinaut-website/src/voice-diagnostics.ts
Comment thread apps/petrinaut-website/src/voice-diagnostics.ts Outdated
Comment thread apps/petrinaut-website/src/voice-diagnostics.ts Fixed
Comment thread apps/petrinaut-website/src/voice-diagnostics.ts Fixed
@cursor
cursor Bot changed the base branch from kostandin/h-6763-openai-canonical-speech to graphite-base/9378 September 1, 2026 13:21
@kostandinang
kostandinang force-pushed the kostandin/h-6763-voice-preview-reliability branch from fdb0482 to fd8c6b4 Compare September 1, 2026 13:29
@kostandinang
kostandinang changed the base branch from graphite-base/9378 to kostandin/h-6763-openai-canonical-speech September 1, 2026 13:29
lunelson
lunelson previously approved these changes Sep 1, 2026
@cursor

cursor Bot commented Sep 1, 2026

Copy link
Copy Markdown

Merge activity

  • Sep 1, 2:58 PM UTC: Graphite rebased this pull request, because this pull request is set to merge when ready.

lunelson
lunelson previously approved these changes Sep 1, 2026
kostandinang and others added 10 commits September 1, 2026 17:09
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Reject provider failures and already-closed data channels immediately so voice startup cannot succeed with unusable resources.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Exercise typed speech failures and assert their diagnostic metadata instead of expecting the obsolete unsanitized fallback message.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

4 participants