Skip to content

feat: configurable daily recap depth (Brief/Normal/Deep) - #20003

Merged
aryanorastar merged 1 commit into
BasedHardware:mainfrom
aryanorastar:feat/6137-recap-depth
Oct 5, 2026
Merged

aryanorastar merged 1 commit into
BasedHardware:mainfrom
aryanorastar:feat/6137-recap-depth

Conversation

@aryanorastar

@aryanorastar aryanorastar commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

What changed and why

Closes #6137. Daily recaps were hard-coded to the short “be snappy” prompt. Users can now choose Brief, Normal, or Deep Reflection in macOS Settings → Alerts & Privacy → Daily Summary; the preference is stored on their account and used when the next recap is generated.

  • Brief preserves the existing limits and is the default for older or malformed profiles.
  • Normal allows up to eight useful items per section with context and related themes.
  • Deep removes fixed item counts and uses bounded context from up to three earlier recaps and three active goals. It asks for grounded connections and never invents emotional states. The optional context reads fail soft with fallback telemetry.
  • The GET/PATCH settings contract remains compatible with older callers. A depth PATCH echoes the saved value; the desktop picker reverts with an error if an older backend ignores it, instead of falsely appearing saved. The recap output JSON schema is unchanged and existing recaps are not rewritten. The app-client OpenAPI snapshot and generated Dart/TypeScript API clients are updated mechanically; a kind: none mobile fragment records that this is not a mobile feature.

Backend must deploy before the desktop picker is released. This PR does not deploy either service.

Product invariants affected

none (the new control uses the existing settings row and menu components; the desktop UX contract and brand ratchets pass).

How it was verified

  • backend/.venv/bin/python -m pytest backend/tests/unit/test_daily_summary_*.py backend/tests/unit/test_daily_notification_*.py backend/tests/unit/test_notifications_daily_summary_null_defaults.py backend/tests/unit/test_backfill_daily_summary_schedule_fields.py backend/tests/unit/test_users_error_sanitization.py -q → 202 passed on the rebased branch. Includes a real FastAPI TestClient GET → PATCH → GET round trip and captured production-generator prompts for each depth.
  • ./scripts/dev-feedback.py --once swift 'APIClientRoutingTests' → 72 passed on the rebased branch. Covers PATCH wire body, backend acknowledgement, legacy response rejection, and GET decoding fallback.
  • OMI_PR_BODY_FILE=/tmp/omi-6137-pr-body.md make preflight → 46 checks passed after rebasing onto current origin/main (including the scoped line-count exception below).
  • Generated OpenAPI, Dart users DTO, and all four TypeScript API clients pass their freshness checks. web/app tests pass 601/601 with NODE_OPTIONS=--no-experimental-webstorage to avoid a Node 26/jsdom global localStorage collision in this environment.
  • Built and launched isolated com.omi.omi-6137-recap-depth on macOS. The named bundle passed dependency audit, loaded signed-in Settings, and the accessibility tree exposed the picker. I opened its menu and visually confirmed all three options without changing the live account preference. Visual proof.
  • No production LLM call or live account-setting mutation was made. Generated recap quality still needs human review on a development backend after deployment.

Tests

  • test_daily_summary_depth_settings.py tests HTTP persistence and invalid values.
  • test_daily_summary_depth_prompt.py tests the real generator prompt, bounded prior context, non-Deep read avoidance, and optional-read degradation.
  • Firestore schedule-field tests prove changing depth preserves the existing daily-summary schedule.
  • APIClientRoutingTests covers desktop wire compatibility and failure presentation preconditions.

Failure class (fixes)

Failure-Class: none

Scoped cleanups

The existing daily-summary PATCH returned {status: "ok"} while its Swift client attempted to decode the GET response shape; this change corrects that contract. An unrelated users error-sanitization test gained the missing quota mock so the broader hermetic suite does not attempt a metadata-network call.

Line-Count-Exception: backend/routers/users.py | 2525 -> 2541 | reason: extend the existing daily-summary settings endpoint in place; splitting this large router as part of a scoped account-preference feature would add unrelated routing churn.

Review in cubic

@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks @aryanorastar — this is a well-built feature. I reviewed the full diff; notes below.

Backend

  • backend/config/daily_summary_depth.py: clean single source of truth for the depth Literal; normalize_daily_summary_depth() mapping absent/malformed values to brief keeps legacy accounts on the existing prompt.
  • backend/database/notifications.py: get/set_daily_summary_depth reuse _update_summary_schedule, so the write is transactional and cannot clobber enabled/hour; invalid values raise before any transaction (covered by test_daily_summary_depth_rejects_invalid_write_without_transaction).
  • backend/routers/users.py: the PATCH response model change (UserStatusResponse -> DailySummarySettingsUpdateResponse subclass) is additive; old callers still get status:"ok". Minor note: a PATCH carrying both an invalid hour and a depth returns 400 before depth is applied — acceptable, just worth knowing.
  • backend/utils/llm/external_integrations.py: depth only selects prompt branches; the stored preference is never interpolated raw into the prompt, so there is no injection path from the setting. Deep-mode context is bounded (3 prior recaps and 3 goals, each truncated) and explicitly framed as data, not instructions — good prompt-injection hygiene. Fail-soft reads call record_fallback per repo convention (I checked the signature against utils/observability/fallback.py).

Desktop

  • APIClient+Settings.swift: the depth-echo check (notConfirmed when an older backend omits/ignores depth) prevents a false saved state; DailySummarySettings decodes missing/unknown depth as brief.
  • SettingsContentView+SettingsUpdates.swift / +NotificationsPrivacy.swift: the revision counter avoids a stale GET overwriting an in-flight picker change, and the error path restores the saved value. Solid.

Generated surfaces

  • app/lib/backend/schema/gen/users_wire.g.dart, docs/api-reference/app-client-openapi.json, and the four omiApi.generated.ts copies are consistent mechanical regens (depth optional, brief default everywhere).

Tests

  • test_daily_summary_depth_prompt.py asserts the actual LLM prompt content per depth and that brief/normal make no extra DB reads; test_daily_summary_depth_settings.py covers the round trip including the legacy default and 422 on a bad depth; APIClientRoutingTests.swift covers the old-backend echo rejection. backend/docs/daily-recap-depth.md matches what the code does, including the deploy-ordering caveat.

Left for human maintainer review: this changes user-facing recap output for two new tiers and the PATCH response contract, so the Normal/Deep prompt copy and the API shape deserve a product sign-off before merge. Also fine to confirm: Deep increases per-recap LLM token usage (bounded context plus longer entries) — intended, but worth an explicit yes.

This feedback is AI-generated on behalf of the maintainer team.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added needs-maintainer-review Needs a human maintainer to sign off before merge backend Backend Task (python) labels Sep 30, 2026
@Git-on-my-level

Copy link
Copy Markdown
Member

Reviewed the full diff (25 files, head 34b14b3). This is a cohesive feature — account-level recap depth wired from the backend contract through prompt generation to the macOS picker — and the execution quality is high:

  • backend/config/daily_summary_depth.py: the Literal['brief','normal','deep'] contract with normalize_daily_summary_depth() mapping any missing/malformed value to brief is exactly the right legacy behavior, and it's used consistently at both the settings layer and generation time.
  • backend/utils/llm/external_integrations.py: factoring the previously hard-coded copy into _daily_summary_depth_copy() / _daily_summary_entry_examples() with the brief branch reproducing today's prompt verbatim avoids any regression for existing users. _deep_reflection_context() is well-guarded: reads bounded to 3 earlier recaps and 3 active goals, per-field truncation caps, each optional read fails soft with record_fallback telemetry, and the injected recap/goal text is explicitly framed as data rather than instructions.
  • backend/routers/users.py: the additive GET field and the depth echo in DailySummarySettingsUpdateResponse are a nice touch — the desktop client can distinguish "saved" from "silently ignored by an older backend," which is the right compatibility contract.
  • Desktop: APIClient+Settings.swift verifying the echo (DailySummaryDepthSaveError.notConfirmed → revert + user-visible error, never a false saved state) plus the revision guard in SettingsContentView+BillingHelpers.swift against hydrate races shows careful state handling; legacy/unknown depth decoding to brief matches the backend default.
  • Tests cover the meaningful behaviors: prompt-tier selection incl. the malformed 'not-a-depth' fallback, deep-context bounds (get_daily_summaries called once with limit=3/end_date=day-before), a real TestClient GET→PATCH→GET round trip, and the desktop echo-rejection cases. The regenerated Dart/TS clients and openapi snapshot match the backend schema.

