Skip to content

feat(conversations): add coherent cached notes pipeline - #11834

Merged
Git-on-my-level merged 12 commits into
mainfrom
agent/m4-air-codex-sol/notes-quality-3daa6ac255
Aug 19, 2026
Merged

Git-on-my-level merged 12 commits into
mainfrom
agent/m4-air-codex-sol/notes-quality-3daa6ac255

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Aug 19, 2026 •

Copy link
Copy Markdown
Member

Summary

  • add a flag-gated canonical note generator that produces free-form sourced sections, action items, and events in one coherent call
  • reuse one per-conversation transcript/cache prefix across note generation, L1 memory extraction, and explicitly selected summarization apps
  • feed calendar and bounded conferencing-screen OCR identity context before summarization, and derive vector metadata from the canonical note instead of rereading the raw transcript
  • make automatic summarization apps an independently gated opt-in behavior while preserving explicit/preferred apps

All four user-visible rollout controls default off in the runtime manifest and GKE values:

  • CONVERSATION_NOTES_V2_ENABLED
  • CONVERSATION_APPS_OPT_IN_ONLY
  • CONVERSATION_CALENDAR_CONTEXT_READ_ENABLED
  • CONVERSATION_OCR_CONTEXT_ENABLED

Design review and changes from the brief

  • The Redis meeting mapping did not fail for the motivating ad-hoc desktop call; no mapping was ever created. The actual starvation boundary was broader: direct CreateConversation.calendar_meeting_context was ignored by _get_structured, and overlapping Google Calendar lookup happened only after summarization behind a flag that also writes back to Google Calendar. This change consumes direct context, preserves the legacy Redis mapping, and adds a separate read-only pre-summary overlap flag while leaving calendar mutation under GOOGLE_CALENDAR_AUTO_LINK_ENABLED.
  • OCR extraction is deterministic and bounded (80 rows, 12,000 characters, conferencing apps only, at most 12 names). A nano call would add another provider dependency/pass for metadata that is already structurally simple.
  • OCR/calendar names do not create durable person_id values because a display name is not an authoritative Omi Person identity. The prompt renderer relabels a single unresolved speaker only when exactly one calendar/OCR participant remains unassigned; otherwise it preserves the transcript labels.
  • The additive schema lives in the in-repo plugin SDK as well as the backend fallback model because that SDK is the backend model authority. Existing documents deserialize with sections=[] and null action-detail fields.
  • No client release is needed: the server projects sections into markdown in structured.overview, which both existing clients already use when no app result exists.
  • Reprocess and external-audio paths use the same merged note call. Under the app opt-in flag, empty app results are persisted too, so an old default app result cannot continue shadowing the canonical note after reprocess.

Prompt-cache verification and arithmetic

The configured gateway routes conv_structure and memory_l1 to the same OpenAI GPT-5.6 Luna lane and preserves the cache fields for compatible OpenAI routes; incompatible/fallback routes strip them. OpenAI's prompt-cache contract requires an exact shared prefix, starts at 1,024 tokens for GPT-5.6, uses prompt_cache_key to improve routing, and supports the explicit 30-minute retention used here. The canonical prefix is two byte-identical system messages, with the explicit breakpoint after metadata plus the full transcript; feature instructions follow it. Tests rebuild the note and memory prefixes independently and assert equality.

Provider reference: https://developers.openai.com/api/docs/guides/prompt-caching

For the motivating approximately 6,300-token transcript:

  • before: 5 uncached transcript passes = approximately 31,500 input tokens
  • after (default path): note cache write + memory cache read = 6,300 * 1.25 + 6,300 * 0.10 = 8,505 input-token cost equivalent, plus short task suffixes (approximately 73% lower transcript-input cost)
  • even on a cache miss: 2 passes = 12,600 raw transcript tokens (60% fewer)

This gives up roughly 1,000 tokens of feature-specific instruction-prefix reuse to cache the approximately 6,300-token transcript and its metadata. Explicitly chosen apps can read the same warm prefix; they are no longer part of the default pass count.

Note and action contract

Structured.sections contains typed section containers with model-authored markdown and exact source segment IDs. The prompt supplies three inspirational shapes rather than a rigid taxonomy, scales density with transcript size, preserves names/numbers/products/organizations verbatim, permits short quotations, and prohibits guessed spellings.

Action items retain the <=15-word timeless description and add owner_name, one-line context, and due_certainty. The merged call treats tentative dates as tentative action metadata, never as confirmed events, and avoids inventing a precise hour when none was stated.

Product callout: summarization apps

CONVERSATION_APPS_OPT_IN_ONLY=true demotes the summarization-app ecosystem from "one app runs by default for everyone" to "an app runs only when explicitly requested or selected as the user's preferred app." This is intentionally a separate, one-line rollback flag from notes v2.

Verification

  • 125 passed: notes/schema/cache wire/process/date/model focused suite
  • 106 passed: exact test.sh rerun of every change-related file that failed during the broad run, including gateway strict-schema and upstream-boundary tests
  • 198 passed: backend/scripts/pre-deploy-check.sh (dev/prod runtime manifest, rendered deployment contracts, deploy safety tests)
  • PR preflight passed through line-count, docs, diff hygiene, identity, architecture, invariants, failure-class, deployment classification, public-build, async-blocker, and datetime gates; the next gate could not install tiktoken because package-index DNS is blocked in this environment
  • formatting, py_compile, and git diff --check: passed

The complete backend/test.sh matrix was run under the locally available Python 3.12 environment. Its first pass exposed eight change-related failures, all fixed and green in the exact failed-file runner. Two unrelated replay-harness files still cannot bind loopback UDP/TCP sockets in this managed sandbox (PermissionError: [Errno 1] Operation not permitted), so the full matrix cannot be claimed green here. The repository-pinned Python 3.11.15 is not installed and dependency sync cannot reach the package index from this environment.

Follow-up commits in this PR

Skimmable notes, no default due dates. Note bodies are bullets with nested sub-bullets and no
narration; every bullet must carry a concrete specific or be deleted. Coverage beats brevity — the
word target is met by tightening wording, never by dropping a topic. Action items no longer carry a
due date by default: a date merely discussed is not a deadline, it goes in context.

Meeting identity by time overlap. Root cause of the motivating defect: processing consulted only
a Redis conversation→meeting mapping written at creation time, and users/{uid}/meetings was always
empty because no client wrote it. Now resolves by time overlap with a layered fallback
(calendar-backed stored → client-supplied → Google read-only → screen-derived → server OCR),
degrading silently at every layer. Calendar writes stay behind GOOGLE_CALENDAR_AUTO_LINK_ENABLED.

OCR identity by corroboration. The first extractor accepted any 1–4 word capitalised line, which
on a full-desktop capture means the browser tab strip becomes the participant list. Verified against
real captured data it emitted eleven phantom participants. Now a name is accepted only from a roster
sentence ("X and Y are in this call", "Meet with X") or when corroborated by an email local part in
the same window. Precision-first: no participants → no context at all.

EventKit. macOS never populated users/{uid}/meetings — the app had zero EventKit usage and the
generated client method had no callers. Adds a bounded reader that uploads meeting identity without
requiring Google OAuth. Ships dark.

