Skip to content

FE-1646: Enable Petrinaut Voice in production - #9617

Merged
kostandinang merged 2 commits into
mainfrom
kostandin/fe-1646-enable-authenticated-petrinaut-voice-in-production
Sep 10, 2026
Merged

FE-1646: Enable Petrinaut Voice in production#9617
kostandinang merged 2 commits into
mainfrom
kostandin/fe-1646-enable-authenticated-petrinaut-voice-in-production

Conversation

@kostandinang

@kostandinang kostandinang commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

🌟 What is the purpose of this PR?

Enable Petrinaut Voice in production when it is explicitly configured on the server. Voice remains unavailable unless both the feature flag and dedicated OpenAI key are present.

🔗 Related links

🚫 Blocked by

None.

🔍 What does this change?

  • Allow OpenAI Voice in production when PETRINAUT_OPENAI_VOICE_ENABLED=true and OPENAI_VOICE_API_KEY is non-empty.
  • Keep Voice unavailable when either server setting is absent or invalid.
  • Update the Petrinaut website documentation for the production configuration.
  • Add policy, configuration-handler, and UI integration coverage for production availability.

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

None.

🐾 Next steps

None.

🛡 What tests cover this?

  • Policy tests cover the exact enabled value, missing or whitespace-only keys, and production availability.
  • The /api/voice/config handler test covers the production response contract.
  • The production availability integration test covers the Voice entry point appearing when Brunch and server Voice are available.
  • mise exec -- turbo run lint:tsc --filter @apps/petrinaut-website
  • mise exec -- turbo run test:unit --filter @apps/petrinaut-website (41 files, 365 tests)
  • Targeted Voice policy, configuration, and Realtime tests (19 tests)
  • oxlint --type-aware on the changed TypeScript files
  • oxfmt --check on all changed files

❓ How to test this?

  1. Configure PETRINAUT_OPENAI_VOICE_ENABLED=true, OPENAI_VOICE_API_KEY, and a valid Brunch endpoint.
  2. Start the Petrinaut website in a production-equivalent environment.
  3. Open the AI assistant and confirm that Start voice mode is available.
  4. Remove either Voice server setting and confirm that Voice is unavailable.

📹 Demo

Not applicable; this changes server-side availability and configuration behavior without changing the Voice interface.

@vercel

vercel Bot commented Sep 9, 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 9, 2026 3:28pm UTC
petrinaut-docs Ready Ready Preview Sep 9, 2026 3:28pm UTC
2 Skipped Deployments
Project Deployment Actions Updated
hash Ignored Ignored Preview Sep 9, 2026 3:28pm UTC
hashdotdesign-tokens Ignored Ignored Preview Sep 9, 2026 3:28pm UTC

Request Review

@github-actions github-actions Bot added area/infra Relates to version control, CI, CD or IaC (area) area/apps labels Sep 9, 2026
@kostandinang
kostandinang force-pushed the kostandin/fe-1646-enable-authenticated-petrinaut-voice-in-production branch from 0eb46e1 to b912e2c Compare September 9, 2026 08:33
@kostandinang kostandinang changed the title FE-1646: Enable authenticated Petrinaut Voice in production FE-1646: Enable Petrinaut Voice in production Sep 9, 2026
@kostandinang
kostandinang changed the base branch from claude/fe-1622-github-login-petrinaut-ai to main September 9, 2026 08:33
@github-actions github-actions Bot added area/deps Relates to third-party dependencies (area) area/apps > hash* Affects HASH (a `hash-*` app) area/apps > hash-api Affects the HASH API (app) type/eng > backend Owned by the @backend team area/tests New or updated tests area/apps > hash-graph and removed area/deps Relates to third-party dependencies (area) area/apps > hash* Affects HASH (a `hash-*` app) area/apps > hash-api Affects the HASH API (app) type/eng > backend Owned by the @backend team area/tests New or updated tests area/apps > hash-graph labels Sep 9, 2026
@kostandinang kostandinang self-assigned this Sep 9, 2026
@kostandinang
kostandinang marked this pull request as ready for review September 9, 2026 09:21
@cursor

cursor Bot commented Sep 9, 2026

Copy link
Copy Markdown

PR Summary

High Risk
Enables billable OpenAI Realtime sessions in production before FE-1622 authentication; same-origin checks do not stop non-browser callers from spoofing Origin.

Overview
Production Brunch Voice is no longer hard-disabled when VERCEL_ENV/NODE_ENV is production. Availability now depends only on PETRINAUT_OPENAI_VOICE_ENABLED === "true" and a non-empty trimmed OPENAI_VOICE_API_KEY, so /api/voice/config and the realtime-call path can report and accept Voice when those secrets are set.

The README is updated to describe production enablement and documents the temporary lack of caller authentication (spoofable Origin, operational kill switch, FE-1622 follow-up). Tests add policy cases for whitespace keys, exact flag casing, production availability, a config-handler check under VERCEL_ENV: production, and an integration test that shows Start voice mode when the config endpoint returns available: true.

Reviewed by Cursor Bugbot for commit 5fb9c5e. Bugbot is set up for automated code reviews on this repo. Configure here.

Co-authored-by: Cursor <cursoragent@cursor.com>
@kostandinang
kostandinang force-pushed the kostandin/fe-1646-enable-authenticated-petrinaut-voice-in-production branch from b912e2c to fc08998 Compare September 9, 2026 09:23
@lunelson

lunelson commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Two focused follow-ups before merge:

  • The README rollback guidance says to disable PETRINAUT_OPENAI_VOICE_ENABLED, but the issue/PR operating plan also calls for rotating the dedicated key when abuse is suspected. Please include that key-rotation/revocation step in the README.
  • Please cover the production microphone path from configured Brunch plus an available /api/voice/config response through to the rendered microphone action. The policy tests should also pin the fail-closed edge cases: enabled flag with a missing or whitespace-only key, and non-exact flag values such as TRUE.

The policy implementation itself looks correct; these are documentation and proof gaps.

kube
kube previously approved these changes Sep 9, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>

@lunelson lunelson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The requested documentation and coverage gaps are resolved. The production Voice rollback guidance now includes key revocation/rotation, and tests cover the configured microphone path plus fail-closed key and flag edge cases.

@kostandinang
kostandinang added this pull request to the merge queue Sep 10, 2026
Merged via the queue into main with commit 558442f Sep 10, 2026
50 checks passed
@kostandinang
kostandinang deleted the kostandin/fe-1646-enable-authenticated-petrinaut-voice-in-production branch September 10, 2026 07:54
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)

Development

Successfully merging this pull request may close these issues.

3 participants