One non-blocking follow-up: PATCH returns {'status': 'ok', 'depth': data.depth} echoing the requested value rather than re-reading Firestore. If _update_summary_schedule can ever return False without raising, the client would show a saved state that didn't persist — worth confirming that path always raises on failure (or echoing the stored value).

The docs (backend/docs/daily-recap-depth.md) match the implementation, including the deploy-order note. Leaving for human maintainer review: this adds a user-facing product tier set (Brief/Normal/Deep Reflection) and new prompt copy for Normal/Deep, which deserves a product-direction call before merge.

--
This is automated AI-generated feedback posted on behalf of the maintainers.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added the positive-signal Automation verified a genuine fix/quality contribution label Oct 1, 2026

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

Feature (configurable daily recap depth Brief/Normal/Deep), not a bug fix -> approve-only per confidence gate. Closes long-standing request #6137, well-tested, no abuse signals.

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed this end to end — backend contract, persistence, prompt changes, macOS picker, tests, and the regenerated clients. Verified on the current head:

  • backend/config/daily_summary_depth.py — clean Literal['brief','normal','deep'] contract; normalize_daily_summary_depth maps missing/malformed legacy values to brief, so existing accounts see zero behavior change.
  • backend/database/notifications.py — get/set_daily_summary_depth reuse _update_summary_schedule, and the new round-trip test pins that a depth write can't clobber daily_summary_enabled/daily_summary_hour_local. Invalid writes raise before any transaction.
  • backend/routers/users.py — PATCH validates depth via pydantic (422 on unsupported values) and echoes the saved depth so new clients can detect an older backend; legacy enabled/hour-only PATCH keeps its status: ok shape. GET now carries one extra Firestore doc read per call (minor; fine unless this endpoint gets hot).
  • backend/utils/llm/external_integrations.py — the brief prompt copy is byte-identical to the previous rules. Deep mode's optional context reads are bounded (3 earlier recaps, 3 goals, fields truncated), fail soft via record_fallback, and the injected text is framed in-prompt as data rather than instructions — consistent with how conversations already enter the prompt. Output JSON schema is unchanged and old recaps are never rewritten.
  • APIClient+Settings.swift + the Settings view changes — the picker requires a matching depth echo from the PATCH and reverts with an error instead of showing a false saved state on an older backend; the revision guard correctly prevents a slow hydrate from clobbering an in-flight selection. APIClientRoutingTests.swift covers echo, no-echo, and legacy/unknown-depth decoding.
  • backend/docs/daily-recap-depth.md checks out against the code (defaults, 422, echo semantics, bounded reads, no regeneration, deploy ordering).
  • Both newly imported modules (utils.observability.fallback, database.goals) already exist on main.

The new tests are substantive: prompt-variant coverage including malformed depth → brief, a real TestClient GET→PATCH→GET round trip, Firestore round-trip without schedule replacement, and the desktop routing cases. Backend unit suite and Desktop Swift Build & Tests pass on this head.

Two minor non-blocking notes: (1) the extra Firestore read on GET mentioned above — worth a caching thought if the endpoint ever gets hot; (2) _deep_reflection_context runs strptime on date_str outside the try/except, so a malformed internal date would raise before the fail-soft reads — low practical risk since the scheduler supplies the date.

Thanks @aryanorastar — this is a well-executed feature with real compatibility care (the old-backend echo detection is a nice touch). With kodjima33's approval on this head the human sign-off is covered, so I'm dropping needs-maintainer-review. One release reminder: the backend needs to deploy before the desktop picker ships, as the PR description already notes.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level removed the needs-maintainer-review Needs a human maintainer to sign off before merge label Oct 2, 2026

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

feat: configurable daily recap depth — feature, not a bug fix, backend area; approve-only per confidence gate

