Skip to content

H-6763: Add temporary Brunch ask shim for Voice preview - #9507

Open
kostandinang wants to merge 3 commits into
kostandin/h-6763-prevent-inferred-voice-answersfrom
kah-6763-temporary-brunch-ask
Open

H-6763: Add temporary Brunch ask shim for Voice preview#9507
kostandinang wants to merge 3 commits into
kostandin/h-6763-prevent-inferred-voice-answersfrom
kah-6763-temporary-brunch-ask

Conversation

@kostandinang

@kostandinang kostandinang commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🌟 What is the purpose of this PR?

Temporary Voice-preview compatibility shim. This does not complete Mission 3 or Mission 4 and does not provide durable elicitation or canvas writes. Migrate or remove it after Mission 4 lands.

Mount the real brunch_ask client tool on Brunch's current ChatAgent so the existing Petrinaut Voice preview and widget can receive real Brunch questions and return answers through the existing client-tool resume path.

This PR only enables real Brunch questions and Voice/widget answers. The independently useful Voice interaction improvements are separated into #9512.

🔗 Related links

🚫 Blocked by

🔍 What does this change?

  • Adds a Flue brunch_ask client tool using the canonical ASK_TOOL_NAME and AskInput; it returns { awaiting: "client" } with terminate: true.
  • Mounts the tool in the real ChatAgent, registers it as client-executed for AI SDK projection, and instructs the agent to ask one concise interview question per turn, wait for the correlated result, treat { answer } as the user's answer, and never claim a canvas modification.
  • Reuses the generic client-tool-result signal path in petrinaut-chat.ts; no specialized ask-admission protocol is restored.
  • Extends the production-path test through ping, readPetrinautDoc, pending brunch_ask, browser { answer } submission, and continuation of the same persisted Flue conversation.
🏗️ Agent notes

Imperative: Unblock Voice interview testing against the real Brunch endpoint now, without waiting for the durable Mission 4 architecture.

Throughline: Petrinaut AI SDK /api/chat → production ChatAgent → pending brunch_ask client tool → existing client-tool-result signal → the same Flue conversation continues.

Proof: The integration test observes the real agent emit brunch_ask, projects it as input-available without providerExecuted or a server output, submits { answer }, and observes the next turn plus persisted history. Existing ping and readPetrinautDoc checks remain.

Constraints: No useElicitation, elicitor agents, ask-admission protocol, sweeps, folds, completion accounting, capture-store wiring, canvas mutation, or canonical-speech changes. The interviewer tool history is exactly activate_skill, ping, readPetrinautDoc, and brunch_ask.

Fog-line: This shim deliberately does not decide the durable elicitation or canvas-write architecture. Mission 4 owns that boundary.

Stop or reorient: Migrate the shim to the Mission 4 architecture, or remove it in favor of that architecture, after Mission 4 lands.

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • does not modify any publishable blocks or libraries

📜 Does this require a change to the docs?

The changes in this PR:

  • are an internal temporary compatibility path and do not require a docs change

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

The changes in this PR:

  • add a workspace dependency through package.json; Turborepo derives the edge without a turbo.json change

⚠️ Known issues

This is intentionally not durable elicitation. It does not write captures or the Petrinaut canvas, and it must not survive Mission 4 unchanged.

🐾 Next steps

🛡 What tests cover this?

  • yarn workspace @apps/brunch-agent test:unit — 10 files, 42 tests
  • yarn workspace @apps/brunch-agent lint:tsc
  • yarn workspace @apps/brunch-agent lint:eslint — 0 errors; 8 pre-existing warnings in untouched files
  • yarn workspace @apps/brunch-agent build
  • Focused formatting and git diff --check

❓ How to test this?

  1. Check out this stacked branch and run the Brunch server with the Petrinaut Voice preview.
  2. Explicitly request an interview and confirm the assistant emits a real Brunch question.
  3. Answer through Voice or the widget and confirm the same conversation continues with the correlated answer.
  4. Confirm no Petrinaut canvas mutation occurs.

📹 Demo

Not recorded.

@kostandinang
kostandinang requested a review from a team as a code owner September 2, 2026 17:24
@vercel

vercel Bot commented Sep 2, 2026

Copy link
Copy Markdown

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

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

Request Review

@cursor

cursor Bot commented Sep 2, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Extends the production chat agent and client-tool transport contract for interviews; behavior is scoped to a temporary shim with no canvas mutation, but it affects live conversation turns and resume semantics.

Overview
Adds a temporary brunch_ask client-executed Flue tool so Petrinaut Voice/widget can run real interview questions through the existing /api/chat client-tool resume path, without Mission 4 elicitation or canvas writes.

The new tool returns { awaiting: "client" } and terminates the turn; ChatAgent mounts it and is instructed to call it on explicit interview requests, ask one question per turn, wait for client-tool-result, and treat { answer } as the user reply. brunch_ask is registered alongside readPetrinautDoc in the client-tool set, and ask calls are projected to the AI SDK as dynamic-tool with dynamic: true in the live stream (other client tools stay tool-*).

Integration and transcript tests now cover pending ask, answer resume, persisted history, and the full probe flow (ping, docs, ask, answer continuation).

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

@kostandinang kostandinang changed the title Add temporary Voice-preview Brunch ask shim H-6763: Add temporary Brunch ask shim for Voice preview Sep 2, 2026
TimDiekmann
TimDiekmann previously approved these changes Sep 2, 2026

@TimDiekmann TimDiekmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

infra ✅

Comment thread apps/petrinaut-website/src/server/voice/openai-voice-policy.ts Outdated
Comment thread apps/petrinaut-website/src/main/app/voice-interview/openai-realtime-session.ts Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 880213f. Configure here.

Comment thread apps/brunch-agent/src/flue-ui-stream.ts
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs September 2, 2026 20:19 Inactive
@vercel
vercel Bot temporarily deployed to Preview – petrinaut September 2, 2026 20:19 Inactive
kostandinang and others added 3 commits September 2, 2026 22:26
Temporary Voice-preview compatibility shim. This does not complete Mission 3 or Mission 4 and does not provide durable elicitation or canvas writes. Migrate or remove it after Mission 4 lands.

Amp-Thread-ID: https://ampcode.com/threads/T-01a06317-621a-71b3-bcf1-16befbbdd6ff
Co-authored-by: Amp <amp@ampcode.com>
Temporary Voice-preview compatibility shim. This does not complete Mission 3 or Mission 4 and does not provide durable elicitation or canvas writes. Migrate or remove it after Mission 4 lands.

Amp-Thread-ID: https://ampcode.com/threads/T-01a06317-621a-71b3-bcf1-16befbbdd6ff
Co-authored-by: Amp <amp@ampcode.com>
Reconstruct persisted brunch_ask parts with the same dynamic-tool shape as the live stream so reloaded Voice sessions retain pending questions.

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/deps Relates to third-party dependencies (area) area/tests New or updated tests

Development

Successfully merging this pull request may close these issues.

2 participants