Skip to content

fix(backend): wake-word adjudication demotes only on an explicit adverse verdict, and gains a kill switch - #12671

Merged
Git-on-my-level merged 2 commits into
mainfrom
agent/wake-word-adjudicator-failsafe
Sep 3, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
agent/wake-word-adjudicator-failsafe

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

What changed and why

An empty wake-word adjudication (provider timeout, exception, or no overlapping invocation) was treated as a rejection: not relevant_verdicts or demoted extractor explicit_command to direct_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_command is evaluated before public_broadcast, so the first producer of that unused signal cannot drop a spoken command.

INV-TASK-2 deleted create_direct; an admitted explicit command is pending_candidate, which is what the ordering test asserts.

Product invariants affected

  • INV-TASK-2
  • INV-MEM-4 (path glob on backend/deploy/runtime_env.yaml only; this PR does not change promotion authority)

How it was verified

Red-proof (regression tests written first; mutation after the fix):

  • Restoring not relevant_verdicts or fails:
    test_empty_adjudication_leaves_extractor_explicit_command_intact (assert False is True)
    test_adjudicator_exception_leaves_extractor_explicit_command_intact (assert False is True)
  • Putting public_broadcast above explicit_command fails:
    test_explicit_command_wins_over_public_broadcast (assert 'ignore' == 'pending_candidate')
  • After restore: 15 passed in tests/unit/test_wake_word_adjudication_failsafe.py

CI-shaped backend unit run (file isolation) over the mapped subset (new failsafe tests, capture/wake-word tests, composed runtime_env.yaml workflow-contract tests): 25 files, 0 failed, including 99 passed in test_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.yaml and backend/utils/task_intelligence/ (pre-existing; mapping those in the selector or workflow_contracts.json itself 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:

  • empty adjudication / adjudicator exception → explicit_command intact
  • explicit adverse verdicts still demote
  • kill switch off: adjudicator not called; on (None/true/on/1): called
  • public_broadcast=True + explicit command that meets the capture floor → pending_candidate
  • flag declared on both gke/backend-listen and cloud_run/backend

Cloud Run validator fixtures inject WAKE_WORD_ADJUDICATION_ENABLED=true the 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 as question / quoted_or_meta. No existing class names that exact gate. FC-proven-empty-rendered-as-denial is the nearest: a proven-empty result was rendered as a denial rather than as "no opinion". FC-recoverable-provider-failure-terminal covers 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_VARIANTS was not touched.

Review in cubic

Git-on-my-level and others added 2 commits September 3, 2026 01:13
…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]>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 11 files

Confidence score: 5/5

  • backend/AGENTS.md places WAKE_WORD_ADJUDICATION_ENABLED under meeting-identity guidance even though it controls wake-word task-capture adjudication in utils/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

Comment thread backend/AGENTS.md
- **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`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

@Git-on-my-level
Git-on-my-level merged commit 77575a8 into main Sep 3, 2026
45 checks passed
@Git-on-my-level
Git-on-my-level deleted the agent/wake-word-adjudicator-failsafe branch September 3, 2026 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant