Skip to content

fix(macos): converge agent runtime contracts - #9698

Merged
Git-on-my-level merged 1 commit into
mainfrom
codex/agent-runtime-contract-convergence
Jul 14, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
codex/agent-runtime-contract-convergence

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

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

@Git-on-my-level
Git-on-my-level force-pushed the codex/agent-runtime-contract-convergence branch from 9ca62ee to 8230433 Compare July 14, 2026 12:02
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Monitor run summary

This run rebased the branch onto the latest main (6 commits behind) and force-pushed to update the PR head. No code changes were needed — all checks were already green on the prior head, and the rebase preserved the same diff scope (74 files).

What changed: branch history only (rebase onto 5351fb6).

Verification: all CI checks pass on the new head (8230433).

@Git-on-my-level
Git-on-my-level merged commit fff4eef into main Jul 14, 2026
24 checks passed
@Git-on-my-level
Git-on-my-level deleted the codex/agent-runtime-contract-convergence branch July 14, 2026 18:24
Git-on-my-level added a commit that referenced this pull request Jul 14, 2026
Follow-up to #9680 and #9698.

## Summary

- Route PTT `ask_higher_model` through the controller's owner-scoped
kernel snapshot and reject escalation when that typed plan is
unavailable.
- Place typed semantic guidance and the cache-boundary marker in the
system contract, while retaining realtime-tool context as explicitly
untrusted user content.
- Split the Rust cache boundary before the dynamic snapshot so the
provider can cache only the stable escalation policy.

## Root cause and durable guard

#9698 established typed cache contracts and canonical conversation
context, but the PTT higher-model path still accepted
`command.input["context"]` as its escalation context. That input comes
from the realtime model and is not the controller's owner-scoped
snapshot, so it could be stale or incomplete. The tool input is
user-scoped, not privileged, but it must not replace the canonical
context contract.

The controller now builds higher-model requests exclusively from the
current owner-scoped kernel plan. Request-builder coverage asserts that
the canonical snapshot and typed cache marker stay in the system
contract while tool context is labelled untrusted user content. Rust
coverage asserts that a dynamic snapshot after the marker is never
marked cacheable.

## Verification

- `cargo fmt --manifest-path desktop/macos/Backend-Rust/Cargo.toml
--check`
- `cargo test --manifest-path desktop/macos/Backend-Rust/Cargo.toml`
(362 passed)
- `xcrun swift test --package-path Desktop --filter
'HubEscalationTests|DesktopCoordinatorServiceTests'` (34 passed)
- `python3 desktop/macos/scripts/check_desktop_test_quality.py`
- Launched named bundle `omi-ptt-escalation` with `./run.sh --yolo`;
automation bridge exercised `ptt_start` then `ptt_stop` successfully.
The available profile was signed out, so an authenticated higher-model
response could not be exercised end-to-end.
- Full `xcrun swift test --package-path Desktop` ran 2,477 tests and
reproducibly has one unrelated environment-specific failure:
`AgentRuntimeProcessTests.testOpenClawDiscoveryFindsXDGFnmInstall`
discovers the machine-global `/opt/homebrew/bin/openclaw` instead of its
XDG fnm fixture.

## Product invariants

- `INV-CHAT-1`
- `INV-VOICE-1`


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/9734?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment