Skip to content

Fix PTT higher-model context and cache boundary - #9734

Merged
Git-on-my-level merged 1 commit into
BasedHardware:mainfrom
Git-on-my-level:codex/ptt-escalation-kernel-context
Jul 14, 2026
Merged

Git-on-my-level merged 1 commit into
BasedHardware:mainfrom
Git-on-my-level:codex/ptt-escalation-kernel-context

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

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

Review in cubic

@Git-on-my-level
Git-on-my-level merged commit a3e1b74 into BasedHardware:main Jul 14, 2026
24 of 27 checks passed
kodjima33 added a commit that referenced this pull request Jul 15, 2026
…9748)

#9734 gated `ask_higher_model` on every field of the prefetched kernel
snapshot being non-empty, including the rendered context, the plan
identities, and the semantic guidance.

Rendered context is context *material*, not an availability signal.
`KernelVoiceContextSnapshot.isResolved` says so explicitly: "A valid new
conversation may render no text, but it still has a kernel session and a
deterministic freshness identity." So on the first PTT turn of a session
— nothing in the journal yet, so `renderedContext` is empty — the guard
fell through to `.failed(kernel_context_unavailable)` and the user got a
refusal instead of an answer. `RealtimeHubTools.escalationBody` already
omits each empty section on its own (`testBodyOmitsContextSectionWhenEmpty`),
so that path was unreachable, not unsafe.

Gate on the snapshot's own resolution contract instead: a kernel session
bound to the current owner scope plus a freshness identity. The `.empty`
transport-failure sentinel and an owner-scope mismatch both still fail
closed, which is what the guard was for.

Verification: xcrun swift build -c debug (clean); swift test --filter
HubEscalationTests (4/4, incl. 2 new); --filter
"RealtimeHub|RuntimeOwnerIdentity|KernelTurnRecordedProjection|FloatingControlBarState"
(164 tests, 0 failures); make preflight (8/8).
undivisible pushed a commit that referenced this pull request Aug 20, 2026
…body (#9744) (#10965)

repo-checks.yml ran the manifest on main pushes with --skip-pr-body-checks,
so product-invariants (and failure-class-protocol) were silently skipped —
even though GitHub folds the PR description, including locked invariant
citations like INV-CHAT-1, into the merge commit message. A main-push
Hygiene run therefore could not verify citations at all (#9734 merged with
the IDs in its body, yet the post-merge run reported them missing).

Pass the merge-commit body through --pr-body-file instead. Fail-closed is
preserved: a direct push whose commit message omits required invariant IDs
still fails product-invariants.

Updates the two wiring regression guards in test_run_checks.py: the
main-push path must now pass --pr-body-file (not --skip-pr-body-checks),
and body-requiring checks must be selected when a body is supplied.

Failure-Class: none

Co-authored-by: CommandCodeBot <[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.

1 participant