On-device derivation behind an explicit egress policy. The previous "derived data never leaves
the device" rule was drawn for proactive notifications, which are computed and consumed on-device;
conversation summaries are generated server-side and legitimately need identity. DerivedDataEgressPolicy
now declares every derived-data class default-deny with each allow bound to a stated purpose, and the
CI tripwire asserts bucket tables stay out of AgentSync and that no denied class has a route. The
extractor moved client-side so it reads the local store rather than starving on screen-activity rows
that never sync (measured: 0.8% of 26k local rows reach the backend). Exactly seven wire keys leave
the device, asserted by test; no OCR text, screenshots, bucket data, app names, or window titles.

Dogfood measurement

Run against a real 5,271-word meeting transcript through the production note path on the production
model route, scored on presence of specific facts verified to exist in the transcript:

production today reference tool this PR, no metadata this PR, derived metadata
specifics captured 7/19 15/19 17/19 19/19
words 315 424 539 688

A second 3,684-word meeting scored 11/17 (production) vs 17/17 (this PR), with 7 owner-attributed
action items vs 3 unattributed. Participant metadata for the first meeting was derived by the real
extractor from real captured screen data, not hand-supplied.

Reviewer re-verification

Re-ran on the repository-pinned interpreter (backend/scripts/sync-python-deps.sh created the 3.11 .venv successfully; the authoring environment lacked package-index access):

  • test_conversation_notes_v2.py 5 passed, test_action_item_date_validation.py 26, test_conversation_structure_timezone.py 16, test_llm_gateway_chat_extraction_pilot.py 23, test_llm_gateway_openai_compatible.py 31, test_process_conversation_usage_context.py 33, test_working_observations_extractor.py 15 — 149 passed, no failures.
  • Collecting all of tests/unit in a single process reports 275 collection errors (prometheus Duplicated timeseries in CollectorRegistry on shared import, plus a protobuf native-extension segfault on macOS arm64 unless PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python is set). Verified identical on the parent commit 3daa6ac255 with these changes stashed — same 275 errors, 6,913 tests collected — so it is a pre-existing environment constraint, not a regression. Per-file runs are unaffected.

Could not do

  • Live re-verification/dogfooding of conversation ff8b9998-1169-5c66-9998-8af7837045d9: the required local Omi read-only GCP profile is absent, and no live LLM credentials are available. The implementation therefore relies on the supplied verified keyword/metadata evidence plus logic tests and default-off flags.
  • A real provider cache-hit measurement was not possible without live credentials; the wire contract and exact-prefix construction are covered by tests.

Product invariants affected

none

Failure-Class: new

New class: derived context starved by an unwritten association. Enrichment depended on a single
conversation→meeting mapping that only one code path wrote, and no shipping client ever called it, so
the dependent feature degraded silently to no context rather than failing visibly. Guard surface: the
resolver now matches by time overlap across layered sources and every layer's absence is covered by a
test, so a missing writer cannot silently disable enrichment again.

Line-Count-Exception: backend/utils/conversations/process_conversation.py | 1859 -> 2204 | one feature-gated lifecycle change must keep creation, reprocess, app persistence, metadata extraction, and canonical-memory prefix construction under the existing conversation orchestration owner; reusable OCR and prefix logic is already split into new focused modules

Line-Count-Exception: backend/utils/llm/conversation_processing.py | 1510 -> 1672 | the merged note generator belongs beside the legacy conversation generation paths it replaces, while shared prefix construction is already split out; separating only this call would create another orchestration adapter without an independent owner

@mintlify

mintlify Bot commented Aug 19, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
omi 🟢 Ready View Preview Aug 19, 2026, 12:14 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

Git-on-my-level and others added 8 commits August 18, 2026 21:07
Dogfooded on a real 5k-word meeting transcript against the live model:

- Note bodies are bullets with nested sub-bullets, terse fragments, no
  narrative paragraphs and no scene-setting. Every bullet must carry a
  concrete specific or be deleted.
- Coverage beats brevity: the word target is met by tightening wording,
  never by dropping a topic. A first attempt that capped words without
  this rule dropped specifics recall from 16/20 to 9/20; with it, 17/20
  at 599 words (Granola reference: 17/20 at 424 words; current
  production output: 7/20 at 315 words).
- Action items no longer carry a due date by default. A date that was
  merely discussed or proposed is not a due date; it goes in context.
  No invented hours.
- Fix test isolation: firebase_admin reaches google.auth.credentials
  lazily, so the new test file failed when co-run with a module that had
  already imported google.auth.

Co-Authored-By: Claude Opus 5 <[email protected]>
… Redis mapping

A real desktop conversation tagged `external_data.conversation_role: "meeting"`
(ff8b9998-1169-5c66-9998-8af7837045d9, 2026-08-18 19:29-19:58 UTC) reached the
summarization prompt with `Speaker 0:` / `Speaker 1:` for 4,750 words: no
`calendar_event`, no `calendar_meeting_context`, every `person_id` null. The
prompt already knows how to use participant names when CALENDAR MEETING CONTEXT
is present — the context simply never arrived.

Root cause is reachability, not logic. The pre-summarization lookup consulted
exactly one source: `redis_db.get_conversation_meeting_id(conversation.id)`.
That mapping is written in exactly one place — `routers/listen/conversations.py`,
at desktop conversation creation, and only when a stored meeting already
overlaps that instant with a +/-2 minute window. When it is absent there was no
second chance, even though `database/calendar_meetings.get_meetings_in_time_range`
has existed all along and needs neither the mapping nor an OAuth grant.

- `meeting_context.select_overlapping_meeting` picks the stored meeting that
  best overlaps the conversation window, reusing the Google auto-link thresholds
  (`MIN_OVERLAP_SECONDS`, `MIN_OVERLAP_PERCENTAGE`) so both paths judge a match
  by identical rules. `stored_meeting_window` derives the end from
  `duration_minutes` when a record predates `end_time`.
- `meeting_context.resolve_meeting_context` makes the layering explicit and
  testable: stored meeting (exact mapping, else time overlap) -> client-supplied
  `calendar_meeting_context` -> overlapping Google Calendar event (read-only) ->
  conferencing OCR. A better source wins the scalar fields; weaker sources only
  add participants the better ones missed. Every layer degrades to no context
  and none may fail the conversation.
- `_enrich_meeting_context` now delegates to that resolver, still before
  `_get_structured`. Nothing here mutates a calendar; write-back stays behind
  `GOOGLE_CALENDAR_AUTO_LINK_ENABLED` after summarization.
- New kill switch `CONVERSATION_STORED_MEETING_CONTEXT_ENABLED` (default on:
  bounded, read-only, and the only source needing neither OAuth nor the mapping).
  `CONVERSATION_CALENDAR_CONTEXT_READ_ENABLED` and
  `CONVERSATION_OCR_CONTEXT_ENABLED` keep their off-by-default gating.

Known remaining gap, documented in backend/AGENTS.md: `users/{uid}/meetings` is
populated only by `POST /v1/calendar/meetings`, and no shipping client calls it.
`desktop/macos` has no EventKit usage and never invokes the generated
`storeCalendarMeetingV1CalendarMeetingsPost`, so the collection is empty for
desktop users. This commit is the backend half; the client must send
`calendar_event_id`, `calendar_source`, `title`, `start_time`, `end_time`, and
`participants[{name,email}]` for it to fire.

