Repository navigation
chore(pusher): reach LLM_GATEWAY_ACCOUNTING_ENABLED to both pusher charts - #13330
Merged
Merged
Conversation
…arts The pusher is the third host of process_conversation and the only one whose chart never declared the managed-spend ledger switch. Its gateway-routed spend was already ledgered by the gateway; the switch is what any direct- provider surface hosted here would read (utils/llm/managed_spend_ledger.py). Mirror backend-listen's literal on dev and prod, and promote the name to the co-host gate's REQUIRED_IDENTICAL_LITERALS so a missing or drifted value on either process_conversation host fails every pusher deploy workflow. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ect the chart comment Adversarial review follow-up: - test_verify_pusher_config_references.py derives the dev pusher literal set from runtime_env.yaml and pins it against a hardcoded dict; adding the fifteenth key broke it (1 failed, 21 passed) and CI's Backend unit suite had not reported yet. Add the key: 22 passed. - The chart comment implied the pusher was losing ledger rows. It is not: the pusher entrypoint's import graph never reaches managed_spend_ledger, so this is pre-positioning plus a drift gate with no runtime effect today. Rewrite it to lead with that, and drop the stray wrap. Co-Authored-By: Claude Fable 5.1 <[email protected]>
kodjima33
approved these changes
Sep 10, 2026
kodjima33
left a comment
Collaborator
There was a problem hiding this comment.
Config-consistency chore, not a bug fix (explicitly 'pre-positioning, not a fix for lost rows') — approve-only per confidence gate. Diff read in full: only adds an env flag + verifier/test coverage, no workflow/credential changes despite author's standing elevated-scrutiny flag.
Git-on-my-level
added a commit
that referenced
this pull request
Sep 11, 2026
Keep LLM_GATEWAY_ACCOUNTING_ENABLED from #13330 and the D2 BASIC_TIER overlay retirement, then compose the checked-in manifest. Failure-Class: none
Git-on-my-level
added a commit
that referenced
this pull request
Sep 11, 2026
…very serving identity (#13285) * chore(plan-catalog): D2 — delete the BASIC_TIER_* env overlays from every serving identity plan_catalog.json is now the only source of plan quotas. The legacy overlays outranked the catalog at runtime (utils/subscription.py _basic_transcription_overlay), which is how the prod API plane advertised 600 free minutes while the listen plane enforced 300. Remove them from both backend-listen charts and both pusher charts; declare them forbidden_env on the four Cloud Run conversation services so the deploy strips them (--remove-env-vars in deploy-backend-stack and sync-backfill-lifecycle) and the live check finds them absent. The _legacy_overlay bridge stays until the prod dispatch proves the deployed values gone. Co-Authored-By: Claude Fable 5.1 <[email protected]> * test(plan-catalog): lane the D2 retirement checks by cost The subscription-reload case is a per-test fresh module reload and belongs in the slow-guardrail lane; the two cases that drive the real workflow validator over the repository manifest and composite actions stay in the unit lane under a duration-allowlist entry with the reason. Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(plan-catalog): strip the retired overlays in the backfill clone step and run the catalog check in CI Cubic review follow-up on the D2 retirement: - The backfill-runtime clone step reads live backend-sync (which still carries the BASIC_TIER_* overlays) and strips vars via REMOVE_ENV_VARS; the four retired names were missing there, so the clone would re-set them on backend-sync-backfill in the same deploy that removes them, nullifying the removal. Add the four names to REMOVE_ENV_VARS and extend the static tripwire to cover REMOVE_ENV_VARS entries. - test_catalog_is_the_only_source_when_no_overlay_is_present is @pytest.mark.slow, but the slow-guardrail lane only runs files listed in tests/slow_guardrail_manifest.txt, so the check executed nowhere. List the file so the lane runs it. Verified: 15 passed (full file); slow lane selects 1/1, unit lane deselects it; black --check clean. * fix(plan-catalog): select the D2 retirement suite from the files it guards; state the scope it actually covers Adversarial review follow-up (2026-09-09): - The chart scan and the deploy-action scan were not selected by the changes they guard. select_backend_unit_tests.py returns False for backend/charts/** except monitoring sources, so re-adding BASIC_TIER_MINUTES_LIMIT_PER_MONTH to a GKE chart passed CI, and the GKE plane has no forbidden_env backstop at deploy time either. Register tests/unit/test_plan_quota_env_retirement.py in workflow_contracts.json under backend_cloud_run_deploy and rendered_gke_deployment_identity, add .github/actions/sync-backfill-lifecycle as a source there, and add that path to backend-unit-tests.yml (it was not in the workflow's paths at all, so a PR touching only that action never started the backend unit job). Verified with the real selector: all four charts, both composite actions and runtime_env.yaml now select the suite; before, none did. - plan-source-of-truth.md claimed flatly that no serving identity carries an overlay. Cloud Run desktop-backend is a ninth serving identity, is not in the cloud_run.services manifest and has no forbidden_env support, so it is covered by evidence not by a gate. Read live (dev + prod, read-only bots): it carries none of the four names, and no desktop router reads a plan transcription limit. Doc now says that instead of the absolute. Tests: retirement suite 15 passed; retirement + runtime-env + rendered-contract + preflight neighbours 183 passed; test_workflow_contracts.py 26 passed. Co-Authored-By: Claude Fable 5.1 <[email protected]> * chore: drop merge-hook Dart format noise from D2 overlay PR The main merge ran the Dart formatter on incoming app files and made this branch look like it touched INV-DATA-1 paths. Restore those files to origin/main so the PR stays quota-overlay-only. Failure-Class: none * chore(plan-catalog): regenerate composed runtime_env after main merge Keep LLM_GATEWAY_ACCOUNTING_ENABLED from #13330 and the D2 BASIC_TIER overlay retirement, then compose the checked-in manifest. Failure-Class: none --------- Co-authored-by: Claude Fable 5.1 <[email protected]> Co-authored-by: David Zhang <[email protected]>
Git-on-my-level
added a commit
that referenced
this pull request
Sep 16, 2026
…ds, and eager extraction (#14165) ## 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 #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 #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. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/14165?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
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.
Reach
LLM_GATEWAY_ACCOUNTING_ENABLEDto both pusher chartsThe pusher is the third host of
process_conversation(routers/pusher.py→process_conversation_task) and the only serving identity whose chart never declared the managed-spend ledger switch. This closes that gap and makes it a gated invariant rather than a thing anyone can drop.Premise, corrected by review — read this before citing the record
The direction review (local-models-free-tier, 2026-09-07 §2.3, Move 1) reads as if the pusher were losing ledger rows. It is not, and this PR does not recover any. The static import graph from
backend/pusher/main.py(which mounts onlyrouters.pusherandrouters.metrics) reaches 321 modules and never reachesutils/llm/managed_spend_ledger.py,routers/desktop_proxy.pyorrouters/omni_relay.py— the ledger's only two callers. Pusher-hostedprocess_conversationspends through the LLM gateway, which writesllm_gateway_attemptsunder its own identity.So this is pre-positioning plus a drift gate, with zero runtime effect today: the switch is declared and pinned so that (a) a direct-provider surface mounted on the pusher later cannot be silently ledger-blind, and (b) the co-host env diff fails instead of drifting. Move 1's evidence gate (a) — "≥1
llm_gateway_attemptsrow whose caller is a pusher-hosted finalization" — is therefore not the right falsification for this change and should be restated in the program record; there is no such caller to produce a row.What changed and why
backend/charts/pusher/dev_omi_pusher_values.yaml,backend/charts/pusher/prod_omi_pusher_values.yaml:LLM_GATEWAY_ACCOUNTING_ENABLED: "true", byte-identical to backend-listen's declaration in the same environment. Quoted string, not YAMLtrue— the manifest validator compares against the literal'true'and the reader lowercases a string, so the quoting is load-bearing. backend-listen declares no accounting companions (LLM_GATEWAY_ACCOUNTING_WRITE_TIMEOUT_SECONDS,…_MAX_PENDING_TRACESexist only on the llm-gateway charts); both hosts ride the module defaults, so mirroring the one name is the complete mirror.backend/deploy/runtime_env/dev.overlay.yamlandprod.overlay.yaml: declare the name on the pusher identity (category: rollout, matching the other seven declarations), plus the regeneratedbackend/deploy/runtime_env.yaml.backend/scripts/verify_pusher_cohost_env_diff.py: name promoted toREQUIRED_IDENTICAL_LITERALSand removed fromLISTEN_ONLY_ALLOWEDin both env blocks (leaving it would trip thestale_listencheck).backend/tests/unit/test_verify_pusher_config_references.py: the dev pusher literal inventory gains the fifteenth key (review must-fix 1).Delivery path — state this out loud
Dev does not auto-deploy this today.
Auto Deploy Backend Pusher to GKE (Development)triggers onbackend/charts/pusher/**but has failed on every run for two days, in the image dependency smoke:missing installed dependency modules: ['typesense', 'typesense.exceptions', 'typesense.exceptions.ObjectNotFound'](run 34377986501, and six before it).typesense==0.21.0is inbackend/requirements.txtbut notbackend/pusher/requirements.txt, while the pusher's copied source closure now reachesutils/conversations/typesense_index.py. Recorded atdata/run-2026-09-09-overnight-margins/blocked/free-tier-dev-pusher-typesense-image-smoke.md; not fixed here (different lane, and the honest alternative is that a pusher path should not be importing conversation search at all). Since the change is inert, nothing is lost by the delay — but the contract lands now, so the next successful pusher deploy carries it. Prod is a manual dispatch either way.Product invariants affected
backend/deploy/runtime_env.yamlis touched only to declare the ledger switch name on the pusher identity; no memory intake, promotion, or consolidation path changes.Automatic-or-dead check
Two independent gates, both exercised by mutation rather than asserted:
verify_pusher_cohost_env_diff.py, wired at.github/checks-manifest.yamllanes local+ci onbackend/charts/pusher/**andbackend/charts/backend-listen/**, and in both pusher deploy workflows): absent on pusher ⇒missing on {…}; different from backend-listen ⇒disagrees. Loops both environments.runtime_env_validation/manifest.py::_validate_gke): removing the chart entry yieldsmissing env LLM_GATEWAY_ACCOUNTING_ENABLED; changing the value yieldsvalue mismatch: expected 'true'.The co-host gate enforces agreement, not truthiness — both charts flipped to
"false"would pass it. That case is caught by the manifest pin instead;test_ledger_switch_off_on_pusher_failsis named for the one-host case it actually covers.How it was verified
pytest tests/unit/test_verify_pusher_cohost_env_diff.py tests/unit/test_verify_pusher_config_references.py— 34 passed (12 + 22). The config-references suite is the one this change breaks without the inventory fix; it is the load-bearing suite here, not the chart lint.verify_pusher_cohost_env_diff.pyagainst the repo charts — OK; dev pusher=67 / listen=123 / required-identical=5, prod 72 / 119 / 5.check_runtime_env_compose.sh— up to date.validate-backend-runtime-env.py --env dev|prod --check-workflows— both pass.check_product_invariants.pyover the changed-file list — INV-MEM-4 is the only matching invariant and the body names it.Cut list
desktop_chat_realtime, 0 prod rows all-time) is off-path — separate probe (one floating-bar PTT turn on dev must produce exactly one row).typesense) — different lane; blocked record above.shutdown_managed_spend_ledger()intobackend/pusher/main.py— it is wired inbackend/main.pyandbackend/desktop_backend.pybut not the pusher, so a future pusher-hosted direct surface would not drain scheduled writes on SIGTERM. That is the second half of "make pusher ledger-capable" and belongs with the surface that first needs it, not with a chart declaration.Adversarial review (opus reviewer, 2026-09-09) — findings and resolutions
test_verify_pusher_config_references.py::test_rendered_dev_pusher_direct_bindings_match_source_contractpins the dev pusher literal set derived from the manifest against a hardcoded 14-key dict; the new key made it 15 and CI'sBackend unit suitehad not reported yet. Reproduced locally (1 failed, 21 passed), fixed, now22 passed. No prod counterpart exists — that suite spot-checks four keys — which is why only dev failed.prod.overlay.yaml; the diff also changesdev.overlay.yamland the generated manifest. Listed.shutdown_managed_spend_ledger()is not wired intobackend/pusher/main.py.SERVICE_ACCOUNT_JSONalready bound on the pusher chart, collection is a module constant, so there is no "switch on, no sink" hazard); the gate is genuinely automatic-or-dead in both environments and does not block unrelated deploys; the pusher is a modelled GKE identity in the manifest so the overlay edit is on-target; INV-MEM-4 is the only matching invariant and the citation is sufficient; the ledger write path is fire-and-forget (2-worker executor, 1000 pending cap, 1 s shielded timeout), so there is no hot-path cost even if a surface is adopted.Failure-Class: none