@aryanorastar
aryanorastar merged commit 0842f9f into BasedHardware:main Oct 5, 2026
68 of 69 checks passed
aryanorastar added a commit to aryanorastar/omi that referenced this pull request Oct 5, 2026
BasedHardware#20003, BasedHardware#19815 and BasedHardware#15669 each regenerated the clients against their own
base and merged cleanly, leaving main's "Total: 478 client methods" header
one short of the 479 the spec now generates. The knowledge-ledger client
schema contract compares the checked-in artifacts and failed on every branch
that merged main. Regenerated; only the five total lines change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
aryanorastar added a commit to aryanorastar/omi that referenced this pull request Oct 5, 2026
main's generated clients carry "Total: 478 client methods" while the merged
spec generates 479 (BasedHardware#20003, BasedHardware#19815 and BasedHardware#15669 each regenerated against their
own base). The knowledge-ledger client schema contract fails on every branch
that merges main. Regenerated; only the five total lines change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Oct 12, 2026
…mbient listening (#11801)

* feat(desktop): hands-free wake word to command the assistant during ambient listening

Add an opt-in Wake Word feature: say "Omi" followed by a command while
ambient listening is active and the assistant runs the command hands-free.

- WakeWordService: parses and gates wake-word triggers (cooldown, segment
  dedup, user-speech and busy-conversation guards) and submits the stripped
  command to the assistant
- WakeWordSegmentParser: extracts wake phrase + 2-word-minimum command
- Wire incoming transcript segments from AppState+ListenEvents
- Settings > General: opt-in Wake Word toggle with dynamic subtitle
- AssistantSettings: persisted wakeWordEnabled/Phrase/Cooldown (default off)
- Tests: WakeWordServiceTests + WakeWordSegmentParserTests (15 cases green)

* style(desktop): format WakeWord sources with pinned swift-format; add e2e flow coverage

Fix the two Desktop Swift CI failures:
- desktop-e2e-flow-coverage: cover WakeWordService.swift and
  WakeWordSegmentParser.swift under capture-lifecycle.yaml (the
  capture_test_transcript seam drives the same AppState+ListenEvents
  funnel the wake word observes).
- desktop-swift-format-lint: add missing trailing newlines to the four
  WakeWord source/test files per pinned swift-format 602.0.0.

Verified: run_checks.py macos lane passes e2e-flow-coverage,
swift-format-lint, and swiftlint; WakeWord 15 tests pass
(WakeWordSegmentParserTests 7 + WakeWordServiceTests 8).

* fix(desktop): match speech-to-text renderings of the wake phrase

The wake word only matched the literal string "omi", but speech-to-text
spells the phrase by sound. A live mic session transcribed "Omi, how are
you?" as "Oh me, how are you?" (Parakeet v3, conf=0.92) and the wake word
silently never fired -- the recognizer heard the user correctly and the
parser rejected it.

Accept the renderings recognizers actually emit ("oh me", "omni", "ohmi",
"oh mi", "omee", "o me", "oh-me") as the same phrase, expanded through the
existing greeting prefixes so "hey oh me, ..." works too. The downstream
guards (user speech only, 2+ word command, cooldown, segment dedup) still
bound the false-positive cost of the wider match.

The existing unit tests passed before and after this change because they
fed the parser the string "Omi" -- which is exactly what the microphone
never produces.

Verification
- swift test --filter WakeWordSegmentParserTests -> 10 passed
- Added the exact failing string from the live session as a regression test,
  plus negatives proving the wider match does not swallow ordinary speech
  ("Omnibus schedule changed" and a bare "Oh me" still do not fire).

* fix(desktop): make the wake word survive the real ambient transcript

Three defects found by running the feature against a live ambient session
rather than constructed segments. Each failed silently, so a wake word that
never fired was indistinguishable from one that was never spoken.

1. Diarization attribution. The trigger required `segment.isUser`, but the
   backend only sets `is_user` once a speech profile is enrolled. A live
   session logged `Speaker 0: "Omi, what's the weather?"` with is_user=false,
   so the wake word was structurally dead for every user without an enrolled
   profile. VoiceBargeInPolicy already gates on `isUser || speaker == 0` and
   documents speaker 0 as the primary user; the two entry points disagreed
   about what "the user" means. Align on the sibling's contract.

2. Segment dedup. The backend re-delivers one growing segment under a single
   id (observed: [206.0s-217.1s] -> [206.0s-228.9s]). Deduping on the id alone
   dropped every later command that landed inside an id that had already
   fired. Key on the id plus the extracted command so a re-sent segment is
   still suppressed but a new instruction inside it runs.

3. Cooldown. The cooldown exists to swallow a rapid repeat of the same
   utterance, but it gated on elapsed time alone. The ambient transcript lane
   runs ~35s behind live speech (measured over 11 segments, 34.3-36.6s), so
   several genuinely distinct commands routinely arrive inside one 30s window
   and were discarded as "repeats" -- two consecutive "what time is it"
   attempts were both lost this way. Gate on a repeat of the same command.

Also name the reason a segment was ignored. Every guard returned silently;
the diagnostics are what located defects 1 and 2, and the demo runbook
depends on the log explaining a beat that did not fire. Only segments that
actually carry the wake phrase are reported, so ordinary speech stays quiet.

Verification
- swift test --filter WakeWordServiceTests -> 11 passed
- Regression tests added for each defect, carrying the live values that
  exposed them (speaker 0 with is_user=false, a reused segment id, a distinct
  command inside the cooldown).
- Confirmed live after the fix: `WakeWord: submitting 'can you order food for
  me?' to the assistant`, and the re-delivered segment correctly suppressed.

Honest gaps
- The ~35s ambient latency is server-side (client ships audio every 100ms via
  audioBufferSize=3200); it is not addressed here and needs the realtime lane.
- Not verified against an account with an enrolled speech profile.

* fix(desktop): speak the assistant's reply to a wake word

The wake word dispatched with `fromVoice: false`, which is the flag that
decides whether the assistant speaks its answer or only renders text. A wake
word is a hands-free entry point by definition -- the user's hands and eyes
are elsewhere -- so a silent reply strands the interaction the feature exists
to enable. Observed live: the trigger fired and answered correctly, and the
user heard nothing.

PushToTalkManager already passes `fromVoice: true` for the same reason.

Verification
- swift build -> clean
- swift test --filter 'WakeWordServiceTests|WakeWordSegmentParserTests' -> 21 passed

Honest gaps
- Voice follow-up is still unavailable from the wake word. `sendFollowUpQuery`
  exists and PushToTalkManager uses it with a voiceTurnID, but the wake word
  always opens a fresh query, and `guard !isConversationActive` suppresses the
  trigger while a turn is live. Wiring multi-turn to the wake word needs the
  realtime lane, not the ~35s ambient lane; tracked separately.

* fix(desktop): accept aspirated renderings of the wake phrase

On-device recognition has no keyword list, so it fronts the vowel with an
aspirate. Observed live from one speaker in a single session:

    "Homi what's the weather? outworking."
    "Homie, can you order food for me? Street drive to children dance."

Adds "homi" and "hommi". Deliberately excludes "homie": it is an ordinary
English word, and accepting it as the wake phrase would fire on real speech.

Scope note: this list is a safety net, not the fix. `TranscriptionService`
already seeds ["Omi", "OMI"] into the STT keyword boost, and on the cloud lane
the phrase transcribes exactly every time. These misses only occur on the
on-device lane, which takes no keyword list -- the durable fix is keyword
boosting on the recognizer, not a longer list here.

Verification
- swift test --filter WakeWordSegmentParserTests -> 10 passed

* fix(desktop): stop a growing transcript segment re-firing the wake word

A backend segment is re-delivered as it grows, in place and under one id. The
previous dedup keyed on the exact extracted command, so every growth counted as
a new instruction and fired again with a longer string. Worse, the assistant's
own spoken reply is captured by the microphone and appended to the same
segment, so each re-fire submitted a more polluted command. Observed live:

    12:41:32  submitting 'what time it is? You speak English. Got it.'
    12:41:33  submitting 'what time it is? You speak English. Got it. Handed you this'
    12:41:39  Transcript [ADD] Speaker 1: Handed you this An agent is getting started on that.

The query actually dispatched was the polluted string, which is not what the
user asked and cannot be answered usefully.

Deduping on the id alone is also wrong -- it drops a genuinely new instruction
that lands in a reused id. Treat a command that extends one already fired for
that segment as the same instruction, and anything else as new.

Verification
- swift test --filter WakeWordServiceTests -> 12 passed
- Regression test carries the live growth case.
- Confirmed live: one clean `submitting 'what time it is?'`, and the following
  re-delivery correctly `ignored — already fired`.

Honest gaps
- The microphone capturing the assistant's own speech is a separate defect and
  is not addressed here; this change only stops it corrupting the command.

* fix(desktop): restore wake word dispatch broken by fromVoice

An earlier commit on this branch switched the wake word to
`openAIInputWithQuery(command, fromVoice: true)` so the assistant would speak
its answer. That silently disabled the feature end to end.

`openAIInputWithQuery` gates the voice path on a turn it does not mint:

    if fromVoice {
      guard let voiceTurnID,
        VoiceTurnCoordinator.shared.requireCurrentOwner(for: voiceTurnID) != nil
      else { return }

`fromVoice: true` with no `voiceTurnID` fails that guard and returns with no log
and no user-visible effect. Every wake word therefore logged `submitting` and
dispatched nothing -- the trigger looked healthy in the log while the assistant
was never invoked.

`fromVoice: true` belongs to callers that own a voice-turn lifecycle:
PushToTalkManager begins a turn and passes both arguments. The wake word submits
an already-transcribed command and owns no turn, exactly like
DesktopAutomationBridge, which passes `fromVoice: false` for the same reason.

Verification
- swift build -> clean
- swift test --filter 'WakeWordServiceTests|WakeWordSegmentParserTests' -> 22 passed
- Confirmed live: `WakeWord: submitting 'what time is it?'` followed 1.3s later by
  `WakeWord: ignored — assistant already busy`, i.e. the turn actually engaged.
  With `fromVoice: true` that second line never appeared on any attempt.

Honest gaps
- The reply is no longer spoken aloud; it renders in the floating bar. Restoring
  spoken replies requires minting a VoiceTurnID via
  `VoiceTurnCoordinator.begin(intent:)` before dispatch and threading it through,
  which is a separate change and is not attempted here.

* fix(desktop): require a pause after a homophone wake phrase

Review feedback on this PR: with "oh me" accepted as the wake phrase, an ordinary
sentence like "oh me and my friend went hiking" parses to the 2-word command
"and my friend went hiking" and auto-sends it. That false-positive surface was
introduced by the homophone table earlier in this branch.

The homophones and the literal spelling are not the same kind of evidence. Saying
"Omi" is deliberate -- nobody produces it mid-sentence by accident -- so
"Omi order food" needs no corroboration. A homophone is the recognizer guessing,
and its guesses are ordinary English, so it needs something more.

A bare homophone now has to be followed by a punctuation break: the recognizer's
own signal that the speaker addressed something and then paused. Every homophone
hit observed live carried one ("Oh me, how are you?"). A greeting prefix is
corroboration in its own right -- "hey oh me" is not said by accident -- so those
forms keep the ordinary word boundary.

    "Omi order food"                    fires    (literal, unchanged)
    "Oh me, how are you?"               fires    (homophone + break)
    "hey oh me order pizza"             fires    (greeting corroborates)
    "oh me and my friend went hiking"   ignored  (bare homophone, no break)
    "o me it has been a long day"       ignored

This only ever makes the wake word fire less, so the risk it carries is a missed
trigger, never a spurious one.

Verification
- swift test --filter 'WakeWordSegmentParserTests|WakeWordServiceTests' -> 25 passed
  (13 parser + 12 service; 3 new, every prior case still green)
- New cases use the reviewer's example sentence and the exact strings observed live.
- Confirmed live on the dev serving plane after the change, both forms in one session:

      20:44:35  Transcript: "Hey Omi what's the time"
                WakeWord: submitting 'what's the time' to the assistant
      20:44:37  Transcript: "Omi, what is the time?"
                WakeWord: ignored — assistant already busy

  The second line is the trigger being correctly suppressed while the turn opened
  by the first was still live, which is also proof the dispatch engaged.

Honest gaps
- Punctuation is a proxy for a spoken pause and depends on the recognizer emitting
  it. A homophone rendered without punctuation will now be missed rather than
  misfire, which is the safer direction but is still a miss.
- Does not address a wake phrase transcribed in a non-Latin script (the socket runs
  language=multi); matching remains ASCII-only.

* fix(ci): bypass stalled Azure apt mirror

The hosted runner's Azure Ubuntu mirror repeatedly stalled Redis setup until the 20-minute gauntlet deadline. Use the existing archive.ubuntu.com fallback directly for each Redis-dependent gauntlet.\n\nVerification:\n- actionlint -config-file .github/actionlint.yaml .github/workflows/backend-hermetic-e2e.yml\n- python3 backend/scripts/check_workflow_contracts.py --changed-files .github/workflows/backend-hermetic-e2e.yml\n- git diff --check\n\nFailure-Class: none

* fix(ci): bypass stalled Azure apt mirror in Linux package helper smoke

Same stall as backend-hermetic-e2e's Redis install (69e5a9e): the
hosted runner's Azure Ubuntu mirror hangs InRelease fetches, this time
in desktop-windows-ci's Linux runtime dependency install, until the
job's 6-hour default timeout cancels it. Drop the mirror the same way,
falling back to archive.ubuntu.com directly.

Verification:
- actionlint -config-file .github/actionlint.yaml .github/workflows/desktop-windows-ci.yml
- git diff --check
Failure-Class: none

* chore(ci): retrigger hermetic suite after a scope-detect runner cancellation

Detect Hermetic Backend Scope was cancelled mid-run by a runner race, so
Backend Hermetic Merge Gate read SCOPE_RESULT: cancelled and failed
closed. Distinct from the apt-mirror stall in #11848 — this one never
reaches a package fetch. No code change; the branch has no admin rights
to rerun the workflow directly.

* feat(desktop): recognize evidence-backed Omie wake-word transcripts

* fix(desktop): end an on-device transcription window when the speaker pauses

The wake word's latency was not the cloud ambient lane. On Apple Silicon
`STTSessionState.resolveMode` picks the on-device Parakeet path by default, and
`LocalTranscriptionService` only closed a window on a fixed 10s boundary — so a
spoken command waited for wherever it happened to land in that window.

Measured live on a MacBook Air, real microphone, identical utterances:

  before   1.08s / 6.18s / 7.65s   (~5s expected, ~10s worst case)
  after    0.66s / 0.76s / 0.82s / 0.89s / 0.89s / 1.04s

Three changes, all in the on-device path:

- A window closes early once the buffer holds a second of voiced audio followed
  by 0.6s of quiet. The minimum is measured in voiced samples, not buffer
  length: a mostly-quiet window with one blip in it is what Parakeet answers
  with a hallucinated word (a 1.1s window at rms 0.0067 decoded to "Yeah.").
- Silence ahead of the first speech is dropped, advancing the emitted-seconds
  cursor over it so absolute timestamps stay exact. Otherwise quiet counted
  against the 10s cap and the window filled partway through the next sentence —
  observed cutting "Omi, what time is it now" down to "Now".
- The pump ticks at 0.5s rather than 1s, since it is now the floor on how soon
  a finished utterance can be transcribed rather than a poll for a full window.

The 10s cap is unchanged and still bounds continuous speech.

Verification:
- xcrun swift test --package-path Desktop --filter
  'LocalTranscriptionEndpointTests|LocalTranscriptionDuplicatePolicyTests|WakeWord'
  -> 42 tests, 0 failures
- Eight timed utterances through the real microphone on a named dev bundle,
  wake word enabled, on-device Parakeet: every one dispatched, full text, in
  0.66-1.04s from the end of speech.

Failure-Class: none

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

* feat(desktop): speak the wake word's answer and keep the conversation going

Two things a hands-free trigger needs that it did not have: the answer came
back as text only, and every command opened a fresh conversation.

Both came from one boundary being drawn in the wrong place.
`openAIInputWithQuery` selected the `.voiceOnly` surface on `fromVoice`, and
that surface requires a `VoiceTurnID` — so a voice query that owns no turn was
dropped with no diagnostic, which is why the wake word had to pass
`fromVoice: false` and therefore stayed silent. Selecting `.voiceOnly` on
`voiceTurnID` instead says what the branch actually means. Push-to-talk owns a
turn and is unchanged; the wake word falls through to the visible surface,
where `fromVoice` still marks it a voice query and the answer is spoken.
`sendFollowUpQuery` had the same guard and now applies the turn-optional rule
`routeQuery` already uses, so a second command continues the conversation.

`WakeWordService` dispatches through the new `submitSpokenCommand`, which is
both: spoken answer, conversation continuity.

Speaking the answer creates a feedback path that did not exist before — the
microphone hears Omi and it lands in the transcript as the user's own speech.
Observed live: `Transcript [ADD] Speaker 0: It's 8 57 p.m. on Sunday...` was
Omi. An answer carrying the wake phrase would command the assistant with its
own words, so the trigger is suppressed while playback is active. That is not
a wall in front of the user: `VoiceBargeInPolicy` halts playback the moment
they speak, so `isSpeaking` is already false when their transcript arrives.

`handleBackendSegments` now reads `isSpeaking` once, before the barge-in check.
Reading it afterwards reports false for the very segment that stopped playback.

Verification:
- xcrun swift test --package-path Desktop --filter
  'WakeWord|LocalTranscriptionEndpoint|VoiceBargeIn|LocalTranscriptionDuplicate'
  -> 51 tests, 0 failures
- Live on a named dev bundle, real microphone, on-device Parakeet:
  "Omi, what time is it now" -> answered aloud (the mic transcribed Omi's own
  reply back: "It's 8 57 p.m. on Sunday, August 23rd, 2026, in India, IST"),
  then "Omi, and what about tomorrow" -> "Tomorrow is Monday, August 24, 2026".
  A bare anaphoric follow-up resolved against the previous answer, and the
  telemetry surface moved from floating_text to floating_voice with a tts_start
  stage in both traces.
- A six-turn spoken session ordering food held one conversation throughout
  (cache_read 29953 -> 40968 -> 52003).

Failure-Class: none

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

* fix(desktop): stop ambient capture treating Omi's own voice as the user

Omi speaks into a room Omi is also recording. Ambient capture returns the
playback as a transcript segment attributed to the primary speaker — observed
live, `Transcript [ADD] Speaker 0: It's 8 57 p.m. on Sunday...` was Omi, not a
person. Four consumers then act on it as if the user had spoken:

- barge-in halts the very playback that produced it. Three times in one
  six-turn session, which is why a long answer stops partway: "I can help, but
  I need two details first. 1. Maya's delivery address" and no item 2.
- the wake word can be commanded by an answer carrying the wake phrase
- the conversation record gains speech nobody said
- memory extraction reads it

One guard at ingest, where all four route through, rather than four guards.

Dropping the whole segment is not enough. While Omi is talking there is no
pause to close the transcription window on, so a barge-in lands inside the same
window as the playback — measured: `1. Ganges Ganga, India's most sacred river,
and a vital water source. Omi, stop that and tell me the time is.` One
9-second window, two speakers. Discarding it would eat the interruption, which
is the one utterance that must never be lost. `VoicePlaybackEchoPolicy`
consumes the playback off both ends and keeps what the user said in between,
sliced from the original string so the punctuation the wake-word parser reads
survives.

Matching is loose about wording and strict about length, because speech-to-text
does not return what the synthesiser was handed: "Omi open my tasks now" came
back as "Only open my tasks now", "8:57 PM" as "8 57 p.m.", and a numbered list
goes out as "1." and returns as "One." It errs toward not-echo throughout — a
missed echo costs what the app already does today; a false echo deletes
something the user said.

Verification:
- xcrun swift test --package-path Desktop --filter
  'VoicePlaybackEcho|WakeWord|LocalTranscription|VoiceBargeIn' -> 68 tests,
  0 failures. Every echo string in the new suite was captured live.
- Full desktop suite: 5790 tests, 2 failures, both pre-existing order
  dependence unrelated to this change (FloatingBarNotificationPreviewPolicy,
  RewindCaptureExclusionGeneration) — they fail identically on the merge base
  under the same filter and pass in isolation.
- Live, named dev bundle, real microphone, wake word answering aloud:
  "Omi, list five major cities in India with one short fact each" dropped seven
  echo segments across both the microphone and system-audio channels, logged
  zero barge-ins where the previous build logged three, and spoke all five
  cities through to "Five, Chennai, a key center for automobiles, culture, and
  South Indian cinema" instead of stopping at the first.
- Speaking over a live answer still interrupts it and still dispatches:
  `WakeWord: submitting 'stop that and tell me the time instead.'` with
  `Transcription [BARGE-IN]` on the same segment.

Failure-Class: none

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

* fix(desktop): recognize a wake word spoken after something else, and stop deleting the user's speech

Three defects, all from one live session of twelve spoken attempts of which
only four fired.

The wake phrase had to open the segment. Windows now close on the speaker's
pause rather than a fixed boundary, so a segment is no longer one utterance and
whatever was said in the same breath shares it: `It's not working man. Omi what
time it is?` carried a literal wake phrase and a valid command and matched
nothing. The parser now also tries each sentence inside the segment. A sentence
boundary, not any position — the phrase has to *open* an utterance, which is
the same evidence class the punctuation-break rule already uses and keeps
`I told Omi to order food` from parsing to "to order food".

Echo suppression deleted something the user said. `Sorry my mistake it's
taking` was dropped as playback. Two causes: one shared deadline kept the whole
300-word history alive and refreshed it on every chunk, so several turns of
speech stayed matchable at once and a few hundred words of ordinary English
align with almost any short sentence; and discarding a segment did not require
the match to actually cover it. Words now expire individually after 15s — an
echo arrives a second or two behind the audio, so that is all it has to outlive
— and a whole-segment drop requires 0.8 coverage, which real echoes measured
0.80–1.00 against. The same eviction also explains a leak in the other
direction: Omi's own error copy, "Omi's AI service didn't respond...", was
heard back, parsed as a wake word, and submitted as a command, twice.

The wake word's own "assistant is speaking" guard is removed. It blocked a real
barge-in — `Omi you are not picking my messages now`, spoken while Omi was
talking, was refused and had to be repeated. Whether Omi is speaking is not the
question; whether *this segment* is Omi is, and `VoicePlaybackEchoPolicy`
answers that directly.

Verification:
- xcrun swift test --package-path Desktop --filter
  'WakeWord|VoicePlaybackEcho|LocalTranscription|VoiceBargeIn' -> 70 tests,
  0 failures
- Live, named dev bundle, real microphone, all four in one session:
  "It's not working, man. Omi, what is today's weather?" ->
  `WakeWord: submitting 'what is today's weather?'`;
  "Sorry my mistake it's taking" reached the transcript instead of being
  dropped; the spoken time answer was dropped as echo on both the microphone
  and system-audio channels; and "Omi's AI service didn't respond..." was
  dropped instead of commanding the assistant.

Failure-Class: none

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

* fix(desktop): anchor echo matching to the sentence, not to the ends of the history

Two failures from a twenty-utterance measurement run, both from the same
assumption: that an echo begins where the playback history begins.

Parakeet returned "Your current save task appears to be testing the protocol
product." twice in one segment, and the second copy survived as if the user had
said it — the backward walk started at the end of the history, and Omi had kept
talking past that sentence. Both walks now try every position where the
utterance's first word occurs and take the best alignment, so an echo of
something said in the middle of an answer is still recognised as one. That also
recovers a command spoken over playback: the user's words are isolated between
the matched runs instead of being dropped with them.

Speech-to-text mangles the tail of a long answer, so it stops matching what was
synthesised and was kept as the user's words: Omi's own "Based on today's
recording active for roughly about one hour" reached the transcript as
speech the user never said. A garbled continuation runs straight on from the
matched text; a person interrupting starts a new sentence, and the recognizer
marks that, so a surviving residue now has to begin one.

A single word matching on its own is coincidence, not the echo continuing —
"the" and "and" occur in every answer. Committing the match on one word let the
backward walk eat "the time" off the end of a user's command; two in a row is a
run.

Verification:
- xcrun swift test --package-path Desktop --filter
  'VoicePlaybackEchoPolicy|WakeWord|LocalTranscription|VoiceBargeIn'
  -> 74 tests, 0 failures. The four new cases are the captured strings above.
- Twenty spoken utterances through the real microphone across five voices, the
  same script and 16s pacing as the run before this change:
  10 of 20 dispatched, against 9 of 20; the two segments where Omi's own words
  had been kept as the user's are now correctly dropped (0 of 20, was 2 of 20);
  and two commands that the previous build lost inside a dropped echo window
  were recovered by residue extraction ("Your ten most recent memories. Only
  open my rewind time line." -> "Only open my rewind time line.").
  Every remaining miss is the recognizer writing something other than the wake
  phrase, five of them "Only".

Failure-Class: none

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

* fix(desktop): stop "ok"/"okay" corroborating a misheard wake phrase

Raised in review: a homophone needs a punctuation break to fire on its own, but
a greeting prefix waived that — and the greeting list included "ok" and "okay".
So "okay oh me and my friend went hiking" fired with the command "and my friend
went hiking", which is the exact false positive the punctuation rule exists to
prevent.

"hey" is a vocative: "hey <name>" addresses someone, and nobody produces it in
front of a misheard word by accident. "ok" and "okay" are discourse markers
people open sentences with constantly. Only "hey" corroborates a homophone now.
Both still corroborate the literal spelling, where the phrase is already the
evidence.

This only ever makes the wake word fire less.

Verification:
- xcrun swift test --package-path Desktop --filter WakeWord -> 33 tests,
  0 failures, including the reviewer's sentence in both "ok" and "okay" forms
  and the two forms that must still fire.

Failure-Class: none

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

* feat(desktop): route a wake word into the realtime session behind a flag

Maintainer request: try the realtime model instead of the text path, on the
grounds that it should be a more natural interaction. Off by default —
`wakeWordUsesRealtime` — so the measured text path is untouched and the two can
be compared on the same machine.

Detection does not move. Both paths read the same ambient transcript, so this
changes nothing about the 60% recognition ceiling documented earlier. What
moves is the exchange: the model speaks its own answer instead of TTS reading a
text reply, and the session keeps conversational context across turns.

Push-to-talk owns a physical hold, so it streams audio and commits on release.
A wake word owns no hold and its audio is long gone by the time the transcript
fires, so it mints an `.automation` turn — the shape the headless harness
already uses — and hands over the transcribed command.

Two ordering constraints, both found by running it:

- The Gemini activity window is opened by `beginInputTurn`, which runs inside
  `commitTurn()`, not at `beginTurn`. Waiting for the window before sending
  simply times out; the send has to happen first and be flushed by the commit.
  Before this was understood the text sat in the buffer and no answer came.
- A turn with no route is refused at commit as a stale physical commit
  ("rejected duplicate/stale physical commit before provider side effects"), so
  `.selectRoute(.hub)` has to be published before `beginTurn`.

Gemini also rejects a pure-text activity window with a 1007 precondition, so
two 100 ms silence frames open it, matching the harness.

Verification:
- xcrun swift test --package-path Desktop --filter
  'WakeWord|VoicePlaybackEcho|Realtime' -> 306 tests, 0 failures
- Live on a named dev bundle, real microphone, flag on:

    WakeWord: submitting 'tell me one interesting fact about the ocean.'
    RealtimeHub[gemini:gemini-3.1-flash-live-preview]: turn begin (activityStart)
    RealtimeHub[gemini:gemini-3.1-flash-live-preview]: wake word command sent (45 chars)
    Transcript [ADD] Speaker 0: The pressure at the bottom of the ocean is so intense...

  The last line is the microphone hearing Gemini speak its own answer. ~1.2s
  from end of speech to the command reaching the model. A second command 51s
  later ran the same path, so the turn terminalizes and does not wedge the
  trigger behind `activeTurnID`.

Known gap on this path: `VoicePlaybackEchoPolicy` does not cover it. The hub
plays its audio natively rather than through `FloatingBarVoicePlaybackService`,
so nothing records what was said and Gemini's spoken answer lands in the
transcript as the user — visible in the trace above. The same defect the echo
policy fixes for the TTS path, reappearing on this one. Left as a known gap
while the path is off by default and under evaluation.

Failure-Class: none

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

* fix(desktop): give the realtime wake-word turn a real user message and a silent echo

Two defects in the realtime path, both visible in the chat panel and both found
by watching it rather than by reading the code.

The assistant's own answer was recorded as the user. `VoicePlaybackEchoPolicy`
reads what this app has recently said out loud, and that history was only ever
written by `FloatingBarVoicePlaybackService`. The realtime session plays its
audio natively, so nothing recorded it, the microphone heard it, and ambient
capture attributed Gemini's reply to the user — the same defect the echo policy
exists to prevent, reappearing on a path it could not see. Text emitted by the
session is now recorded there too. It arrives as a stream and providers differ
on whether each event is the new fragment or the whole reply so far, so only
the part that extends what was already recorded is kept: a padded history
matches more of what a person says, which is the direction that deletes real
speech.

The user's message was whatever the provider imagined. A wake-word turn hands
over already-transcribed words and only enough silence to satisfy Gemini's
non-empty activity window, so the provider has no user speech to transcribe and
journals its own hallucination. Live, `¿Qué es el número de serie?` appeared as
the user's message on two consecutive turns; nobody said it. What was asked is
not in doubt, so it is supplied rather than recognised, reusing the existing
transcript-override policy through a production-scoped property that push-to-
talk clears alongside the test one.

Verification:
- xcrun swift test --package-path Desktop --filter
  'WakeWord|VoicePlaybackEcho|Realtime|LocalTranscription' -> 324 tests,
  0 failures
- Live on a named dev bundle, real microphone, realtime path on:

    WakeWord: submitting 'tell me one short fact about the moon.'
    RealtimeHub[gemini]: wake word command sent (38 chars)
    Transcription [ECHO]: dropped Omi's own playback heard back:
      The moon is slowly moving away from Earth by about an inch a...

  The echo line was a `Transcript [ADD] Speaker 0` before this change. On the
  following turn the chat panel showed "tell me one short fact about volcanoes."
  as the user's message where the previous turn still shows the Spanish
  sentence.

Known limit, not fixed here: the provider forms its own input transcript from
the silence regardless of what we journal, and Gemini Live keeps session
context, so a hallucinated transcript persists — after the Spanish turns the
model kept offering to reply in Spanish. Supplying the text fixes the record,
not the model's memory of the turn. The real remedy is a text turn that opens
no audio activity at all (`clientContent` rather than `realtimeInput`), which
is a wire-format change and out of scope while this path is off by default.

Failure-Class: none

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

* fix(desktop): warm the realtime session before a wake-word turn

The warm session tears itself down after an idle period, so a wake word
arriving in a quiet stretch found nothing to talk to and fell through to the
chat path. Observed live as the third of three consecutive commands answering
in a text box while the first two spoke aloud.

Warming and waiting briefly before minting the turn also avoids creating a turn
that cannot be used, which would otherwise leave `activeTurnID` set and make
`defaultIsConversationActive` refuse every later wake word.

Verification:
- xcrun swift test --package-path Desktop --filter
  'WakeWord|VoicePlaybackEcho|Realtime|LocalTranscription' -> 324 tests,
  0 failures
- Live on a named dev bundle, real microphone: three consecutive commands
  ("how are you today", "tell me one fact about rivers", "name one famous
  painter") each reached `wake word command sent` with no fallback, where the
  previous build dropped the third to the chat path.

Failure-Class: none

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

* feat(desktop): answer a wake word from the notch instead of opening a panel

Hands and eyes are elsewhere — that is the premise of a wake word — so growing
the bar into a response panel covered a fifth of the screen for no one's
benefit. The response glow already signals that Omi is working and the answer
is spoken, so the exchange is recorded without being put in front of the user.
The panel remains the fallback when the hands-free path cannot run.

Two things made this harder than it looks, both found by instrumenting rather
than reading:

The panel is opened from four places — the query starting, the answer arriving,
the content-height observer, and the agent-chat resize. Suppressing any one of
them left it showing, because whichever was missed put it straight back. The
guard is now at `resizeAnchored`, the single point they all reach, and blocks
only expansion so collapsing back to the pill still works.

`prepareVisibleQueryState` runs twice for one query: once from `routeQuery` to
show the thinking state, once from `sendAIQuery`. A one-shot latch consumed by
the first call meant the second reset the flag and reopened the panel —
`presentsSurface=false` immediately followed by `presentsSurface=true` in the
same millisecond. It may now only ever set quiet; the entry points that do want
a panel (typed follow-ups, `submitSpokenCommand`) clear it.

Verification:
- xcrun swift test --package-path Desktop --filter
  'WakeWord|VoicePlaybackEcho|FloatingControlBarState|Realtime' -> 335 tests,
  0 failures
- Live on a named dev bundle, real microphone, two consecutive commands:
  the bar stays at 62px throughout (`resizeToFrame to (351.0, 62.0)`), no
  `430x381` expansion, and both answers were spoken — the microphone
  transcribed Omi saying "The capital of Portugal is Lisbon." and "The sun
  contains about 99.86% of the total mass in our solar system."
  The previous build logged `resizeToFrame to (430.0, 381.0)` on every command.

Failure-Class: none

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

* test(desktop): repin the beginVisibleMainQuery contract to its wrapped signature

ccaaebb7 added `presentsSurface: Bool = true`, which pushed the parameter list
onto its own line under swift-format. The contract test pinned the declaration
as one string:

    func beginVisibleMainQuery(_ message: String, fromVoice: Bool, animated: Bool = true)

so it stopped matching and took both required Desktop Swift checks red. The
production behavior was never affected -- the view's call site still passes
defaults.

Pinned in two parts so a wrap cannot break it again, and `presentsSurface:
Bool = true` is now pinned with the rest: that default is what keeps a typed
send presenting the panel, which is the load-bearing behavior of this surface.

Checked the pin still guards rather than passing vacuously -- flipping the
expected default to false fails the assertion at line 1088; restoring it
passes. AgentPillLifecycleTests 84/84.

Failure-Class: none

* feat(desktop): recognize the wake word on the default on-device path

The wake word is only as good as the recognizer that hears it, and on the
default path the recognizer cannot be told its own name. Ambient transcription
runs on-device on Apple Silicon, and `AsrManager.transcribe(_:decoderState:
language:)` takes a language hint and nothing else — no keyword or vocabulary
parameter. The cloud lane does not have that problem: `/v4/listen` prepends
"Omi" to the STT keyword vocabulary server-side in
`backend/utils/listen_session_bootstrap.py`.

Measured on one machine, same script and voices, only the lane changed: the
phrase was usable in 12 of 20 utterances on-device against 19 of 20 on the
cloud lane. Seven of the eight on-device misses came back as "Only".

Two changes, both aimed at that gap.

`WakeWordSegmentParser` gains a third corroboration class. "Only" cannot ride
the existing punctuation-break rule: a scan of 1,919 stored local segments
found 15 sentence-initial "Only", every one a misrendered wake word, and not
one carried a break after it — they read "Only what is on my calendar", "Only
open my rewind timeline". The same scan found 8 ordinary uses of "only", all
mid-sentence. So `.commandHead` gates on what follows instead: an interrogative,
or a request verb aimed at the speaker's own things ("show me", "open my",
"remind me"). Every imperative reads fine under a restriction — "only do that
once", "only tell him if he asks" — but none of them ask for the speaker's own
calendar.

`AssistantSettings.wakeWordPrefersCloudSTT` is the opt-in for users who would
rather buy the remaining accuracy with cloud transcription. Off by default: it
trades on-device transcription for cloud transcription while the wake word is
enabled, which is a privacy and cost decision, not a technical one. FluidAudio
does ship term biasing, but only on `SlidingWindowAsrManager`, which is a
different streaming architecture and pulls a second set of CTC models — that is
the upgrade path out of this flag.

Verified on the running app through the hermetic capture seam, which reaches
`WakeWordService.observe` on the real path: 14 ordinary uses of "only" injected,
zero fired; 3 verbatim misrenderings injected, 3 parsed. The cloud opt-in was
confirmed live by the lane actually switching — `TranscriptionService:
Connecting to wss://api.omiapi.com/v4/listen` in place of on-device Parakeet.

Tests: 26 in WakeWordSegmentParserTests, 14 in STTSessionStateTests, and the
full 716-suite run, all passing.

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

* fix(desktop): stop a re-delivered segment from interrupting the answer to it

A backend segment is re-delivered as it grows, in place and under one id, and the
re-delivery arrives whether or not the speaker added anything. `VoiceBargeInPolicy`
treated any non-empty user text as speech, so an unchanged re-delivery counted as
the user talking over the assistant.

Observed live: the second turn of a conversation was cut off 4.4s into playback by a
re-delivery of the very segment that asked the question, byte-identical to the copy
already stored.

    13:16:41.117  Chat response complete
    13:16:45.491  BARGE-IN: User spoke mid-playback; interrupting voice output
    13:16:45.501  Transcript [UPDATE] Speaker 0: I'm fine. What about you? Omi, I'm fine. What about you?

The first turn escaped only by timing — its answer finished speaking before the
re-delivery landed. From the second turn on, the re-delivery falls inside the playback
window every time, which is why it reads as "the second question always gets cut off".

`shouldInterrupt` now takes the text already stored for that segment id and interrupts
only on what the segment gained. Growth that adds nothing but punctuation or spacing is
the recognizer tidying up, not speech. A segment that no longer extends what was stored
counts as new in full: there is no way to tell a revision from a continuation, and
missing a real barge-in is the worse failure.

Failure-Class: none

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

* fix(desktop): count a garbled word inside an echo as part of it

Omi's own answer was reaching the transcript as a second speaker, so the reply was
heard once from the speakers and again as if a person had said it.

`walk` only commits a matched word once two match in a row — a guard that exists
because a single common word ("the", "and") matching by coincidence once let the
backward walk eat "the time" off the end of a user's command. But an utterance's
closing word can never reach two-in-a-row when the word before it was garbled, so
the last word of a short answer was permanently uncountable.

Measured live: Omi said "I don't know the details of Wake Word yet." and the
microphone returned "WakeMore" for the product name. The trailing "yet" followed
that one mismatch and could not commit, so coverage came out 6 of 8 = 0.75, under
the 0.80 floor, and the segment was kept.

    19:37:59.241  Transcript [ADD] Speaker 1: I don't know the details of WakeMore yet.
    19:38:00.576  ECHO: dropped ... I don't know the details of WakeMore yet. Feature you design

Confirmed against the real strings before and after: `keep` became `drop` for every
rendering of what was actually spoken.

The final token may now commit on a single match, but only after `minimumWordCount`
words have already matched in a run, so a lone coincidental word still cannot start
or extend an echo. Forward walk only: the reversed walk measures the playback that
follows a barge-in, where the "final" token is the first word the user said, and
committing it on one match would eat the start of the interruption.

Failure-Class: none

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

* chore(desktop): drop the changelog fragment that already shipped

`20260823-local-transcription-pause-endpointing.json` is byte-identical to the entry
released in v0.12.221, which shipped through #12181 when pause endpointing was split
off this branch. Leaving it here would re-announce an already-released change at the
next consolidation.

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

* fix(desktop): stop an abandoned hands-free command from quieting the next query

`suppressNextVisibleSurface` is a one-shot latch consumed only by
`prepareVisibleQueryState`. Three exits from `openAIInputWithQuery` return before
reaching it — no window, no active provider, and the `.voiceOnly` branch, which
renders nothing and so never consumes it at all. A wake word that fires while the
bar is torn down or unprovisioned therefore leaves the latch set, and the next
typed question is silently answered in the notch.

Clear the latch on every exit that abandons the query.

Separately, `beginVisibleMainQuery` only ever *sets* `answersQuietly` (clearing
there would let the second `prepareVisibleQueryState` call undo the first), so the
reset has to live at the query entry points. The closure re-wired in
`openAIInputWithQuery` does it; the default wiring installed at setup did not, so a
quiet wake-word answer leaked its silence into the next typed question on that path.

Verification: `swift build` in `desktop/macos/Desktop` — clean. No behavioral test
added: both paths run through `FloatingControlBarWindow` (an NSPanel) with no
injectable seam, and the existing coverage here is source-scrape pins, which
AGENTS.md calls a static tripwire rather than behavioral coverage.

Failure-Class: none

* test(desktop): re-pin the quiet-answer latch after the typed-send rewrite

My merge resolution took main's side of `AgentPillLifecycleTests.swift` wholesale.
That was right for the file — main retired `AskAIInputView` and the test source-pinned
against it — but it silently removed the only guard this feature has. Nothing in the
678 test files on that head pinned `presentsSurface`, `answersQuietly`, or
`suppressNextVisibleSurface` any more, so the wake word's notch behavior could be
refactored away without failing anything.

The replacement pins the same contract against `FloatingControlBarWindow.swift`, where
the logic actually lives, rather than a view that has now been retired twice:

- `presentsSurface` defaults true, so an ordinary typed send presents the panel
- `beginVisibleMainQuery` only ever sets quiet, never clears (it runs twice per query)
- the one-shot latch is armed by the wake word and consumed by the visible path
- all three abandoning exits clear it, asserted by count
- both `onSendQuery` wirings reset `answersQuietly`

Verification: passes on this head. Mutation-checked rather than assumed — deleting the
`.voiceOnly` latch clear fails it with `("2") is not equal to ("3")`, and restoring it
returns green.

Failure-Class: none

* docs(desktop): name the real path that opens the Gemini activity window

Review on #11801 caught the comment in runWakeWordTurn still pointing at
`beginInputTurn` as the thing `commitTurn()` calls. Main's voice-handoff rework
moved that: `commitTurn()` now reaches the window through
`commitClaimedHubInput` -> `beginLiveInputTurn`, the controller wrapper, which
then calls the session's `beginInputTurn`.

The old wording was not wrong about which primitive opens the window, but a
reader following it into `commitClaimedHubInput` would not find the name it
gave. Both names are now in the comment, in the order the calls actually happen,
so neither reads as stale next time the wrapper is renamed.

Comment only; no behavior change. 339 tests, 0 failures across the WakeWord,
RealtimeHub, VoicePlaybackEcho and Interject suites.

* fix(desktop): end a quiet wake-word answer's latch with the answer, not never

The wake word's quiet answer matched PTT's notch geometry while it ran — the
same 386x62 glow island, the same spoken delivery, the same idle settle — but
the state it left behind did not. Two leaks, both measured live on a named
bundle (omi-wwnotch-11801, head b82eff7157):

1. The answer's own presentation sites — the sendAIQuery streaming sink and
   the completion tail — called present(.mainResponse) while the quiet latch
   blocked only the resize. The bar settled with showingAIConversation=true
   against a 362x62 island: the hover menu was dead
   (NotchHoverSurfacePolicy.allowsMenu), notification cards stopped mounting
   (the view gates them on !showingAIConversation), and #13337's surface floor
   deferred as conversationOpen indefinitely. PTT never leaves this state.

2. answersQuietly outlived its query. Nothing cleared it after the answer
   completed — the typed-send resets the PR pinned are automation-only now —
   so the next agent chat opened through the pills-observer fallback
   (430x148, resizable=false) instead of its own surface (430x400,
   resizable=true; the clean-state counterfactual on the same bundle).

The fix keeps the latch per-query at the same choke points the PR already
used: the quiet answer's two presentation sites now skip presenting entirely
(like their adjacent resize guards), and present(_:) — the single authority
for opening a surface — clears quiet, so an agent chat, a tapped
notification, or a restored conversation can never inherit a dead answer's
silence. The latch cannot clear mid-answer: the quiet path presents nothing.

Verification:
- desktop/macos/Desktop: xcrun swift build -c debug — clean.
- xcrun swift test --filter FloatingControlBarStateTests|AgentPillLifecycleTests
  — 114 tests, 0 failures (incl. the new behavioral
  testPresentingAnOpenSurfaceEndsAQuietAnswer and the extended latch tripwire).
- xcrun swift test --filter WakeWord|VoicePlaybackEcho|VoiceBargeIn|
  STTSessionState|LocalTranscription — pass; FloatingBarSurfaceFloorTests|
  VoiceTurnCoordinatorTests|PushToTalk — 94 tests, 0 failures.
- ./scripts/agent-logic-harness.sh --swift-only — passed (158.7s).
- swiftlint 0 violations; pinned swift-format adds 0 new findings (175
  pre-existing on the synced head, unchanged); check_desktop_test_quality.py
  at baseline.
- Live, named bundle omi-wwnotch-11801 (worktree
  pr-11801-sync-20260910): wake word via the capture seam answered quietly —
  submit glow 386x62 at 17:30:46, settle 362x62 with showingAIConversation
  false and surfaceFloorSatisfied true — then open_seeded_subagent produced
  resizeToFrame to (430.0, 400.0) resizable=true (pre-fix: 430x148
  resizable=false). A second wake word stayed quiet, and a PTT turn
  (ptt_manager_turn) kept its 474x62 → 386x62 → settle lifecycle with
  conv=false.

* docs(desktop): say the parser recovers an "Only" misrendering

The resolveMode doc comment and its test's doc comment both said the
on-device "Only" misrendering "cannot be accepted as a rendering". The
same commit that wrote that (21f1e50ff2) also added
WakeWordSegmentParser.commandShapedRenderings, which does accept "Only"
when a command follows it (an interrogative, or a request verb aimed at
me/my), pinned by the "Only" cases in WakeWordSegmentParserTests.

Both comments now describe what the parser does, and say the 12 of 20
on-device measurement was taken before that recovery existed.

Comment-only change, no behavior change.

Verification:
- desktop/macos/scripts/swift-format-wrapper.sh lint on both files:
  exit 0, no findings.

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

* fix(desktop): stop Omi's own first words from cutting off its answer

Live, on-device lane, noisy room: "Omi, tell me a fun fact" was answered
"Fun fact: A day on Venus is longer than a year on Venus—it rotates so
slowly…", and playback stopped after the first sentence. The microphone
window closed on the answer's first two words, and `Fun fact.` reached
barge-in as the user speaking:

  14:43:13.369 Transcription [BARGE-IN]: User spoke mid-playback;
               interrupting voice output
  14:43:13.375 Transcript [ADD] Speaker 0 [200.0s-210.0s]: Fun fact.

VoicePlaybackEchoPolicy.classify will not attribute fewer than four words
to playback, because deleting a short utterance from the transcript risks
deleting the user. Barge-in carries the opposite risk, so it now also asks
whether an utterance under that floor is an exact, contiguous run of what
playback said in the last few seconds. Transcript handling is unchanged.
A short interruption that is not a run of the answer ("Stop.", "Wait,
what?"), or answer words out of order, still interrupts.

Verification:
- Xcode 26.6 (17F113): VoiceBargeInPolicyTests (16, six new from the live
  strings), VoicePlaybackEchoPolicyTests (23), WakeWordServiceTests (12):
  51 tests, 0 failures.
- Mutation: with the new check replaced by `return true`, exactly the two
  live-case tests fail (VoiceBargeInPolicyTests.swift:121, :127).
- Live, named bundle, capture_test_transcript seam, real playback:
  before the fix, injecting the answer's first two words during playback
  interrupted it 3 of 3. After the fix, injected once playback had
  started speaking: no interruption 3 of 3, and a "Stop." injected right
  after interrupted 3 of 3. Same result on an instrumented build that
  logged spokenWords=15/21/28 at each check.
- swift-format lint clean; check_desktop_test_quality.py at baseline.

Failure-Class: none

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

* fix(desktop): hear "Oh me", "Owe me" and "How me" said without a pause

Live, on-device lane, real voice: 3 of 6 spoken commands were dropped
without a trace. The recognizer wrote the wake word as

  Oh me what time it is.
  Owe me what time it is.
  How me what day is it today?

"oh me" only counted with a punctuation break after it, and "owe me" and
"how me" were not accepted at all.

The stored local segments show this is the common case, not a one-off:
of 1,961 unique segments, 29 distinct sentences open with "oh me",
"o me", "owe me" or "how me", every one of them the user addressing Omi,
none of them ordinary speech. 15 have no break after the phrase, so all
15 were dropped.

These renderings now join "only" in commandShapedRenderings: said
without a pause, they count when what follows opens like a command (a
question, or a request aimed at the speaker's own things). 14 of the 15
pass. The one that does not is "O me order Thai food for Maya.", because
"order" is not a self-addressed request. "oh me" and "o me" are still
homophones, so with a comma they need no command shape, as before.
"oh my" stays out: the same scan found it once, as "Oh my god."

Verification:
- Xcode 26.6 (17F113): WakeWordSegmentParserTests (28, two new from the
  live strings), WakeWordServiceTests (12): 40 tests, 0 failures.
- Mutation: without the four new renderings, only the live-miss test
  fails (7 of 7 strings). With the command-head check switched off, the
  new ordinary-speech test fails along with four existing ones.
- Live, named bundle built with this commit and the next (which only
  adds a log line), capture test seam (speaker 0, the path live speech
  takes): "Owe me what time it is.", "How me what day is it today?",
  "Oh me what time it is." and "O me who am I?" each fired and were
  answered correctly, 5.5-8.9 s after the command. "O me order Thai food
  for Maya.", "How me and my brother met is a long story." and "Owe me a
  favor and we're even." did not fire and never reached the chat.
- swift-format lint clean; check_desktop_test_quality.py at baseline.

Failure-Class: none

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

* fix(desktop): log a wake word the parser turned down

A sentence that opened with a rendering of the wake phrase but carried
no accepted command left no trace, so a missed "Omi" looked exactly like
one that was never said. Finding the misses fixed in the previous commit
took a scan of the stored transcripts; the app log had nothing.

WakeWordService now logs the rendering, and only the rendering, never
the words after it:

  WakeWord: ignored — 'o me' opened a sentence, but no command followed it

The rejections that were already logged (disabled, busy, not the user,
dedup, too short, cooldown) are unchanged.

Verification:
- Xcode 26.6 (17F113): WakeWordSegmentParserTests (30, two new),
  WakeWordServiceTests (12): 42 tests, 0 failures.
- Mutation: with openingRendering never naming anything, only its test
  fails (2 assertions).
- Live, named bundle, capture test seam: "O me order Thai food for
  Maya.", "How me and my brother met is a long story." and "Owe me a
  favor and we're even." each logged the line above with 'o me',
  'how me' and 'owe me', and did not fire.
- swift-format lint clean; check_desktop_test_quality.py at baseline.

Failure-Class: none

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

* chore(desktop): fold the wake word's changelog entries into what ships

The branch carried seven entries for one unreleased feature. Five of
them described states nobody outside this PR ever saw: answers that
opened a panel before they moved to the notch, a realtime path behind a
setting with no UI, and a fix for a notch bug that only existed on this
branch. The release notes would have listed the feature and then
corrections to it.

Two entries remain: the wake word as it ships, and the echo fix, which
also changes push-to-talk answers heard during ambient listening.

Verification: desktop-changelog.py validate OK; check-desktop-changelog.py
finds the fragment.

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

* test(desktop): inject wake-word settings instead of mutating shared defaults

main's desktop-test-quality ratchet caps direct UserDefaults.standard mutations
in tests at 323 -- #13260 showed suites racing on shared auth domains -- and
WakeWordServiceTests added ten, all in setUp/tearDown plus one in the disabled
test. That blocked the push at 333.

The test wrote to .standard only because WakeWordService read its settings
through AssistantSettings.shared, which reads .standard directly. The service
already injects `now` and `onTrigger` as closures, so its three settings now
follow the same pattern: isEnabled, wakePhrase and cooldown, each defaulting to
the same AssistantSettings.shared property read at call time. Production
behaviour is identical. The test injects plain values and touches no defaults.

Not an integration-boundary waiver: this suite exercises parsing, triggering
and cooldown, not the defaults integration, so the annotation would have been
the wrong escape hatch.

Verified: desktop-test-quality back to the 323 baseline with zero sites in this
suite; swift build clean; WakeWordServiceTests 12 passed. Mutation-checked --
making the service ignore the injected isEnabled fails the disabled-setting
test, so the injection is what the suite actually exercises.

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

* fix(desktop): close wake-word review gaps

* fix(desktop): hand a wake word command back when the realtime commit is not accepted

runWakeWordTurn waited only for a session object, and discarded commitTurn's
result before returning true. A reconnecting or replaced transport keeps the
session but defers the commit, replaying buffered audio only, so the command
text was lost while WakeWordService believed it was handed off and skipped
the chat fallback.

- Wait for a usable transport with waitUntilActive, not just a session.
- Treat the command as handed off only when the commit is accepted or
  already owned; otherwise cancel the turn and return false so the caller
  answers on the chat path.

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

* chore(api): regenerate client method totals after concurrent merges

#20003, #19815 and #15669 each regenerated the clients against their own
base and merged cleanly, leaving main's "Total: 478 client methods" header
one short of the 479 the spec now generates. The knowledge-ledger client
schema contract compares the checked-in artifacts and failed on every branch
that merged main. Regenerated; only the five total lines change.

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

* docs(desktop): track wake word UI evidence in the repository layout

Main now requires UI screenshots for changed UI source under
.agent-artifacts/ui-evidence/<pr>/ with an evidence.json manifest. Copy the
existing before/after screenshots from the docs-assets branch unchanged.

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

* fix(desktop): keep wake word commands with the account that spoke them

The realtime path waits up to five seconds for its transport, then sends the
command or falls back to chat. An account switch in that window could send
account A's command as account B. Capture the runtime-owner authorization
when the wake word fires and re-check it after the warm-up, before the
command is sent to the realtime session, and before the chat fallback.

Failure-Class: none

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

* fix(desktop): carry the wake word's account through the chat route

The default (non-realtime) wake-word route went through the floating bar's chat
path, which can queue a command behind an in-flight reply and dispatch it later
with no account check. Pass the authorization snapshot captured when the wake
word fires through submitHandsFreeCommand/submitSpokenCommand, sendFollowUpQuery,
openAIInputWithQuery, routeQuery and the pending follow-up queue, and re-check
it at each send (dispatchChatQuery and the direct sendAIQuery hop). Other
callers pass no snapshot and are unchanged.

Failure-Class: none

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

* fix(desktop): scope wake-word requests through the bar's queue and latch

- HandsFreeRequest carries the speaking account and a request id through the
  chat route in place of a bare snapshot.
- The pending follow-up becomes RequestBoundSlot: a queued hands-free query is
  handed out at most once, and only while its account is still current
  (including after a same-account sign-out and sign-in).
- The global "next query is quiet" flag becomes QuietSurfaceLatch, armed and
  consumed per request. A request rejected before presenting releases only its
  own arm, so it can no longer hide the next typed answer, and an older request
  can never clear a newer one's.
- After the awaited realtime send, WakeWordSendOutcome re-checks the account
  and the turn: a stale completion neither commits nor cancels a replacement.

Failure-Class: none

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

* test(desktop): re-pin the quiet-answer latch to the request-scoped QuietSurfaceLatch

---------

Co-authored-by: Claude Opus 5 <[email protected]>
Co-authored-by: David Zhang <[email protected]>
Co-authored-by: David Zhang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend Task (python) positive-signal Automation verified a genuine fix/quality contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Configurable Daily Recap Depth (Brief/Normal/Deep Reflection)

3 participants