Skip to content

fix(ptt): retain source evidence across voice and chat - #13074

Merged
Git-on-my-level merged 7 commits into
mainfrom
codex/durable-agent-runtime
Sep 8, 2026
Merged

Git-on-my-level merged 7 commits into
mainfrom
codex/durable-agent-runtime

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Sep 8, 2026 •

Copy link
Copy Markdown
Member

PTT could acknowledge “remember this” while retaining only the spoken exchange. A later question could then be answered from that acknowledgement after the original screen context disappeared.

Retain bounded screen OCR and text attachments on their producing conversation-journal turns, with capture provenance and explicit pending/partial/unavailable states. Voice and typed chat share source read/search tools beyond the recent prompt window, and the existing operation ledger supplies action outcomes. Native capture runs alongside audio; cancelled turns release their reservations, slow admitted writes retain their source, and failed frozen captures cannot recapture an Omi overlay under the original app identity. Tool instructions distinguish retaining a source from creating a future task or reminder. Review fixes also bound the encoded envelope including JSON escaping, preserve record retries after evidence attachment, and omit malformed evidence during backend sync without leaking raw source data or blocking the rest of the turn.

Validation:

  • OMI_PR_BODY_FILE=… make preflight: all 31 selected checks passed (79 seconds).
  • ./scripts/agent-logic-harness.sh --swift-only: 787 tests passed after native lifecycle integration, including late OCR, cancellation capacity, slow/rejected admission, owner boundaries, and capture-selection spies.
  • Rebased runtime harness: 867 runtime tests and 137 extension tests passed; bash scripts/test-tool-surfaces.sh passed.
  • An earlier isolated candidate compiled, signed, and installed. Generated-speech PTT and a typed follow-up exercised its real missing-permission path and correctly reported unavailable screen evidence. The latest review fixes passed local compilation/tests; they have not been verified in a newly launched named bundle.
  • Positive visual recall, the original screenshot replay, physical microphone testing, and the full live continuity/prompt suites remain unverified: the isolated app launcher is waiting for protected Keychain authentication. The new synthetic evidence suite and manual flow are included; their presence is not a passing live result.
  • A controlled interleaved probe on one synthetic database with 500 65KB sources measured source-search median 163ms with the initial PR query and 93ms with the revised query (10 samples each). The query pages revision identities before loading source text. This is local runtime work, not end-to-end PTT latency; no latency or cost parity claim is made.

Invariants: INV-AGENT-*, INV-AUTH-1, INV-CHAT-1, INV-VOICE-1. The existing journal remains the interaction/evidence owner; no new durable store or product-memory tier is introduced. Full source bodies are retained locally and redacted from backend journal sync; model-facing source data cannot grant tool authority. Owner and conversation-generation boundaries fence reads and operation receipts. Retrieval has bounded prompt overhead and may add a tool round trip; retaining evidence itself adds no model call. Native behavioral tests use the same terminal policy and producing-row identities as production, following the chat-continuity contract.

Failure-Class: FC-split-mutation-authority

Line-Count-Exception: desktop/macos/Desktop/Sources/FloatingControlBar/FloatingControlBarWindow.swift | 5945 -> 5968 | Forward evidence through existing journal admission and bind fallback voice sources to the accepted producing row; evidence policy remains extracted
Line-Count-Exception: desktop/macos/Desktop/Sources/FloatingControlBar/PushToTalkManager.swift | 4016 -> 4060 | Bind concurrent frozen capture and dictation admission to the existing native persistence lifecycle; evidence policy remains extracted
Line-Count-Exception: desktop/macos/Desktop/Sources/FloatingControlBar/RealtimeHubController+SessionLifecycle.swift | 1683 -> 1734 | Carry frozen evidence through existing successful-terminal and fallback admission paths without introducing another transcript owner
Line-Count-Exception: desktop/macos/Desktop/Sources/FloatingControlBar/RealtimeHubController.swift | 1578 -> 1583 | Add the bounded native evidence obligation tracker and revoke it at the existing owner-quiesce boundary
Line-Count-Exception: desktop/macos/Desktop/Sources/Providers/ChatProvider.swift | 7398 -> 7404 | Attach selected-file evidence at the existing typed-turn admission boundary; file extraction lives in ChatAttachmentEvidence

Failure-Class: FC-split-mutation-authority
Retain sources through allowed slow journal writes, release abandoned captures, bind fallback voice sources to their producing rows, and never recapture an overlay under a frozen source identity.

