Skip to content

feat(desktop): fail-closed basic plan gate on proactivity, proxy embeds, and eager extraction - #14165

Merged
Git-on-my-level merged 4 commits into
mainfrom
fix/basic-proactivity-fail-closed-gate
Sep 16, 2026
Merged

Git-on-my-level merged 4 commits into
mainfrom
fix/basic-proactivity-fail-closed-gate

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Summary

Track B (SCA-482): fail-closed basic gate on the three remaining omi-funded desktop spend surfaces — no FREE_TIER_* flag flip, no BASIC_TIER_* overlay change.

  • desktop_proactivity completions — route-level authorize_managed_compute gate on proactive_completion via the per-operation model-config lane (desktop_proactive_extraction / desktop_proactive_reasoning). Basic + omi-funded → 402 plan_gated before any quota or provider work; authorization outage → 503; a validated BYOK key for the lane's provider funds the call unchanged (existing JIT contract, no second pipeline).
  • desktop_proxy Gemini embeds (TBD-4 closed) — embedContent / batchEmbedContents join _PLAN_GATED_PROXY_ACTIONS, sharing screen_frame_judge's Gemini provider binding so the BYOK exemption stays provider-exact. Same 402 mapping as generate/stream.
  • Eager extraction (process_conversation, flag-off) — first-open (force_process) and manual reprocess of desktop conversations now consult resolve_free_tier_processing_plan through the same _managed_compute_decision_for closure the flag-on branch uses. An identified basic deny lands at the deterministic minimum (terminal store, terminal_no_derived_effects); identification failure and authorization outages fail open, matching should_defer_desktop_processing's documented contract. Non-desktop sources untouched — the summary flip stays held.
  • Instrument (DEV pusher) — new test_pusher_conversation_ledger_instrument.py pins both ledger halves hermetically: gateway attribution headers (X-Omi-LLM-Feature) on the conv_structure lane client, and the caller-side managed_spend_ledger write gated on LLM_GATEWAY_ACCOUNTING_ENABLED. The flag is already checked-in true on both pusher charts (backend/charts/pusher/{dev,prod}_omi_pusher_values.yaml, PR chore(pusher): reach LLM_GATEWAY_ACCOUNTING_ENABLED to both pusher charts #13330) — no chart change needed in this PR.

FREE_TIER_LOCAL_PROCESSING / FREE_TIER_MEMORY_SUPPRESSION remain OFF on every identity. BASIC_TIER_* overlays untouched. No prod env mutation in this PR.

Failure-Class: FC-shared-spend-gate-missing-on-sibling-producers

Product invariants affected

  • INV-MEM-4
  • INV-TASK-2

Line-Count-Exception: backend/routers/desktop_proxy.py | 1689 -> 1692 | embedContent/batchEmbedContents join _PLAN_GATED_PROXY_ACTIONS (TBD-4 closed); no logic added
Line-Count-Exception: backend/utils/conversations/process_conversation.py | 3101 -> 3167 | flag-off identified-basic eager-deny gate: one helper + one branch reusing the existing S6 policy and deterministic-minimum store, no second pipeline

Evidence

Fail-closed sabotage proof (gate removed → red, restored → green)

Sabotage Guard Result without gate Result with gate
drop await _enforce_proactive_plan_gate(...) from the route test_proactive_completion_rejects_basic_before_quota_or_provider FAILED (provider spy reached) pass
remove embed actions from _PLAN_GATED_PROXY_ACTIONS test_gemini_proxy_rejects_basic_embed_content FAILED (provider spy reached) pass
delete the flag-off eager-deny elif test_flag_off_first_open_basic_is_deterministic_minimum FAILED (_get_structured called) pass

Tests run (Python 3.11 venv, worktree base origin/main @ d36cdaff41)

.venv/bin/pytest tests/unit/test_desktop_proactivity.py tests/unit/test_desktop_proxy.py \
  tests/unit/test_free_tier_entrypoint_matrix.py tests/unit/test_process_conversation_free_tier_branch.py \
  tests/unit/test_pusher_conversation_ledger_instrument.py -q
→ 387 passed
black --line-length 120 --skip-string-normalization --check <8 changed files> → clean

Matrix harness note: expectations are derived from a three-way _outcome helper (process / legacy_defer / terminal) — flag-on desktop basic is always the policy minimum; _legacy_defers only applies flag-off. Eager-gate-consulting legacy tests patch the authorize seam so no test waits out a real Firestore fail-open (was 265–284s each, now sub-second).

Ledger / serving-env evidence (read-only inspect, env names only)

  • GKE dev-omi-gke / ns dev-omi-backend: deployment dev-omi-pusher live env includes LLM_GATEWAY_ACCOUNTING_ENABLED and OMI_LLM_GATEWAY_URL (63 env names total) — matches the checked-in dev chart.
  • GKE prod-omi-gke / ns prod-omi-backend: deployment prod-omi-pusher (15 replicas) live env omits LLM_GATEWAY_ACCOUNTING_ENABLED (OMI_LLM_GATEWAY_URL present; 68 names total) — the live prod workload lags the checked-in chart from chore(pusher): reach LLM_GATEWAY_ACCOUNTING_ENABLED to both pusher charts #13330. Residual operator item: next prod pusher rollout picks the flag up; no prod write performed here.
  • desktop_chat_realtime: 0 prod ledger rows all-time (reported fact from the S14 ledger review; unchanged by this PR — realtime is not on this fail-closed path).

Product scope

Named change (transcripts + search free; insights paid): DEV/beta 402 plan_gated on proactivity + proxy embeds + eager extraction is the intended beta product. Prod stays ungated until a separate ask. No iOS/macOS floor bumps. BYOK-basic keeps the user-key path exactly as the JIT contract defines it.

Review in cubic

…ds, and eager extraction

S14 proactivity half, flag-off track: PlanType.basic can no longer reach
paid providers on the three remaining omi-funded desktop surfaces.

- desktop_proactivity: route-level authorize_managed_compute gate
  (desktop_proactive_extraction / desktop_proactive_reasoning lanes);
  402 plan_gated, 503 on authorization outage, BYOK contract unchanged.
- desktop_proxy: embedContent / batchEmbedContents join
  _PLAN_GATED_PROXY_ACTIONS (TBD-4 resolved closed); same 402 mapping.
- process_conversation: flag-off identified-basic eager deny for
  first-open (force_process) and manual reprocess on desktop sources via
  resolve_free_tier_processing_plan — deterministic minimum, no second
  pipeline; identification failure fails open.
- inventory yaml: fallback_on_deny http_402 for proactive lanes; embed
  gate note.
- new test_pusher_conversation_ledger_instrument.py pins the pusher
  ledger instrument halves (gateway attribution headers + flag-gated
  ledger write).
@Git-on-my-level
Git-on-my-level merged commit 1bdf57b into main Sep 16, 2026
53 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/basic-proactivity-fail-closed-gate branch September 16, 2026 08:51
Git-on-my-level added a commit that referenced this pull request Sep 17, 2026
…lt-off switches (#14316)

#14165 merged a 402 on desktop proactivity completions, a 402 on Gemini proxy
embeds, and a deterministic-minimum landing for flag-off desktop first-open and
reprocess, all unconditional, while its description said production would stay
ungated. The next routine production deploy would have switched all three on
before any on-device replacement had shipped.

Each gate now reads its own call-time env switch (default off, explicit true in
dev, explicit false in prod, declared on every host of its code path, including
backend-sync-backfill). Off performs no authorize call and writes no marker.
Deploy admission accepts only exact true/false for the co-hosted switch. The
S14 generate/stream proxy gate that is already live in production is unchanged.

Failure-Class: new

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant