Skip to content

fix(desktop): stabilize PTT agent routing - #9859

Merged
kodjima33 merged 3 commits into
BasedHardware:mainfrom
Git-on-my-level:codex/fix-ptt-spawn-voice-lane
Jul 16, 2026
Merged

kodjima33 merged 3 commits into
BasedHardware:mainfrom
Git-on-my-level:codex/fix-ptt-spawn-voice-lane

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Jul 16, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Keep background-agent spawn acknowledgements inside the active OpenAI Realtime PTT voice lane.
  • Treat an external model's local-provider enum as a proposal, not user authority: generic PTT delegation now defaults to Omi's managed agent.
  • Preserve an exact current-turn Hermes or OpenClaw request, correct a mismatched model proposal, and accept the spoken OpenCloud alias for OpenClaw.

Root cause and durable guard

An accepted spawn receipt previously claimed a deterministic local-TTS lease, stopped the native realtime stream, and treated the provider continuation as suppressed. The receipt now remains persistence-only; the existing post-tool continuation fence keeps the native provider responsible for the audible reply.

Separately, the realtime schema exposes optional local providers and the model emitted provider: "hermes" for a generic request ("Have an agent sleep for five seconds"). That enum was treated as a provider choice, which admitted a local Hermes runtime even though the user never selected it. The shared external-surface policy now owns that boundary before child-session admission: only a directed provider selection in the current user utterance may reach the control plane. Tests cover generic delegation, model/provider mismatch correction, explicit Hermes, and unavailable explicit OpenClaw.

Invariants

  • INV-AGENT-*
  • INV-CHAT-1
  • INV-VOICE-1

Failure class

Failure-Class: FC-split-mutation-authority

Verification

  • cd desktop/macos/agent && npx vitest run tests/external-surface-authority.test.ts tests/omi-tool-manifest.test.ts — 32 passed
  • cd desktop/macos && xcrun swift test --package-path Desktop --filter HubSystemInstructionTests — 17 passed
  • cd desktop/macos && ./scripts/agent-logic-harness.sh --cross-surface-smoke — Swift 76, Node 247, Rust 13 passed
  • OMI_PR_BODY_FILE=/tmp/omi-ptt-spawn-native-voice-pr.md make preflight — passed

