Skip to content

fix(macos): preserve PTT spawn authority through barges - #9675

Merged
Git-on-my-level merged 6 commits into
BasedHardware:mainfrom
Git-on-my-level:codex/ptt-post-tool-recovery
Jul 14, 2026
Merged

Git-on-my-level merged 6 commits into
BasedHardware:mainfrom
Git-on-my-level:codex/ptt-post-tool-recovery

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Summary

  • Preserve the kernel-owned accepted spawn_agent journal authority when a PTT turn is barged or its provider closes.
  • Use that immutable authority during delayed finalization, so the app refreshes the already-recorded delegation instead of appending a second unstructured provider exchange.
  • Add bounded local diagnostics identifying the last tool, tool error code, and whether an accepted spawn existed when a provider close terminalizes PTT.
  • Keep the generated realtime list_agent_sessions schema explicit that it discovers subagents and floating-bar sessions.
  • Preserve PTT context admission while the realtime hub warms, and keep direct conversational recall content-neutral: it relies on canonical recent turns, with no password- or credential-specific policy.
  • Remove the obsolete observability work audit; the broader documentation lifecycle cleanup is tracked in Docs: eliminate temporary work-document sprawl and enforce lifecycle boundaries #9681.

Root cause and durable guard

The realtime hub kept accepted spawn ownership only in mutable transport tracking. A barge-in or provider teardown cleared that tracking while a delayed journal-finalization task was still resolving the transcript. The task then treated an already-accepted delegation as an ordinary provider response, which could duplicate the exchange and separate the child lifecycle from the PTT acknowledgment.

The interrupted-turn payload and completed-turn finalization now snapshot the accepted spawn owner before transport cleanup. The regression test drives that captured payload through the real provider-failure continuity and journal-authority policies, asserting that it refreshes the canonical spawn rather than records a second exchange.

The hub-warmup follow-up reserves the reducer effect identity before draining FIFO work, so a valid PTT context update cannot be rejected merely because it was admitted during an active drain. The policy follow-up retains the generic direct-recall requirement while avoiding content-specific memory rules. The broader shared context/cache contract is tracked in #9680.

The desktop Swift CI suite also exposed a drift in the canonical realtime tool description: the list-sessions tool remained present, but its generated schema no longer told the model that it discovers subagents. The manifest source now states that contract explicitly; its generated Swift and fixture surfaces are refreshed, while HubSystemInstructionTests exercises the emitted schema and the tool-surface test keeps generated outputs in sync.

Product invariants affected

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

Verification

  • cd desktop/macos/agent && npm test -- context-snapshot.test.ts (17 passed)
  • cd desktop/macos && xcrun swift test -c debug --package-path Desktop --filter RealtimeHubBargeInContinuityTests (53 passed)
  • cd desktop/macos && xcrun swift test -c debug --package-path Desktop --filter HubSystemInstructionTests (12 passed)
  • cd desktop/macos/agent && node --experimental-strip-types scripts/generate-tool-surfaces.mjs --check && node node_modules/vitest/vitest.mjs run tests/tool-surfaces-exhaustiveness.test.ts (9 passed)
  • cd desktop/macos && ./scripts/agent-logic-harness.sh --cross-surface-smoke (Swift/Node/Rust contract gates passed)
  • cd desktop/macos && OMI_APP_NAME="omi-ptt-spawn-recovery" ./run.sh --yolo (named dev-backend bundle built and launched; main UI rendered via accessibility snapshot)
  • enforced git push pre-push gate: 14 manifest checks, desktop debug build, and 104 desktop tool-surface tests passed.

@Git-on-my-level
Git-on-my-level force-pushed the codex/ptt-post-tool-recovery branch from 9484c19 to b6fe5fa Compare July 14, 2026 03:47
Regression coverage: targeted VoiceTurnCoordinator FIFO admission test; agent context snapshot tests. Exercised rebuilt omi-ptt-spawn-recovery bundle against dev backend.
@Git-on-my-level

Copy link
Copy Markdown
Member Author

@cursor address merge conflicts and review/fix any issues

…ecovery

# Conflicts:
#	desktop/macos/Desktop/Sources/Generated/GeneratedRealtimeTools.swift
#	desktop/macos/Desktop/Sources/Generated/GeneratedToolExecutors.swift
#	desktop/macos/agent/src/runtime/omi-tool-manifest.ts
#	desktop/macos/agent/tests/fixtures/tool-manifest.json
@Git-on-my-level
Git-on-my-level merged commit f883df6 into BasedHardware:main Jul 14, 2026
20 checks passed
Git-on-my-level added a commit that referenced this pull request Jul 14, 2026
## Summary

- Converge the desktop bridge lifecycle, canonical tool-result
envelopes, adapter conformance fixtures, one tool manifest, hermetic
local-adapter discovery, and PTT/chat context-cache contracts.
- Make bridge startup failures recoverable and enforce artifact-backed
bounded output, including the 620 KiB session-listing regression.
- Add contract fixtures, state fuzzing, anti-regrowth checks, a
changelog fragment, and manifest-gated cross-surface tests.

## Dependency

This builds on #9675, the PTT spawn-authority restoration, which has
landed on `main` and supplies the reused kernel-restore seam and
fixture/guard conventions.

## Root cause and durable guard

The runtime had multiple Swift and Node result boundaries that could
independently reinterpret lifecycle or tool results, leaving dead-end
startup failures, unbounded or lost projections, and divergent
ledger/provider outcomes. Prior fixes in this failure class fixed
individual routes without establishing a shared contract boundary.

This change centralizes lifecycle and result finalization, makes tool
provenance artifact-backed and canonical, and guards it with shared
Node/Swift fixtures, a 620 KiB persistence regression, an end-to-end
Swift result/ledger test, a sequence fuzzer, the agent-logic harness,
and the preflight check manifest.

## Verification

- `cd desktop/macos/agent && npm test -- --run && npm run build` (47
files, 555 tests)
- `cd desktop/macos && xcrun swift test --package-path Desktop` (2,436
tests)
- `cd desktop/macos && bash ./scripts/agent-logic-harness.sh
--cross-surface-smoke`
- `cd desktop/macos/Backend-Rust && cargo test routes::realtime::tests`
- `bash desktop/macos/scripts/test-tool-surfaces.sh`
- `python3
desktop/macos/scripts/check-agent-runtime-convergence-ratchet.py`
- Local named bundle `omi-agent-runtime-contract-pr` launched with its
bridge on port 47975 and navigated to Chat; the final runtime code was
confirmed in the packaged bundle. The bundle was signed out because no
reusable Omi Dev auth existed.

## Product invariants affected

- INV-AGENT-*
- INV-AUTH-1
- INV-CHAT-1
- INV-VOICE-1

Closes #9688
Closes #9658
Closes #9342
Closes #8461
Closes #9033
Closes #9680
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