Repository navigation
fix(backend): wake-word adjudication demotes only on an explicit adverse verdict, and gains a kill switch - #12671
Merged
Conversation
…rse verdict, and gains a kill switch An empty or timed-out adjudicator return was treated as a rejection, so "hey omi" explicit commands fell through to direct_request. Only an explicit adverse verdict now demotes; WAKE_WORD_ADJUDICATION_ENABLED can skip the call; explicit_command is evaluated before public_broadcast. Co-Authored-By: cursor grok-4.6 <[email protected]> Co-authored-by: Cursor <[email protected]>
…md past its lean budget Co-Authored-By: cursor grok-4.6 <[email protected]> Co-authored-by: Cursor <[email protected]>
There was a problem hiding this comment.
1 issue found across 11 files
Confidence score: 5/5
backend/AGENTS.mdplacesWAKE_WORD_ADJUDICATION_ENABLEDunder meeting-identity guidance even though it controls wake-word task-capture adjudication inutils/task_intelligence/conversation_capture.py, which could mislead maintainers; move the setting to the task-capture documentation.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="backend/AGENTS.md">
<violation number="1" location="backend/AGENTS.md:133">
P3: `WAKE_WORD_ADJUDICATION_ENABLED` is placed in the meeting-identity paragraph, but it gates wake-word task-capture adjudication (`utils/task_intelligence/conversation_capture.py`), not meeting-identity enrichment. Listing it in the "Defaults on:" list here implies it controls meeting-context resolution and misleads readers. Document it in the STT/summarization or task-capture section instead, or drop it from this sentence.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| - **llm-gateway** (`llm_gateway/main.py`) — Internal FastAPI service for Omi-managed LLM auto lanes. Called by backend with service auth for `omi:auto:*` chat-completions routes; not exposed to clients. Public shared-conversation chat uses only the dedicated `omi:auto:public-shared-conversation-chat` lane and returns unavailable on every gateway fault. Also owns the `/v1/embeddings` surface and the company-paid desktop-Vertex lanes (see `docs/llm/model_endpoint_inventory.yaml`). | ||
| - Conversation notes v2 is independently dogfood-gated by `CONVERSATION_NOTES_V2_ENABLED`, `CONVERSATION_APPS_OPT_IN_ONLY`, `CONVERSATION_CALENDAR_CONTEXT_READ_ENABLED`, and `CONVERSATION_OCR_CONTEXT_ENABLED`; all runtime-manifest defaults stay off until promoted. | ||
| - Meeting identity reaches the summarization prompt through `utils/conversations/meeting_context.resolve_meeting_context`, called before `_get_structured`. Sources, best first: stored calendar-backed meeting (exact `redis_db` conversation→meeting mapping, else a time-overlap query over `users/{uid}/meetings`) → `calendar_meeting_context` on the create request → overlapping Google Calendar event (read-only) → stored on-device screen-derived identity → server-side conferencing-window OCR. Every layer degrades to no context; none may fail the conversation. Stored-meeting lookup defaults on (`CONVERSATION_STORED_MEETING_CONTEXT_ENABLED` kill switch). | ||
| - Meeting identity reaches the summarization prompt through `utils/conversations/meeting_context.resolve_meeting_context`, called before `_get_structured`. Sources, best first: stored calendar-backed meeting (exact `redis_db` conversation→meeting mapping, else a time-overlap query over `users/{uid}/meetings`) → `calendar_meeting_context` on the create request → overlapping Google Calendar event (read-only) → stored on-device screen-derived identity → server-side conferencing-window OCR. Every layer degrades to no context; none may fail the conversation. Defaults on: `CONVERSATION_STORED_MEETING_CONTEXT_ENABLED`, `WAKE_WORD_ADJUDICATION_ENABLED`. |
There was a problem hiding this comment.
P3: WAKE_WORD_ADJUDICATION_ENABLED is placed in the meeting-identity paragraph, but it gates wake-word task-capture adjudication (utils/task_intelligence/conversation_capture.py), not meeting-identity enrichment. Listing it in the "Defaults on:" list here implies it controls meeting-context resolution and misleads readers. Document it in the STT/summarization or task-capture section instead, or drop it from this sentence.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At backend/AGENTS.md, line 133:
<comment>`WAKE_WORD_ADJUDICATION_ENABLED` is placed in the meeting-identity paragraph, but it gates wake-word task-capture adjudication (`utils/task_intelligence/conversation_capture.py`), not meeting-identity enrichment. Listing it in the "Defaults on:" list here implies it controls meeting-context resolution and misleads readers. Document it in the STT/summarization or task-capture section instead, or drop it from this sentence.</comment>
<file context>
@@ -130,7 +130,7 @@ STT provider/surface policy and model order live in `config/stt_provider_policy.
- **llm-gateway** (`llm_gateway/main.py`) — Internal FastAPI service for Omi-managed LLM auto lanes. Called by backend with service auth for `omi:auto:*` chat-completions routes; not exposed to clients. Public shared-conversation chat uses only the dedicated `omi:auto:public-shared-conversation-chat` lane and returns unavailable on every gateway fault. Also owns the `/v1/embeddings` surface and the company-paid desktop-Vertex lanes (see `docs/llm/model_endpoint_inventory.yaml`).
- Conversation notes v2 is independently dogfood-gated by `CONVERSATION_NOTES_V2_ENABLED`, `CONVERSATION_APPS_OPT_IN_ONLY`, `CONVERSATION_CALENDAR_CONTEXT_READ_ENABLED`, and `CONVERSATION_OCR_CONTEXT_ENABLED`; all runtime-manifest defaults stay off until promoted.
-- Meeting identity reaches the summarization prompt through `utils/conversations/meeting_context.resolve_meeting_context`, called before `_get_structured`. Sources, best first: stored calendar-backed meeting (exact `redis_db` conversation→meeting mapping, else a time-overlap query over `users/{uid}/meetings`) → `calendar_meeting_context` on the create request → overlapping Google Calendar event (read-only) → stored on-device screen-derived identity → server-side conferencing-window OCR. Every layer degrades to no context; none may fail the conversation. Stored-meeting lookup defaults on (`CONVERSATION_STORED_MEETING_CONTEXT_ENABLED` kill switch).
+- Meeting identity reaches the summarization prompt through `utils/conversations/meeting_context.resolve_meeting_context`, called before `_get_structured`. Sources, best first: stored calendar-backed meeting (exact `redis_db` conversation→meeting mapping, else a time-overlap query over `users/{uid}/meetings`) → `calendar_meeting_context` on the create request → overlapping Google Calendar event (read-only) → stored on-device screen-derived identity → server-side conferencing-window OCR. Every layer degrades to no context; none may fail the conversation. Defaults on: `CONVERSATION_STORED_MEETING_CONTEXT_ENABLED`, `WAKE_WORD_ADJUDICATION_ENABLED`.
- `users/{uid}/meetings` is populated only through `POST /v1/calendar/meetings`. The macOS client writes flag-gated EventKit identity as `system_calendar` and minimum on-device OCR-derived identity as `screen_activity` before conversation processing; the resolver always ranks a real calendar event above `screen_activity`.
- Calendar capture (SCA-381): overlap retains scraps; `GET /v1/calendar/capture-gaps` surfaces gaps. See `.github/agent-docs/calendar-capture.md`.
</file context>
Suggested change
| - Meeting identity reaches the summarization prompt through `utils/conversations/meeting_context.resolve_meeting_context`, called before `_get_structured`. Sources, best first: stored calendar-backed meeting (exact `redis_db` conversation→meeting mapping, else a time-overlap query over `users/{uid}/meetings`) → `calendar_meeting_context` on the create request → overlapping Google Calendar event (read-only) → stored on-device screen-derived identity → server-side conferencing-window OCR. Every layer degrades to no context; none may fail the conversation. Defaults on: `CONVERSATION_STORED_MEETING_CONTEXT_ENABLED`, `WAKE_WORD_ADJUDICATION_ENABLED`. | |
| Defaults on: `CONVERSATION_STORED_MEETING_CONTEXT_ENABLED` (kill switch). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
An empty wake-word adjudication (provider timeout, exception, or no overlapping invocation) was treated as a rejection:
not relevant_verdicts ordemoted extractorexplicit_commandtodirect_request, so "hey omi, remind me to X" landed in the review queue or was dropped. Only an explicit adverse verdict now demotes.WAKE_WORD_ADJUDICATION_ENABLED(default on) skips the LLM call entirely and keeps the deterministic marker.explicit_commandis evaluated beforepublic_broadcast, so the first producer of that unused signal cannot drop a spoken command.INV-TASK-2 deleted
create_direct; an admitted explicit command ispending_candidate, which is what the ordering test asserts.Product invariants affected
backend/deploy/runtime_env.yamlonly; this PR does not change promotion authority)How it was verified
Red-proof (regression tests written first; mutation after the fix):
not relevant_verdicts orfails:test_empty_adjudication_leaves_extractor_explicit_command_intact(assert False is True)test_adjudicator_exception_leaves_extractor_explicit_command_intact(assert False is True)public_broadcastaboveexplicit_commandfails:test_explicit_command_wins_over_public_broadcast(assert 'ignore' == 'pending_candidate')tests/unit/test_wake_word_adjudication_failsafe.pyCI-shaped backend unit run (file isolation) over the mapped subset (new failsafe tests, capture/wake-word tests, composed
runtime_env.yamlworkflow-contract tests): 25 files, 0 failed, including 99 passed intest_backend_runtime_env_validator.py. Pyright on the production capture modules and the new test file: 0 errors.Not verified: a live conversation through production listen/reprocess. No production access. The selector's unmapped-path fallback would select the full backend unit suite for
backend/deploy/runtime_env/_base.yamlandbackend/utils/task_intelligence/(pre-existing; mapping those in the selector orworkflow_contracts.jsonitself forces a full-suite path). A prior full-suite attempt saturated the host (load 400+); CI will run that fallback.Tests
backend/tests/unit/test_wake_word_adjudication_failsafe.py:explicit_commandintactNone/true/on/1): calledpublic_broadcast=True+ explicit command that meets the capture floor →pending_candidategke/backend-listenandcloud_run/backendCloud Run validator fixtures inject
WAKE_WORD_ADJUDICATION_ENABLED=truethe same way as the notes-v2 flags, so a deploy that omits it on the reprocess host fails validation.Failure class (fixes)
The violated contract is "an absent signal treated as a negative verdict": a completed-empty adjudication (or a caught timeout that returns
WakeWordAdjudication()) was folded into the same branch asquestion/quoted_or_meta. No existing class names that exact gate.FC-proven-empty-rendered-as-denialis the nearest: a proven-empty result was rendered as a denial rather than as "no opinion".FC-recoverable-provider-failure-terminalcovers only the timeout path, not a successful empty return. Did not add a registry entry.Failure-Class: FC-proven-empty-rendered-as-denial
Follow-up (maintainer)
The LLM adjudicator is unchanged (model,
reasoning_effort='high', prompt). It changed 0 outcomes in 15 measured calls at ~35× the marker's cost. Desktop PR #11801 solves the same false-positive problem deterministically.EVIDENCE_BACKED_WAKE_WORD_VARIANTSwas not touched.