Validation: agent-logic-harness.sh --swift-only passed 777 tests. Named-app live positive recall remains blocked on protected Keychain authentication; no end-to-end success claim.

Failure-Class: FC-realtime-context-evidence-ownership

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 61 files

Confidence score: 3/5

  • In desktop/macos/agent/src/runtime/backend-turn-projection.ts, conversationEvidenceForBackend directly validates legacy evidence, so malformed evidence can throw during journal delivery/sync and prevent affected turns from being processed — handle invalid evidence without aborting the sync path.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="desktop/macos/agent/src/runtime/backend-turn-projection.ts">

<violation number="1" location="desktop/macos/agent/src/runtime/backend-turn-projection.ts:25">
P2: The journal delivery/sync path now throws on turns that carry malformed legacy evidence. `conversationEvidenceForBackend` calls `validateConversationEvidenceEnvelope(metadata.evidence)` directly, which throws for an unsupported schema or oversized/invalid envelope, and `backendTurnPayload` no longer guards it. Every other consumer of the same envelope in this module deliberately tolerates that shape: `conversation-journal.ts` wraps `parseConversationEvidenceMetadata` in try/catch ("Legacy or corrupt evidence must not fail the authorized read tool" and "A malformed legacy envelope must not abort search of later valid turns"), and `buildContextSnapshot` renders it as evidence-undefined with `evidenceReadRequired: true` rather than throwing. A stored legacy/corrupt evidence envelope now renders in context but aborts `backendTurnPayload` at the outbox/delivery boundary (sqlite-store.ts:1989), so the whole turn fails to sync. Wrap the evidence extraction/validation in a try/catch and fall back to the unstamped metadata (or skip evidence) so delivery matches the tolerate-and-continue behavior of the read and context paths.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread desktop/macos/agent/src/index.ts Resolved
Keep retained-body digests correct, represent empty or budget-limited content honestly, and revoke stale capture obligations at owner and journal-receipt boundaries.

Validation: Swift agent logic harness passed 787 tests, including escaped aggregate metadata, digest, empty-file and rejected-receipt regressions.

Failure-Class: FC-realtime-context-evidence-ownership
Retain journal idempotency after evidence attachments, redact malformed legacy evidence before sync, shape relay errors, and remove redundant prompt instructions. Page revision identities before loading search payloads using the constrained primary-key query.

Validation: 867 runtime tests and 137 extension tests passed; official generated surfaces rebuilt. Ten interleaved synthetic 500-source samples measured search median 163ms before and 93ms after; this is local SQL/runtime work, not end-to-end voice latency.

Failure-Class: FC-split-mutation-authority
Validation: gauntlet self-check and mocked production fixture-to-browser admission passed without browser or model calls.

Failure-Class: none
Use the existing singular/plural convention for the answer-mode count. Reviewed the one-word branch; no behavior change beyond copy.

Failure-Class: none
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Resolved the Cubic thread on backendTurnPayload / conversationEvidenceForBackend: the tolerate-and-continue guard is present at the current head (8230771a0e, "fix(ptt): preserve evidence contracts across retries and delivery") — malformed legacy/corrupt evidence envelopes are caught, the raw evidence slot is dropped (no bodyText/provenance leak), and the rest of the turn metadata is preserved so outbox delivery/sync is not aborted. Covered by the regression test "drops malformed legacy evidence from backend delivery without leaking the raw namespace" (tests/conversation-evidence.test.ts), which also asserts drainBackendTurnOutbox does not throw and the behavior survives a store restart. Re-verified locally: full tests/conversation-evidence.test.ts suite passes (24/24) via the agent vitest runner.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

The cubic P2 finding is already addressed at this head by 8230771: conversationEvidenceForBackend wraps validation in try/catch, drops only the evidence slot, and keeps the rest of the turn metadata (conversation-evidence.ts:299-309), with a regression test covering malformed legacy evidence through the delivery boundary (tests/conversation-evidence.test.ts:87-128). Verified locally: 108/108 vitest tests and tsc --noEmit clean.

@Git-on-my-level
Git-on-my-level merged commit 1a0c6e0 into main Sep 8, 2026
31 checks passed
@Git-on-my-level
Git-on-my-level deleted the codex/durable-agent-runtime branch September 8, 2026 13:20
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