Verification (backend/.venv, PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python):
- tests/unit/test_meeting_context_resolution.py — 25 passed (overlap selection,
  fallback ordering, degrade-to-nothing)
- tests/unit/test_meeting_context_enrichment_wiring.py — 9 passed (production
  `_enrich_meeting_context` with Firestore/Redis reads faked)
- Existing per-file: test_conversation_notes_v2 5, test_action_item_date_validation 26,
  test_conversation_structure_timezone 16, test_process_conversation_usage_context 33,
  test_working_observations_extractor 15, test_upstream_boundary 5,
  test_calendar_meeting_from_records 4, test_calendar_meeting_item_guard 3 — all passed
- Combined run of the two new files with notes_v2 + usage_context: 72 passed (no
  stub leakage). test_upstream_boundary's 3 cross-file failures reproduce at HEAD
  without these changes.
- Checks: agents-md-lean, conversation-lifecycle-write-guard, backend-async-blockers,
  backend-import-purity, backend-module-isolation, deferred-work-markers,
  firestore-query-coverage — all pass.
- NOT verified: no Firestore/GCP credentials locally, so the real
  `get_meetings_in_time_range` round trip and the live Google Calendar read are
  unexercised.

Failure-Class: new

Co-Authored-By: Claude Opus 5 <[email protected]>
…n, not line shape

Run against the real captured screenshots for conversation ff8b9998
(2026-08-18 19:29-19:58 UTC, a Google Meet call in a Chrome tab), the OCR
extractor added in the previous commit emitted twelve "participants":

    EQ, Meet, Switch account, Omi Monitor, ANX, Spud, David Zhang,
    Coinflow Portal, Spud pay, Om, Manage access, Blocked users

Only `David Zhang` is a person. The rest is the browser tab strip and window
chrome, which on a full-desktop capture looks exactly like a short capitalised
name. `_name_candidates` accepted any 1-4 word capitalised line, so shared-screen
UI text became meeting attendees. That is worse than passing no context at all:
the prompt then attributes statements to people who were never in the call.

The real identity was in the same OCR the whole time and was being thrown away:
  - the Meet pre-join card literally states the roster
    ("Ash Kalb and Boardy Boardman are in this call"), but the 1-4 word rule
    discarded the 9-word sentence whole;
  - `[email protected]` and `[email protected]` were dropped by a blanket
    "skip any line containing @", discarding the highest-signal identity token
    available;
  - row selection took the first 80 rows chronologically and spent the 12k char
    budget on early full-desktop frames, so richer later frames were unreachable.

Rewritten precision-first. A name is accepted only from a source that actually
asserts participation:
  1. a roster sentence — "X and Y are in this call", "X is in this call",
     "Meet with X", "X has joined", "In call with X"; or
  2. a line whose token matches the local part of an email seen in the same
     window ("Boardy Boardman" is corroborated by [email protected], while
     "Coinflow Portal" has nothing behind it).
Everything else is discarded, including lines that look exactly like names.
Emails are emitted as `MeetingParticipant.email` and paired to a name when the
local part matches. No participants means no context at all, rather than a
title-only block implying an identity match that was never made. Row selection
now ranks rows by identity signal before spending the same bounded budget, and
`_is_conferencing_row` also recognises a bare Google Meet code tab title
("Meet - amc-iajq-asx"), since the omnibox URL scrolls out of frame once joined.

Verification against the REAL local store (read-only sqlite, 26,092 rows;
tests use copied literal OCR strings and never touch the DB):
- ff8b9998 window: 251 rows, 89 classified conferencing (was 27), output is
  exactly Ash Kalb <[email protected]>, Boardy Boardman <[email protected]>,
  David Zhang <[email protected]> and nothing else. This matches the
  independent reference (Granola's header for the same call:
  "[email protected], Boardy"). None of the eleven junk names survive.
- Whole-store sweep: 93 conferencing rows in 3 sessions across 26k rows; the one
  real session yields the three correct participants, the others yield nothing.
- 208ec2aa window (2026-08-18 16:00:52-16:20:59Z): 0 rows locally — screenshot
  capture that day does not begin until 16:47:14Z, so there is nothing to
  extract and the extractor correctly returns no context. Its emptiness is a
  capture gap, not an extractor result, and it is not evidence either way.

Tests (backend/.venv, PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python), per file:
  test_screen_activity_identity 19, test_meeting_context_resolution 25,
  test_meeting_context_enrichment_wiring 9, test_conversation_notes_v2 5,
  test_action_item_date_validation 26, test_conversation_structure_timezone 16,
  test_process_conversation_usage_context 33, test_working_observations_extractor 15,
  test_upstream_boundary 5, test_prompt_caching 26 — all passed.
Two existing assertions were updated on purpose: both asserted the old permissive
behaviour (a bare "Ash" line becoming a participant), which is the defect.
Checks: backend-import-purity, backend-module-isolation, deferred-work-markers,
backend-async-blockers — pass.

Failure-Class: new

Co-Authored-By: Claude Opus 5 <[email protected]>
macOS never populated users/{uid}/meetings, so the backend's strongest
meeting-context layer had nothing to resolve. Adds an EventKit reader that
uploads bounded meeting identity through the existing
POST /v1/calendar/meetings endpoint.

Leaves the device: event identifier, system_calendar source, title,
start/end, up to 50 organizer/attendee names and emails, and a recognized
Zoom/Meet/Teams/Webex HTTPS join URL plus platform. NOT uploaded: raw notes,
raw location, calendar names, canceled/all-day events, or any historical
calendar sweep.

Ships dark behind system_calendar_meeting_context; non-production builds
require OMI_FORCE_SYSTEM_CALENDAR_MEETING_CONTEXT=1. Calendar work is off
the audio path, runs only for meeting-role sessions, and finalization stays
fail-open behind a two-second ceiling.

Verified: Swift 6 strict-concurrency targeted typecheck, behavioral harness,
focused SwiftLint (0 violations), formatting, plist validation, changelog
validation. NOT verified: full SwiftPM/XCTest build (sandbox denied build-plan
writes), signed-app run, and headless calendar permission grant.

Co-Authored-By: Claude Opus 5 <[email protected]>
…gress policy

The prior boundary — context-bucket tables absent from AgentSync — was drawn
for proactive notifications, which are computed and consumed entirely
on-device. Conversation summaries are generated server-side and legitimately
need meeting identity. Makes that distinction explicit instead of implicit.

- DerivedDataEgressPolicy declares every derived-data class, default-deny,
  each allow bound to a stated purpose. Meeting identity is the only allowed
  class, for server-side conversation summarization; context-bucket facts,
  narratives, entries and proactive derivation are explicitly denied.
- The CI tripwire is strengthened, not removed: it now asserts bucket tables
  stay outside AgentSync AND that exactly one class is allowed, every route is
  declared, and denied classes are rejected.
- Ports the corroboration-based OCR extractor to the client so it reads the
  local store instead of starving on screen-activity rows that never sync
  (measured 0.8% of 26k local rows reach the backend).
