Repository navigation
Recognize Hey Omi task commands at conversation finalization - #11980
Conversation
Add evidence-backed end-of-conversation wake-word marking, prompt guidance, direct-mention provenance, a privacy-preserving transcript scanner, and paired evaluation fixtures. Verification: backend test preflight passed; backend unit suite passed 890/891 files before a new isolated-import dependency was added, then the failed file and all affected files passed (160 tests); async blocker scan passed; hermetic task-intelligence fixture runner passed; live paired LLM evaluation NOT_RUN because no configured credentials were available.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
Live paired evaluation: RUN — and it does not support the PR's central claimThe blocker is cleared: the eval ran against the real extractor ( Results
Per case, marked vs. unmarked:
ReadingSafety is demonstrated. Ordinary extraction is untouched (3/3), quoted phrases stay non-actionable (3/3), provenance is complete wherever items were produced (9/9). The regression risk this design was built to avoid does not materialise. Benefit is not. In 11 of 12 paired trials the marker changed nothing, because the unmarked baseline already assigned Why: the fixtures don't reproduce the failure modeThe eval feeds clean synthetic text (
RecommendationKeep this draft. The measurement gate did its job — it caught that the headline mechanism is close to a no-op on the cases as written. Before merge, re-target the eval at:
If those show a real delta, the PR is justified on evidence. If they don't, the honest conclusion may be that the discard fix should ship alone and the marking machinery is unnecessary. |
Adds a paired discard evaluation calling the production should_discard_conversation unmarked vs marked, with a required negative control, plus five extractor cases matching real locket speech (unpunctuated, glued tokens, single-segment, mid-utterance). Co-Authored-By: Claude Opus 5 <[email protected]>
Re-targeted evaluation: the discard hypothesis is falsified, and marking introduces a false positiveEval re-targeted per review and re-run live ( 1. Discard gate —
|
| case | unmarked discarded | marked kept | changed |
|---|---|---|---|
bare_short_command_whole_conversation |
false ×3 | true ×3 | 0/3 |
mis_transcribed_omie_short_command |
false ×3 | true ×3 | 0/3 |
non_actionable_wake_word_negative_control |
true ×3 | false ×3 | 0/3 |
The premise was wrong. Short "hey omi" commands are not being discarded in the first place — the unmarked arm keeps them 3/3. The discard-gate change rescues nothing.
This is a trustworthy zero, not a broken harness:
- Fixtures are 8–13 words, far under the
word_count > 100short-circuit inshould_discard_conversation, so the LLM was genuinely invoked rather than skipped. - The negative control is discarded in both arms (3/3), proving the gate is live and that marking does not disable it wholesale.
2. Extractor — capture_kind_changed: 5 / 27 (was 1/12)
One case is a genuine, deterministic win:
| case | changed | unmarked baseline |
|---|---|---|
mid_utterance_omni_command |
3/3 | direct_request ×3 — consistently wrong without the marker |
heyomi_glued_command |
1/3 | flaky baseline |
multilingual_context_with_english_invocation |
1/3 | flaky baseline |
omilockets_glued_command, single_segment_entire_command, unpunctuated_lowercase_omie_command, omni_command_with_following_payload, ordinary_extraction_survives_marked_conversation |
0/3 each | already explicit_command |
mid_utterance_omni_command ("okay before i go hey omni remind me to send sarah the budget friday") is real: wrong 3/3 unmarked, right 3/3 marked.
3. New finding — the marker caused a false positive
quoted_phrase_remains_non_actionable, transcript:
The documentation should show the phrase Hey Omi as an example.
- unmarked: correctly extracts nothing, 3/3.
- marked, trial 2: produced
capture_kind=explicit_command, description "Add “Hey Omi” as an example in the documentation".
That is an unambiguous non-command promoted to explicit_command, which routes to create_direct — bypassing MINIMUM_CAPTURE_CONFIDENCE and creating a task with no review step. marked_expected_kind fell to 26/27 solely because of this trial.
The failure mode fires precisely when people discuss the phrase "hey omi" — i.e. during exactly the conversations this team has about this feature.
Recommendation: do not merge as-is
Measured net: one narrow reproducible win (mid-utterance) against a demonstrated capacity to fabricate create_direct tasks from discussion of the phrase, and zero benefit from the discard change that motivated the design.
Options, in the order I'd rank them:
- Park the marking machinery. ~1400 lines are not earned by one case.
- Fix the false positive first — the marked-arm prompt rule about quoted mentions demonstrably does not hold — then re-run and re-decide.
- Merge on safety grounds. Not advised: safety here means "usually harmless", and the one measured harm writes directly to the user's task list.
The evaluation harness itself is worth keeping regardless of the outcome — it is what caught both of these.
…conversations Adds a trigger-gated adjudication call wired as a conjunction gate on create_direct, drops the direct_mention overload, and rebuilds the live evaluation around 20-60 segment multi-speaker conversations scored on end-to-end policy outcomes across three arms. Co-Authored-By: Claude Opus 5 <[email protected]>
Replace the fixture runner's private capture import and duplicate gate view with a supported database-free production seam. Repair ambient-interference measurement by pairing shared samples and comparing independent arms across trial distributions. Verified: backend pyright (0 errors); 94 focused wake-word/capture tests; 41 conversation processing tests; fixture runner passes without ENCRYPTION_SECRET; make preflight passes all 24 selected checks.
…idate review (#12014) ## Problem A user reported action items appearing inside conversations but never on the Tasks page. Their account (uid redacted) had 3 conversations from Aug 20 with 6 extracted action items, **0** rows in `action_items`, and **0** documents in `candidates` — the items existed only on the conversation documents. Since `5724a10084` ("feat: converge universal memory and task authority", Aug 11) `capture_enabled()` returns `bool(uid)`, so every conversation's action items route through the Candidate lifecycle. That exposed two defects fleet-wide. ### 1. Negative segment offsets abort the whole save, silently Segment offsets are relative to conversation start, and audio-merge arithmetic lands them below zero — `-1.8e-07` routinely, `-17.33s` when a synced file predates the conversation. `EvidenceRef` pins `start_seconds`/`end_seconds` to `ge=0`, so building evidence raised `ValidationError`. That call is the *first* statement of `_save_action_items`, so the compatibility writer below it never ran either: the conversation produced no task at all. Nothing reads the `postprocess_executor` Future, so the traceback was discarded — no log line, no metric, no error. Replaying the reporter's three conversations through the adapter reproduces it on every one: ``` ValidationError: 1 validation error for EvidenceRef start_seconds Input should be greater than or equal to 0 [input_value=-17.329691410064697] at conversation_capture.py:92 in _capture_decision ``` ### 2. A `pending_candidate` create is invisible to every client except macOS Items at policy tier `pending_candidate` (a `direct_request` or a lower-confidence `clear_commitment`) are written to `candidates/` and wait for review. A task row only exists once a Candidate is accepted. The only client that reads the Candidate review surface is the macOS app (`/v1/staged-tasks`, `/v1/candidates?surface=suggested`); the Flutter app only calls `GET /v1/action-items`. On mobile, "pending review" means "discarded, forever". ### Blast radius Read-only audit of 44 recently active users over 3 days — 234 conversations with extracted action items (302 items): | outcome | conversations | items | |---|---|---| | reached Tasks (compatibility writer) | 126 | 264 visible | | reached Tasks (Candidate accepted) | 58 | | | **wrote nothing (defect 1)** | **25** | **30 lost** | | **pending-only (defect 2)** | **25** | **34 hidden** | 21% of conversations with action items produced tasks the user could never see. ## Change - `_evidence_seconds` clamps evidence offsets to zero. Evidence offsets are absolute positions in the recording, so a marginally negative merge artifact is a floor, not a validation error. - Conversation-surface `create` proposals resolve on capture instead of parking. Mutations of an existing task (`update`/`complete`) still require explicit review, so nothing silently edits or completes a task the user already has. - `_save_action_items` falls back to the compatibility writer when the capture adapter raises, and records the fallback (`record_fallback`) instead of dropping the conversation's tasks. - `prepare_wake_word_capture_gate` (#11980, landed while this was open) is fenced the same way. It runs an LLM adjudication ahead of the compatibility writer, so a provider error there drops the conversation's tasks by exactly the mechanism this PR exists to remove; on failure capture proceeds ungated, which is the no-wake-word-detected path. The call stays above the empty-extraction return so its `task_command_without_extraction` metric still fires. - `submit_with_context` logs background-task exceptions. Callers overwhelmingly discard the Future; that is why this class of failure ran for ten days without a single log line. ## Product invariants - `INV-MEM-4` — canonical promotion remains the sole Long-term authority. This change does not alter promotion or memory admission; it only decides whether a task Candidate waits for a review surface the client does not have. ## Verification ``` python -m pytest tests/unit/test_backend_candidate_capture.py -q # rebased onto main 37 passed, 8 warnings in 2.25s ``` New regressions, all of which fail on `main`: - `test_capture_survives_negative_segment_offsets` — the reporter's real offsets (`-17.329691410064697`, `-1.8e-07`) produce evidence clamped to `0.0` instead of raising. - `test_pending_tier_create_is_accepted_so_the_task_is_visible` — asserts the tier is still `pending_candidate` and that capture accepts it anyway. - `test_task_mutation_still_waits_for_review` — an `update` targeting an existing task creates a Candidate and is *not* accepted. - `test_capture_exception_falls_back_to_the_compatibility_writer` — a raising adapter still writes the action item rows and emits the fallback event. Two existing tests were updated, both harness-only: - `test_conversation_capture_resolves_every_create_without_notifications` (renamed from `test_read_mode_creates_pending_and_silently_accepts_commitment_without_notifications`) asserts the new contract — this behavior change *is* the fix, justified by the production evidence above, not by a rewritten expectation. - `test_repeated_descriptions_use_semantic_occurrences_without_order_dependent_candidate_keys` now stubs `accept_candidate`; it stubbed only `create_candidate` and reached real Firestore once creates began accepting. Its assertions are unchanged. ## Not in this PR Recovery of already-affected accounts is forward-only here. Two backfills are needed and are prod writes, tracked separately: reprocessing conversations that wrote nothing, and accepting pending conversation-surface `create` Candidates for clients with no review surface. Line-Count-Exception: backend/utils/conversations/process_conversation.py | 2375 -> 2403 | both fences must wrap their calls in place; moving the task writer out of its coordinator mid-incident would be a larger change than the fix Failure-Class: FC-derived-state-gate-without-legacy-source-path
Conflicts were in conversation capture (#12014 auto-accept + writer fallback vs INV-TASK-2 propose-only), the candidate-capture tests, and ConversationDetailView (#12042 summary sections vs Add to Tasks). Keep INV-TASK-2: extraction never accepts or writes a task. Keep #12014's evidence clamp and #11980's wake-word gate. Keep both summary sections and the suggestion-only action-item rows. Wake-word fixture scoring now treats policy_capture_kind == explicit_command as the command-admitted signal (create_direct is gone). Co-authored-by: David Zhang <[email protected]>
What changed and why
This replaces the first wake-word capture design with Fable's reviewed conjunction gate while retaining the deterministic matcher, structural marker, extraction guidance, and discard-prompt insurance.
explicit_commandreachescreate_directonly when extraction and adjudication agree on a matched invocation. A rejecting verdict demotes an extracted explicit command todirect_request; an unambiguoustask_commandverdict may promote a non-explicit extracted item.capture_confidence, and never affects items without wake-word provenance.direct_mentionwake-word overload is removed. Wake-word invocation and public-broadcast addressing retain separate semantics.The discard prompt rule remains intentionally. The base discard prompt explicitly targets short assistant-like utterances, so current model behavior is not treated as a stable guarantee.
Decision required: adjudicator is unvalidated
The rebuilt evaluation used six realistic 20-60 segment, multi-speaker conversations, three arms, and three trials per case. It scored end-to-end
run_capture_policyoutcomes.create_directon real commands (n=18)create_directon non-commands (n=27)Stage two ran 15 times. The marker alone moved command capture from 77.8% to 100% with no measured precision cost. The adjudicator changed zero policy outcomes: its false-
create_directrate did not improve over marker-only, so the harness recommendation isdrop_adjudicator.The verdicts themselves were accurate on the hard cases: the bystander was
not_addressed_to_omi; product discussion and quoted examples werequoted_or_meta; the demo wasnot_addressed_to_omi; the product question wasquestion; and the paired quote/command was split correctly. That classification quality did not establish incremental end-to-end value. The adjudicator is therefore unvalidated by this evaluation, not credited with the marker-only gain. It remains in this draft solely for the requested product decision.Measurement repair after the live run
The original
ambient_items_set_equalcompared independently sampled baseline and marker completions byte-for-byte. Its failures, includingcontrol_unchanged_trials: 0, could not distinguish interference from ordinary model nondeterminism.The harness now:
The live outcome table above is unchanged by this assertion repair. The corrected ambient metrics have not been rerun against the live model in this commit.
Prominent v1 descope: questions
questionverdicts are logged and create nothing. The current extractor and policy route tasks, not answers, sohey Omi <question>remains unsupported even though it represents roughly one third of the stated product problem. Shipping this v1 requires explicit user sign-off on that descope.Evaluation fixtures
The live fixture set covers:
omie,omni, and welded mis-transcriptions in context; andDiscard evaluation now asserts the durable requirement only: the marked arm must never be discarded. It does not encode the empirically false claim that the current model discards the unmarked arm.
Product invariants affected
INV-MEM-4 (canonical promotion is the sole Long-term authority)
Triggered by the path glob on
backend/utils/conversations/process_conversation.py. Theinvariant is not affected in substance:
marker into the existing discard and extraction calls and nothing else.
create_memory/create_external_memory, no tier assignment, and no promotion pass.memory_commandverdict is inert with respect to memory storage: itappears only in
_ACCEPTED_EXPLICIT_VERDICTS, where its sole effect is to let an alreadyextracted action item retain
capture_kind=explicit_command. It creates no memory.and no change to consolidation routing.
Noted for a future PR, not introduced by this one: if a
memory_commandverdict is everwired to actually write a memory, it would become new canonical intake and must enter via
Short-term consolidation. It would also inherit the bystander-injection surface flagged in
the review, since the matcher deliberately does not gate on
is_user.How it was verified
bash scripts/typecheck.shfrombackend/- 0 errors.backend/.venv/bin/python -m pytest -q backend/tests/unit/test_wake_word.py backend/tests/unit/test_backend_candidate_capture.py backend/tests/unit/test_task_intelligence_contract_freeze.py- 94 passed.backend/.venv/bin/python -m pytest -q backend/tests/unit/test_process_conversation_usage_context.py- 41 passed.env -u ENCRYPTION_SECRET -u OPENAI_API_KEY backend/.venv/bin/python backend/scripts/task_intelligence_fixture_runner.py- passed without a production secret, exercising the new public, database-free scoring boundary.make preflightandscripts/pr-preflight --pr-body-file /tmp/omi-wake-word-pr-body.md- all 24 selected checks passed.Failure class (fixes)
Failure-Class: none
Line-count exceptions
Line-Count-Exception: backend/utils/conversations/process_conversation.py | 2359 -> 2375 | reason: thread the renderer-owned marker through the existing discard and extraction lifecycle without creating a second conversation coordinator
Line-Count-Exception: backend/utils/llm/conversation_processing.py | 1731 -> 1751 | reason: keep trusted-marker prompt guidance beside the existing discard and action extraction owners instead of adding a parallel LLM pipeline