Failure-Class: FC-split-mutation-authority

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 598de2f37a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 70 to 73
static func decide(
screenGroundingState: RealtimeScreenGroundingState,
hasCanonicalSpawnReceipt: Bool,
reducerOutputSuppressed: Bool
) -> Disposition {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restore the spawn-receipt presentation fence

For successful spawn_agent PTT turns, this policy no longer knows that acceptedSpawnJournalReceiptByContinuityKey exists, so hubDidReceiveAudio/hubDidEmitText present the provider's post-tool continuation and the turn keeps waiting for that continuation to finish. That breaks the locked product invariant in docs/product/invariants/agent-control-plane.md:84-90, which requires deterministic acknowledgement, provider-continuation suppression, and completion from the validated receipt; if the provider continues with a child-lifecycle claim or fails to continue, users get non-canonical output or a failed PTT turn after the agent was already accepted.

Useful? React with 👍 / 👎.

Failure-Class: FC-split-mutation-authority
@Git-on-my-level Git-on-my-level changed the title fix(desktop): keep PTT on native voice after agent spawn fix(desktop): stabilize PTT agent routing Jul 16, 2026
The PR changes spawn receipts to persistence-only: the native provider's
post-tool continuation is the sole audible response, replacing the previous
deterministic local-TTS acknowledgement. The invariant doc at
agent-control-plane.md:84-92 still required suppression of provider
continuations, contradicting the deliberate behavior change and the updated
tests. Align the doc with the new intended behavior.
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Monitor run — invariant doc alignment

Thread addressed: Codex P1 discussion_r3592979403 (thread PRRT_kwDOLkKqys6RVd7V)

Analysis: The P1 correctly identified that RealtimeAcceptedSpawnPresentationPolicy removal contradicted the spawn-receipt invariant in docs/product/invariants/agent-control-plane.md. However, the PR's behavior change is intentional and is the PR's core purpose: spawn receipts become persistence-only and the native provider continuation is the sole audible response (replacing the previous deterministic local-TTS acknowledgement). The PR body, updated tests (testCanonicalSpawnReceiptKeepsProviderContinuationForNativeVoiceOutput), and changelog entries all reflect this deliberate change. The bot's prescribed fix (restore the old suppression policy) would revert the PR's intended product change.

Fix applied: Updated the invariant bullet at agent-control-plane.md:84-92 to match the new behavior — the receipt is persistence-only, does not claim a local TTS lease, and the turn advances from the provider continuation rather than from the receipt. This is a docs-only change; no production code was modified.

Verification:

  • make preflight — 20/20 checks passed (including product-invariants, failure-class-protocol, desktop-changelog)
  • Desktop Swift Build & Tests — pass (15m2s)
  • Agent Runtime — pass
  • Hygiene, contracts, desktop-core-e2e-t0 — pass
  • All remaining checks pass or skip (no failures)

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fix(desktop): stabilize PTT agent routing — spawn receipt no longer hijacks voice lane, strip model-claimed provider (owner-override)

@kodjima33
kodjima33 merged commit 6737a32 into BasedHardware:main Jul 16, 2026
20 checks passed
cursor Bot pushed a commit that referenced this pull request Jul 16, 2026
Resolve merge conflicts after syncing latest main:

- Keep split RealtimeHubController modules; reject monolithic re-inline.
- Update product line-count baseline: sync.py at 1981, omit split
  transcribe.py and RealtimeHubController.swift entries.
- Port PTT agent routing (#9859) into split modules: preserve native
  provider continuation on spawn receipts, drop spawn acknowledgement
  playback, and simplify output presentation policy calls.

Co-authored-by: David Zhang <[email protected]>
Git-on-my-level added a commit that referenced this pull request Jul 16, 2026
The Desktop Swift CI workflow runs the check manifest scoped to macOS.
backend-route-policy-baseline triggers on backend/**/*.py (no platform
restriction) and requires uv via openapi_runner.sh. Without uv installed,
the check fails immediately. Every other CI workflow that runs manifest
checks already installs uv via astral-sh/setup-uv.

Also corrects swift-format drift in PushToTalkStateMachineTests.swift
after rebase onto upstream main (PR #9859 added new tests with 4-space
indentation).
Git-on-my-level added a commit that referenced this pull request Jul 16, 2026
The Desktop Swift CI workflow runs the check manifest scoped to macOS.
backend-route-policy-baseline triggers on backend/**/*.py (no platform
restriction) and requires uv via openapi_runner.sh. Without uv installed,
the check fails immediately. Every other CI workflow that runs manifest
checks already installs uv via astral-sh/setup-uv.

Also corrects swift-format drift in PushToTalkStateMachineTests.swift
after rebase onto upstream main (PR #9859 added new tests with 4-space
indentation).
Git-on-my-level added a commit that referenced this pull request Jul 16, 2026
The Desktop Swift CI workflow runs the check manifest scoped to macOS.
backend-route-policy-baseline triggers on backend/**/*.py (no platform
restriction) and requires uv via openapi_runner.sh. Without uv installed,
the check fails immediately. Every other CI workflow that runs manifest
checks already installs uv via astral-sh/setup-uv.

Also corrects swift-format drift in PushToTalkStateMachineTests.swift
after rebase onto upstream main (PR #9859 added new tests with 4-space
indentation).
undivisible pushed a commit to undivisible/omi that referenced this pull request Sep 29, 2026
* fix(desktop): keep PTT on native voice after agent spawn

Failure-Class: FC-split-mutation-authority

* fix(desktop): default PTT agents to Omi

Failure-Class: FC-split-mutation-authority

* docs: align spawn-receipt invariant with native-voice-lane behavior

The PR changes spawn receipts to persistence-only: the native provider's
post-tool continuation is the sole audible response, replacing the previous
deterministic local-TTS acknowledgement. The invariant doc at
agent-control-plane.md:84-92 still required suppression of provider
continuations, contradicting the deliberate behavior change and the updated
tests. Align the doc with the new intended behavior.

---------

Co-authored-by: David Zhang <[email protected]>
undivisible pushed a commit to undivisible/omi that referenced this pull request Sep 29, 2026
Resolve merge conflicts after syncing latest main:

- Keep split RealtimeHubController modules; reject monolithic re-inline.
- Update product line-count baseline: sync.py at 1981, omit split
  transcribe.py and RealtimeHubController.swift entries.
- Port PTT agent routing (BasedHardware#9859) into split modules: preserve native
  provider continuation on spawn receipts, drop spawn acknowledgement
  playback, and simplify output presentation policy calls.

Co-authored-by: David Zhang <[email protected]>
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.

2 participants