- Reuses the EventKit transport and POST /v1/calendar/meetings; no API schema
  change, so no contract regeneration.

Leaves the device: calendar_event_id (synthesized from the time window, not a
screenshot id), calendar_source=screen_activity, title, start/end, participant
names and emails, platform. A test asserts the exact wire-key set. No OCR or
evidence text, screenshots, screenshot ids, bucket data, app names, window
titles, notes, or join URLs.

Resolver ordering corrected beyond the brief: screen-derived stored records are
a distinct lower-fidelity tier, so calendar-backed records still outrank them
rather than all stored meetings sharing one tier. Server-side OCR is kept as
the final fallback for older and flag-off clients.

Also narrows the note fidelity rule: a participant name or email domain may
override a conflicting ASR spelling (fixing 'Vulcra' for 'Fulcra'), while
general name normalization stays forbidden.

Ships dark behind on_device_meeting_identity.

Verified: backend per-file suites — meeting_context_resolution 28,
screen_activity_identity 19, enrichment_wiring 9, notes_v2 5,
usage_context 33, action_item_date_validation 26. Black, swift-format,
async-blocker scan, diff --check. NOT verified: SwiftPM compilation and
XCTest (sandbox denied build-cache writes and macro-plugin execution).

Co-Authored-By: Claude Opus 5 <[email protected]>
Names the class behind the meeting-context defect in this PR: enrichment that
depends on a single association only one code path writes degrades to a
plausible wrong answer instead of a visible failure. Guard surface is the
layered time-overlap resolver plus its per-layer absence tests.

Failure-Class: new

Co-Authored-By: Claude Opus 5 <[email protected]>
…ibility policy

Integrates with the meeting-detection track (#11832, #11836), merged into this
branch from main.

conversation_role is open-time durable identity, not the treatment decision.
Enrichment gated on the role alone would spend a Google Calendar read, a
screen-activity query, and a stored-meetings row on a 90-second call that the
authoritative finalization policy has already ruled out — and that row would
then be visible to our own time-overlap resolver for unrelated conversations in
the same window. Desktop meeting-role conversations now defer to
is_meeting_treatment_eligible; every other source keeps its prior behaviour.

The existing wiring fixture was a zero-segment 'meeting', which the gate
correctly skips, so it now carries qualifying speech. That is a fixture
correction, not a weakened assertion: a silent conversation was never eligible
for meeting treatment.

Also folds the bare-meeting-code title pattern ('Meet - amc-iajq-asx') into
ConferencingApps as browserCallTitlePattern/isBrowserCallTitle. #11832
consolidated two divergent conferencing catalogs; leaving this pattern in the
extractor would have made a third.

Failure-Class: none

Verified per-file: enrichment_wiring 10, meeting_context_resolution 28,
meeting_treatment 4, screen_activity_identity 19, notes_v2 5,
usage_context 33, action_item_date_validation 26, structure_timezone 16.
All four contract surfaces regenerate with no diff after the merge.

Co-Authored-By: Claude Opus 5 <[email protected]>
…tings

Only Meetings mode stayed idle (mic closed, empty word_count=0 sessions)
during Discord voice, Slack huddle, and WhatsApp calls because
ConferencingApps only catalogued Zoom / Teams / Meet / FaceTime / Webex /
GoTo. Add the three chat apps to the shared catalog, same shape as Teams:

- nativeCallApps owner names (Discord, Slack, WhatsApp) for the call-window
  / screen paths (ProactiveAssistantsPlugin capture throttling);
- nativeCallBundleIDs gains the verified current macOS bundle IDs
  (com.hnc.Discord, com.tinyspeck.slackmacgap, net.whatsapp.WhatsApp —
  Homebrew cask quit targets for the shipping apps), lowercased per the
  set's documented contract.

Meeting semantics are unchanged: a native catalog hit still counts as a
meeting only while that process is using the microphone
(callAppIsUsingMicrophone), so idle Slack/Discord/WhatsApp windows do not
start capture — exactly how Zoom/Teams already behave. Browser calls were
already covered generically by browserBundleIDPrefixes mic-in-use matching;
no browser title keywords are added, since a domain token visible in a chat
tab title would flag idle chat as a meeting.

Known ceiling (same as Teams): a Slack/Discord/WhatsApp voice note or call
that holds the mic reads as a meeting.

Failure-Class: none

Verification:
- xcrun swift test --package-path Desktop --filter
  'ConferencingAppsTests|MeetingDetectorTests|AudioRecordingModeSettingsTests|MeetingConversationBoundaryPolicyTests'
  (the classes in Desktop/Tests/MeetingGatedSystemAudioTests.swift; the
  file name itself matches no test class): 32 executed, 0 failures —
  ConferencingAppsTests 10/10 including the 3 new chat-app cases.
Git-on-my-level and others added 2 commits August 19, 2026 02:17
…pp selection

Second opinion from gpt-5.6-sol on the apps-opt-in design; it changed two things.

1. Two independent booleans (notes v2, apps opt-in) describe four states, only two
   of which are coherent. Legacy notes + opt-in apps takes the app summary away
   and falls back to the short legacy overview — worse than either whole
   configuration, and reachable by flag misconfiguration alone. Replaced with
   SummaryPipelineMode resolved from one switch, so that pair is unrepresentable.
   CONVERSATION_APPS_OPT_IN_ONLY is removed from deploy config and derived instead;
   rollback is turning notes v2 off, which restores prior behaviour wholesale.

2. Desktop explicit app selection was already broken and opt-in would have made it
   visible. The reprocess route declares app_id as a QUERY parameter; the desktop
   client sent it in a JSON body, so FastAPI ignored it and reprocess ran with no
   app. Today that is masked because reprocess falls back to the preferred or
   suggested app; under opt-in, choosing an app would have silently returned the
   first-party note. Mobile already sent it correctly.

Also rejected the change I had proposed: feeding chosen apps the structured note
instead of the transcript. An app author's contract is 'apply memory_prompt to the
conversation', and a lossy note breaks apps that quote exactly, rely on speaker
attribution or ordering, or deliberately produce an alternative reading. The shared
cached prefix already gives apps the full transcript, and it is not cheaper to
substitute the note — the transcript is in the prefix either way.

Failure-Class: none

Verified: usage_context 34 (incl. a new test pinning that the regressing combination
cannot be reached, and that a stale standalone override cannot resurrect it),
notes_v2 5, enrichment_wiring 10, screen_activity_identity 19,
meeting_context_resolution 28. runtime_env recomposed; chart values updated.

Co-Authored-By: Claude Opus 5 <[email protected]>
…ference

The desktop Swift CI matrix (Static & Test Contracts, Release Compile,
Build & Tests) fails to compile SystemCalendarMeetingContextService:
EKEventStore is not Sendable, so Swift 6 rejects sending the
actor-isolated eventStore reference into the nonisolated SDK entry
point requestFullAccessToEvents(). Mark the reference
nonisolated(unsafe) - the repo's established pattern for non-Sendable
SDK interop - since every actual use stays confined to the actor.

Verified: git diff --check; swiftc -parse and -swift-version 6
typecheck of the changed file are clean on the local toolchain. NOT
verified: full SwiftPM build (local Xcode 26.6 no longer emits the
Xcode 16.4 CI diagnostic, so exact reproduction is not possible
locally; relying on CI for the matrix).

Failure-Class: none

@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.

Flag-gated canonical notes pipeline — approving; feature of this size plus deploy-config changes needs a maintainer merge.

@Git-on-my-level
Git-on-my-level merged commit 885cd48 into main Aug 19, 2026
47 of 51 checks passed
@Git-on-my-level
Git-on-my-level deleted the agent/m4-air-codex-sol/notes-quality-3daa6ac255 branch August 19, 2026 16:08
Git-on-my-level added a commit that referenced this pull request Aug 19, 2026
…enabled in beta only (#11865)

Turns the conversation notes v2 rollout on for the beta ring only.
Production stays dark.

## Why the dev environment is the beta lever

Beta is a deployment, not a cohort. The mobile `mobile_beta` profile and
the beta desktop bundle `com.omi.computer-macos.beta` are both pinned to
`api.omiapi.com` — the dev backend — while authenticating against the
production Firebase project, and dev's `data_plane_project` is
`based-hardware`. Setting the rollout flags in the dev runtime
environment therefore reaches beta users, on their real data, without
reaching production users.

This is also the only mechanism available: `_flag_enabled` reads process
environment, so the backend has no per-user flag evaluation.

## The gap this closes

`#11834` declared the three `CONVERSATION_*` flags on `backend-listen`
only. `process_conversation` runs in two services — backend-listen
finalizes a live conversation, and the Cloud Run `backend` service runs
it inline for `POST /v1/conversations/{id}/reprocess`. With the flags on
one host, `os.getenv` falls through to the `False` default on the other,
so a meeting would summarize under v2 and then regenerate under the
legacy pipeline. Both return a well-formed summary, so the discrepancy
reads as model nondeterminism rather than as missing configuration.

Declared `false` in `_base.yaml` (no production behaviour change) and
`true` in the dev overlay.

The deploy validator already enforces this. Adding the flags to the
Cloud Run service made three existing validator tests fail, because
their Cloud Run state fixtures did not carry the variables — the
validator correctly reporting that a deploy would omit them. The
fixtures now carry them, scoped to the `backend` service.

## The desktop half

The two client features are gated by PostHog, which targets users and
cannot express "the bundle pointed at the dev backend". A cohort wide
enough to include beta would also match stable users, whose backend has
the consuming flags off — they would be prompted for calendar access to
produce uploads nothing reads.

So beta defaults on and keeps a kill-switch flag, letting a bad build be
disarmed without shipping a new one; stable still requires its own
positive flag. The decision is a pure function of its inputs, so it is
exercised without a bundle, a process environment, or a PostHog client.

## Resulting state

| | dev (beta) | prod |
| --- | --- | --- |
| `CONVERSATION_NOTES_V2_ENABLED` | true | false |
| `CONVERSATION_CALENDAR_CONTEXT_READ_ENABLED` | true | false |
| `CONVERSATION_OCR_CONTEXT_ENABLED` | true | false |

Asserted on **both** summary-pipeline services, and the Helm values file
is checked against the composed manifest, since Helm reads the values
file rather than `runtime_env.yaml`.

## Verification

- 89 backend tests: `test_backend_runtime_env_validator.py` (85) and the
new `test_conversation_notes_v2_beta_rollout.py` (4).
- A real `swift build` of the macOS SwiftPM package — build complete,
not a typecheck.
- 19 Swift tests via `swift test`, including the 6 new gating cases.

Not verified: no deploy was run, so the dev rollout is asserted from the
composed manifest and chart values rather than from a live service. Prod
values are asserted unchanged.

---

# Part 2 — lossless screen-activity sync

Previously [#11868](#11868),
folded in here so beta gets one merge rather than two.

Screen-activity sync silently discards ~99% of what it captures. This
makes it lossless, and cheaper per delivered row than the broken version
is per delivered row.

## The defect

`ScreenActivitySyncService` selected `WHERE id > ? AND embedding IS NOT
NULL` and advanced a monotonic cursor past everything it shipped.
Embeddings are computed asynchronously after insert, so any row whose
vector had not landed when the sweep passed was skipped **permanently**
— not retried, not queued, not reported.

Measured on a live store: **705 of 26,822 rows over 30 days** ever left
the device. It reads as a working sync, because rows keep arriving.

Three further mechanisms independently denied a row its embedding, so
repairing the cursor alone recovers little:
- cross-batch content-hash dedup returned early without ever queueing
the row,
- gated or failed embedding batches were dropped rather than requeued,
- the backfill that comments describe as the safety net had been stuck
`completed=1, processedCount=0` since 2026-04-16.

## What changed

**Durable per-row delivery state** (`pending → textSynced →
fullySynced`, plus `compacted`) on an indexed column, replacing the
cursor. A row that was not ready when a sweep passed is picked up by a
later sweep. OCR-bearing rows ship without waiting for a vector; the
vector attaches afterwards. Migration is safe on a populated store and
starts existing rows `pending`, so history is recoverable.

**Bucket-aligned eligibility.** Compaction keeps the longest OCR text
per `(app, window, 5-min bucket)`. The original implementation tested
each row's own timestamp against `now - slack`, which makes eligibility
*slide*: the early rows of a bucket become ready while its later rows do
not, so a bucket is ranked more than once and ships more than one
winner. Replayed over 7,346 real OCR-bearing rows, the sliding form
ships **5,517** where bucket-aligned ranking ships **3,842** — 44% more
than the design intends, which is most of the compaction saving. The
same alignment now applies to the embedding flush and the backfill
queries, so all three agree on what a bucket is.

**A closed bucket's winner waits up to 15 minutes for its embedding**
before shipping text-only. Without that wait almost every row shipped
twice: sync sweeps at 5 minutes, and the embedding flush also buffers to
5 minutes and then batches on a 60s timer, so the vector reliably lost
the race. The second push wrote a byte-identical Firestore document and
rewrote all of its index entries for no data change. Losslessness is
preserved — the grace period is a delay, not a gate.

**`ocrText`, `windowTitle`, `deviceName`, `clientDeviceId` exempted from
Firestore single-field indexing.** Firestore auto-indexes every field in
both directions, and nothing queries these — `ocrText` is only ever read
back, never filtered or ordered on; semantic search goes through
Pinecone. Measured per document, index bytes were ~75% of this
collection's storage and the `ocrText` index alone was the majority of
it. The one composite index is unaffected.

**Bounded deferred buffer.** Requeueing gated batches fixes real data
loss but restores an unbounded buffer for a user whose backend gates
every call. Oldest deferred items are shed first.

**Re-armed backfill** for the stranded history, capped per launch so it
cannot stampede.

## The timestamp check, which came back negative

All 26,797 measured local rows already use the space-separated `%Y-%m-%d
%H:%M:%S.%f` form that the backend's lexicographic range filters assume;
**zero** use ISO `T`/`Z`. So no production date-range query over screen
activity is currently returning wrong results.

Two latent paths are closed anyway: the client had a live ISO fallback,
and `upsert_screen_activity_vectors` computed the Pinecone timestamp for
a naive string in the *process* timezone rather than UTC (inert wherever
the container runs UTC, wrong everywhere else). Both now canonicalize at
the boundary.

## Cost

Independently modelled from the live store rather than asserted. Per
user per month, at this store's capture volume:

| | rows delivered | month 1 | month 12 |
|---|---:|---:|---:|
| today (broken) | 705 | $0.11 | $0.14 |
| this change | 3,842 | $0.36 | $0.54 |
| lossless without compaction | 7,213 | $1.09 | $1.48 |

Rows delivered go up **5.3x** and spend goes up about **5x**. That
increase is real and permanent — it is the cost of not throwing the data
away. The dominant term is per-row flow (embedding + vector writes),
which does not compound; permanent storage accrual is
~$0.017/user/month.

This store is a heavy dogfooder (26.8k captures over 19 active days), so
treat per-user figures as an upper bound. Unit prices are list prices,
not billed rates.

**Not addressed here, deliberately:** truncating OCR to 1,000 chars
before embedding would cut the embedding bill by more than half, and
Firestore already stores only the first 1,000 chars. But the embedding
is what makes text *searchable*, and nothing has measured retrieval
quality past that point — so it is a product call, not a cleanup, and it
is left out.

**There is still no server-side retention of any kind.** The only
deletion path is account deletion. Volume is unbounded and losslessness
makes that more pressing, not less. Out of scope here; it needs its own
decision.

## Tiering: cloud vectors are a paid desktop capability

Second commit. Free-tier desktop users sync their rows without vectors —
they keep cloud screen history readable by time and app, and they keep
**on-device** semantic search, which reads embeddings from the local
store and never touches Pinecone. The OCR text is still stored, so
vectors can be backfilled on upgrade: the gate defers the cost rather
than destroying the ability to recover.

Gated on the desktop access tier, not `is_paid_plan` — screen activity
is a desktop capability and a mobile-only paid plan did not buy it. BYOK
does not grant it either: BYOK covers the user's own LLM keys, but the
vector store is ours. Enforced server-side at ingest, since the client
cannot be trusted about its own entitlement. Fails **open** on a lookup
error, matching `should_defer_desktop_processing`.

**Correction to the cost table above.** The Gemini embedding spend
(~$0.32/user/month) is *not* attributable to sync. Embeddings are
computed for local Rewind search on every capture regardless of whether
the row ever syncs, through our own proxy — sync merely piggybacks on
them. So this gate saves the Pinecone half (~$0.20/user/month), not the
embedding half, and the "this change" row above overstates what tiering
can recover. Tiering the embedding as well would mean tiering on-device
search; that is a separate product decision and is not made here.

## Verification

- `swift build` of the macOS package — a real build, not a typecheck.
- 9 Swift tests: migration on a populated store, a row unready at sweep
time delivered later, an open bucket shipping nothing, a closed bucket
shipping exactly one winner and never shipping again, the embedding wait
and its expiry, compaction keeping the longest text, and gated/failed
requeue.
- 8 backend tests covering timestamp canonicalization at ingest and the
Pinecone UTC fix.

Not verified: no deploy was run; no production Firestore sample was read
(network and credentials unavailable); the Pinecone index configuration
is not in the repo, so its storage class is unconfirmed.

---

## Part 3 — closing the beta gap between the two

Merging the two exposed a gap. The lossless-sync flag was PostHog-only
for every production-family bundle, so beta — the channel it exists to
be exercised on — would have shipped it dark while the rest of the
rollout was live there.

The gating helper is renamed `BetaDogfoodRollout` and now backs all
three client features: system calendar context, on-device meeting
identity, and lossless screen sync. Beta is on unless killed; stable
still requires its own positive PostHog flag; dev bundles keep their
environment override. A test asserts all three share one decision and
that each kill switch is derivable from its flag name, so a feature
added past this helper fails the suite instead of going silently missing
on beta.

## What is live where, after this merges

| | beta | prod |
| --- | --- | --- |
| `CONVERSATION_NOTES_V2_ENABLED` (+ calendar, OCR reads) | on | off |
| `system_calendar_meeting_context` | on (kill switch) | PostHog flag |
| `on_device_meeting_identity` | on (kill switch) | PostHog flag |
| `screen_activity_lossless_sync` | on (kill switch) | PostHog flag |
| Firestore field-index exemptions | on | on |
| Timestamp canonicalization | on | on |
| Cloud screen vectors gated to paid desktop | on | on |

The last three are not flagged: two are corrections with no behaviour
change to gate, and the vector gate is a cost boundary that should not
differ by environment.

## Combined verification

- `swift build` of the macOS package, and 29 Swift tests.
- 109 backend tests across five suites.

Not verified: no deploy was run; no production Firestore sample; the
Pinecone index configuration is not in the repo.

## One deferred definition

The failure-class protocol admits exactly one added class definition per
PR, and consolidating brings two.
`FC-high-water-cursor-skips-unready-row` is kept — the cursor defect
that silently discarded 99% of captured screen rows.

`FC-rollout-flag-absent-from-a-cohost-of-its-code-path` is deferred to
its own PR, not dropped. Its guard ships here regardless:
`test_conversation_notes_v2_beta_rollout.py` still asserts that
backend-listen and the Cloud Run backend can never disagree on a summary
rollout flag, which is the behaviour the class protects. Only the prose
definition moves.

## Product invariants affected

- INV-AUTH-1 — touched only by adding one migration to
`RewindDatabase`'s ledger. Ownership is unchanged: the migration
registers after every existing component migration and runs inside the
pool the owner transition already configures. Embedding writes keep
taking an owner-bound `LocalMutationAuthorization` lease, and the
requeue paths still check `generation == ownerGeneration` before
returning items to the buffer, so a batch spanning a retarget is dropped
rather than seeding the next owner's buffer with the previous owner's
rowids.

Failure-Class: new

Line-Count-Exception:
desktop/macos/Desktop/Sources/Rewind/Core/RewindDatabase.swift | 3450 ->
3470 | the schema migration and its callable boundary belong with the
other migrations in the ledger; splitting the file to add one column
would separate this migration from the ones it must stay ordered after
Line-Count-Exception: backend/utils/subscription.py | 1491 -> 1535 | the
entitlement helper belongs beside `should_defer_desktop_processing`,
whose tier semantics and fail-open contract it deliberately mirrors;
splitting it out would separate two gates that must stay consistent
Git-on-my-level added a commit that referenced this pull request Aug 19, 2026
Lands the failure-class definition that
[#11865](#11865) could not
carry.

The protocol admits exactly one added class definition per PR. #11865
consolidated two branches, so the screen-activity cursor class took the
slot and this one was deferred.

**The guard already shipped.**
`test_conversation_notes_v2_beta_rollout.py` asserts that
`backend-listen` and the Cloud Run `backend` service can never disagree
on a summary rollout flag, in any environment, and that the deployed
Helm values file matches the composed manifest. Only the prose
definition was missing.

## The class

`process_conversation` runs in two services: backend-listen finalizes a
live conversation, and the Cloud Run backend runs it inline for `POST
/v1/conversations/{id}/reprocess`. The three `CONVERSATION_*` rollout
flags were originally declared on backend-listen alone, so `os.getenv`
fell through to the `False` default on the reprocess host.

Enabling the rollout would then have produced a v2 note when a meeting
ended and a legacy note when the user pressed regenerate on that same
conversation. Both paths return a well-formed summary, so the
discrepancy reads as model nondeterminism rather than as missing
configuration — which is what makes it worth naming.

The definition text is unchanged from when it was written, so it reads
as it was reasoned rather than reconstructed. Evidence cites both the PR
that introduced the single-host declaration (#11834) and the one that
closed it (#11865).

Failure-Class: new


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/11870?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. -->
kodjima33 pushed a commit that referenced this pull request Aug 22, 2026
…mary is whole again (#12042)

* fix(desktop): Activity is reachable, stays selected, and opens what you clicked

Three defects, one surface. The hub's four views share two chat-first routes, and
every one of these came from a place where that sharing was hand-listed instead of
derived.

1. Activity always lost to Memories. `ChatFirstMemoryRoutePolicy` preserved the
   caller's hub view across the `.memories` route by naming one of them:
   `current == .brainMap ? .brainMap : .memories`. `.activity` was appended as a
   fourth hub view later and never added, so the route sync that runs on the very
   next `onChange` rewrote the just-written `.activity` back to `.memories`. The
   click was correct and then undone a frame later, from the pill and from the
   hub's own switcher alike. It now derives the answer from the one route mapping
   (`MemoryHubSelectionPolicy.chatFirstRoute`), so a view that lives on a route
   survives it and the next view added cannot ship broken the same way.

2. The pill said Memories and opened whichever view was persisted last. It is
   titled Activity, wears a glyph that is not Rewind's, and routes through
   `selectHubDestination(.activity)` — the same writer the switcher uses, so one
   path owns moving both halves of the state. Conversations, Memories and Brain
   Map stay one click away in the hub switcher; `ShellDestination.activity.reach`
   is now `.topBar` so the reachability model states that honestly, and
   `unreachable()` remains empty (INV-NAV-1).

3. Activity's rows did not open anything. Memory rows had no action at all — no
   Button, no tap gesture, no hit region — so the one row naming what Omi learned
   was the one row you could not open; clicks landed on the conversation card
   above it. Conversation rows carried the full record, narrowed it to an id,
   wrote that id into the automation *snapshot* singleton, then called
   `selectPrimary`, whose contract is to discard an unconsumed deep link. Rows now
   hand the record to the typed deep link, and memories open through the gate the
   Brain Map's citations use, which does not leave Activity if the memory cannot
   be resolved.

`showsCaptureArchive` also had no second release: once any capture link was
followed it stayed latched, so later conversation navigation kept landing in the
reduced archive pane. An exact-conversation deep link now releases it, which is
what the branch's own comment already promised.

Verified: clicked through a real signed build (omi-navfix, prod backend, never the
production bundle). Activity pill -> Activity page; switcher Memories -> Activity
stays on Activity; conversation row -> conversation_detail_snapshot reports
detail_open=true on the exact conversation; standalone and indented memory rows
both open that memory's inspector; Chat/Tasks/Rewind/Apps pills each land on their
own page; hub switcher persists activity=3 conversations=1 brainMap=2 memories=0.
`swift-test-suites.sh`: 664 suites, 0 failures.
`OMI_AUTOMATION_PORT=47911 tests/test-mounted-navigation-latency.sh`: every route
mounts as itself within budget.

Failure-Class: new

Co-Authored-By: Claude Opus 5 <[email protected]>

* feat(desktop): Activity is three panels with one row of chips, and the row navigates

Activity carried two rows of chips a few points apart — the Memory hub's switcher
(`Activity | Conversations | Memories | Brain Map`) and, directly beneath it, a
filter row (`All | Conversations | Memories | Tasks | Rewind`) that narrowed the
spine in place. They shared three of their words and did different things, so the
row you were about to press told you nothing about what pressing it would do.

There is one row now, and every chip in it navigates. `Brain Map` joins it as a peer
destination. `All` becomes `Activity` — the page you are on, which is what the row's
selected state now means rather than a filter that happens to match everything.

**The spine's in-place filtering goes with it.** That is the real cost of the change
and it is deliberate: a row where `Conversations` leaves the page while `Tasks`
narrows it is the rule-then-broken-rule this row is being collapsed to avoid.
Home's search results keep their filter chips — that panel is shared, and a
navigating chip there would throw away the query you just typed, so `ChipBehavior`
makes the two surfaces say which one they are instead of drifting.

Activity also renders as three separate panels now, like Chat. It always built the
right column — the same `panelGap`, corner radius and lane Chat uses — but
`PageGlassLane` wrapped the whole Memory hub in a fourth, full-height panel, nesting
Activity's two inside it. Nesting `.behindWindow` inside `.behindWindow` does not
stack two materials, it takes a second copy of the desktop and doubles the scrim, so
Activity read visibly muddier than every page around it. The wrap is now asked which
hub page is mounted: Activity brings its own glass, the hub's list pages still need
the lane.

Two things this uncovered:

- `ShellDestination.Reach.memoryHubView` named the switcher as the mechanism reaching
  Conversations, Memories and Brain Map, but `unreachable()` only ever checked that a
  pill existed. Deleting the switcher would have stranded three pages with every test
  green. `Reach.activityChipRow` is checked against `ActivityDestinationChip`, the same
  value the row renders from, so the claim is falsifiable now.
- The non-chat-first shell's pill never wrote the hub destination — `DesktopTopBar`
  declared the binding and never used it. With the switcher gone, pressing `Activity`
  there would land on Memories (the stored default) with neither a switcher nor a chip
  row: a dead end reachable from a cold launch. Both shells now force `.activity`.

Verified by clicking the real build (omi-navfix, prod backend, never the production
bundle): Activity renders as three separate panels with one chip row; Conversations,
Memories and Brain Map chips each open their page; Tasks and Rewind chips reach
theirs; the Activity pill returns from each. `scripts/swift-test-suites.sh`: 663
suites, 0 failures.

INV-NAV-1

Co-Authored-By: Claude Opus 5 <[email protected]>

* fix(desktop): the conversation summary renders the sections the backend sends

The summary did not get worse; the client stopped reading most of it. The backend's
notes pipeline moved the substance of a conversation summary out of `overview` and
into `structured.sections` — headed blocks, each with a markdown body — leaving
`overview` a short compatibility paragraph. The generated wire DTO has decoded
`sections` since that landed. The domain `Structured` never read the field: a grep
for it across the desktop sources outside `Generated/` returned nothing. So every
desktop surface rendered the compatibility paragraph and presented it as the whole
summary.

`sections` is now decoded, encoded, and rendered:

- `SummarySection` on `Structured`, populated in both initialisers and round-tripped
  through `encode(to:)` — the cache path matters as much as the decode, since
  dropping it there empties an already-correct summary one relaunch later. Named
  `SummarySection` rather than `Section` because the latter shadows SwiftUI's
  `Section` across the whole module.
- One `ConversationSummarySections` view used by both detail surfaces. They had
  already drifted — the legacy editor rendered markdown, the chat-first archive
  pane rendered plain `Text` — and a shared renderer is what keeps the next field
  the backend adds from reaching only one of them.
- The archive pane also gains markdown and action items, which it never showed.

Deliberately unchanged: an app-generated summary still replaces `structured.overview`
rather than appearing beside it. That is a recent, intentional mobile-parity
decision; sections are added on top of it rather than reopening it here.

Note for whoever picks this up next: the Flutter app has the identical gap in
`app/lib/backend/schema/structured.dart`, so "match mobile" is a lower bar than
"render what the backend sends". Worth its own issue.

Verified: clicked a conversation in a real signed build (omi-navfix, prod backend);
its detail renders "Product Cleanup" and "Metrics Strategy" as headed markdown with
bullets where it previously showed one paragraph. New decode tests cover the wire
decode, a missing `source_segment_ids`, a pre-notes-pipeline capture with no
sections, and the cache round trip. `swift-test-suites.sh`: 664 suites, 0 failures.

Failure-Class: new

Co-Authored-By: Claude Opus 5 <[email protected]>

* fix(app): the conversation summary renders the sections the backend sends

Same defect the desktop had, in the Flutter client: the backend moved the substance
of a conversation summary out of `structured.overview` and into `structured.sections`
— headed blocks, each with a markdown body — leaving `overview` a short compatibility
paragraph. `conversation_wire.g.dart` has decoded `sections` since that landed, but
`Structured` in `structured.dart` declared only `title, overview, emoji, category,
actionItems, events`, and `fromGenerated` never read the field. The data arrived on
every conversation and was dropped on the floor.

`sections` is now carried through every path that builds a `Structured`: `fromJson`,
`fromGenerated`, `toJson`, `toGenerated`, and `toString()`. `toJson` is the one that
matters most and is easiest to miss — `ServerConversation.toJson` is the local cache
path, so a field that decodes but does not serialize renders correctly on first load
and comes back empty after the next app launch. `toString()` matters because it is
what "copy summary" puts on the clipboard, which was losing the same content.

`Section` is a typedef over the generated wire type rather than a hand-written
adapter: it has no client-only fields or behavior, and the typedef guarantees the
`body_markdown` / `source_segment_ids` key symmetry that a second hand-rolled
`fromJson` would eventually get wrong.

Rendered through the existing `ConversationMarkdownWidget` with the same stylesheet as
the overview above it, so nothing about the screen's styling changes. Sections show
only when Omi's own summary is being displayed — an app-generated summary replaces
them, matching how `overview` already behaved.

Deliberately left alone: sections render as their own markdown block rather than
being concatenated into the summary content, because double-tap-edit writes the whole
rendered string back into `structured.overview` only, so folding them together would
permanently duplicate the sections into the overview on the first edit.

Verified: `app/test.sh` full suite 1409 passed, 0 failures, 5 pre-existing skips.
New tests cover the wire decode, the `toJson` round trip, `fromGenerated`, the full
`ServerConversation` cache round trip (the app-restart case), and a missing `sections`
default; two widget tests pump the real `AppResultDetailWidget` and assert the section
headings and bodies actually paint. Regression proof: deleting the `sections` line
from `Structured.toJson` fails the round-trip tests with `Expected: length of <2> /
Actual: []`.

Not verified: no run against a live signed-in account with a real summarized
conversation — the UI evidence is the widget test, not a screenshot of the shipping
app.

Co-Authored-By: Claude Opus 5 <[email protected]>

* fix(desktop): the benchmark's error path stops masking the HTTP failure it found

`context-bucket-benchmark.py` enriches an HTTP failure by reading the error body for
a stable error code. The read was guarded by an enumerated tuple —
`(AttributeError, json.JSONDecodeError, UnicodeDecodeError)` — and the ways an
`HTTPError` body can be unreadable are not enumerable across interpreters. On Python
3.9, which is what macOS ships as `/usr/bin/python3`, `HTTPError(..., fp=None).read()`
raises `KeyError('file')` out of `tempfile.__getattr__`. That escaped the guard and
replaced the real `probe returned HTTP 400` with a traceback about a temp file.
Python 3.12+ returns `b''` instead, so the defect is invisible there — which is how it
shipped.

The read is best-effort diagnostic enrichment, so it now catches broadly and the real
`RuntimeError` always survives. No assertion is weakened: the stable-error-suffix case
still asserts the full enriched message. The new regression test drives an error body
whose `read()` raises, so the contract is pinned on every interpreter rather than only
on the one that happened to expose it.

`test.sh` also aggregates its launcher-script section instead of aborting on the first
failure. `set -euo pipefail` over that loop meant one red script cost the entire Python
and Swift stages — the operator saw a single error and got zero signal from the 663
Swift suites below. #11747 fixed the membership that made that reachable without a real
failure; any genuinely failing script still reproduced the same blackout. Failures are
now collected, reported, and exit non-zero at the end, mirroring backend/test.sh.

Verified: the benchmark test passes on 3.9 and 3.14, and fails on both without the fix.
Full `test.sh` with a working venv: 44 launcher scripts, 202 pytest, 663 Swift suites,
exit 0. With a failure injected: exit 1, both failures listed in the aggregate, and all
663 Swift suites still ran — which is the behaviour this change exists for.

Not fixed, flagged instead:
- `tests/test-desktop-core-harness-readiness-teardown.sh` fails at pristine baseline on
  this machine ("readiness should recover from one transient startup failure"), confirmed
  against a clean tree via git stash. State-dependent; it shells out to `make dev-up`. So
  `test.sh` is still red here — but now red *after* running everything rather than hiding
  the Swift stage.
- `scripts/pre-push:762` keeps a third hand-listed copy of the discovery-skip membership
  that `check-launcher-test-skips.py` does not cover — the same class #11747 fixed, in a
  loop the guard does not reach.
- `scripts/agent-continuity-gauntlet-lib.py:200` has the same unguarded `exc.read()` shape.

Failure-Class: none

Co-Authored-By: Claude Opus 5 <[email protected]>

* chore(failure-class): declare FC-mirrored-model-omits-new-member

Both defects in this PR are one shape: a hand-written model or policy that mirrors a
source of truth by restating its members, and is not updated when the source gains one.
#11834 added `sections` to the conversation wire schema — the generated clients decoded
it, the hand-written Swift and Dart domain models never read it, and every summary
silently rendered a compatibility stub. #11372 added `.activity` as a fourth hub view
sharing the memories route, and the route-survival policy preserved members by naming
one of them, so the new view was rewritten back a frame after every click.

Neither produced a decode error, an unhandled case, or a failing test: a mirror that
drops a member is still internally consistent, so the product reads as thin or flaky
rather than as broken, and it ships.

Co-Authored-By: Claude Opus 5 <[email protected]>

* chore(desktop): changelog fragment for the Activity and summary fixes

Co-Authored-By: Claude Opus 5 <[email protected]>

* chore(desktop): cover the two new Activity/summary sources with existing e2e flows

Co-Authored-By: Claude Opus 5 <[email protected]>

* fix(desktop): drop a force unwrap from the reachability test

Failure-Class: none

Co-Authored-By: Claude Opus 5 <[email protected]>

---------

Co-authored-by: Claude Opus 5 <[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