Repository navigation
feat(backend): plumb the free-tier on-device summary cohort through the deploy path (dev only, inert on merge) - #15334
Merged
Git-on-my-level merged 5 commits intoSep 21, 2026
Conversation
… deploys Declare the dev-on/prod-off processing switch, empty-by-default Actions variable cohort, and explicit emergency-stop value on listener, pusher, backend, sync, sync-backfill, integration, and desktop-backend. Integration was added after tracing main:app and its process_conversation caller. Keep memory suppression unplumbed and unset. Use the development environment variable FREE_TIER_LOCAL_PROCESSING_COHORT. Shared UID-only deploy validation rejects malformed or percentage cohorts; render escaped Cloud Run values and an optional GKE ConfigMap binding. Preserve the validator import closure in immutable desktop prod controls. Extend #14316 deployment tests and the existing CI capability checks. Verification (repository-only, no network or deployment): - Offline uv venv + uv pip sync backend/pylock.macos.toml: successful. - make -o setup-main -o setup-backend setup: installed hooks; intentionally skipped network refresh and dependency re-sync after the offline setup. - PATH="$PWD/backend/.venv/bin:$PATH" bash backend/scripts/pre-deploy-check.sh: 252 pytest passed, 30 source-admission fixtures passed, dev/prod workflow, bucket, source-admission and OAuth contracts passed. - BACKEND_UNIT_TEST_FILE_LIST=/tmp/free-tier-final-test.txt BACKEND_PYTEST_WORKERS=1 bash backend/test.sh: 137 rollout tests passed. - Selected component run: all 220 assertions passed; one unchanged cohort sweep test exceeded CPU guard (0.48s/0.30s). Isolated same-runner retry: test_free_tier_cohort.py, 55 passed with unchanged timing guard. - Other selected test.sh files: processing policy 30 passed; GKE renderer 6 passed; conversation-notes rollout 6 passed. - Real renderer/validator CLI smoke: 4 passed (dev/prod x empty/multi-UID), including Cloud Run state and ConfigMap output; synthetic identifiers only. - bash backend/scripts/check_runtime_env_compose.sh: up to date. - python .github/scripts/check_deployment_secret_boundary.py --base origin/main: passed. - python backend/scripts/verify_pusher_cohost_env_diff.py: dev/prod passed. - python .github/scripts/check-desktop-backend-release-policy.py: passed. - python .github/scripts/test_check_desktop_backend_release_policy.py: 37 passed. - scripts/backend-python-format --check (13 changed Python files): passed. - git diff --check: passed. Not verified: live deployment, GitHub variable state, AFM product acceptance, full backend suite, or Helm-dependent pusher tests (Helm explicitly forbidden). The updated pusher literal expectation is additionally covered by static chart/manifest tests. No assertions weakened or removed; no push performed.
…ction, and start dark when a pod races the ConfigMap Independent review of the plumbing commit found two hazards before merge. GitHub's vars context falls back from environment to repository scope, so the production workflow no longer reads any cohort variable and the development one is named DEV_FREE_TIER_LOCAL_PROCESSING_COHORT. The pusher/listener configMapKeyRef is now optional: a rollout that starts before the backend lane has written the key gets an unset value, which the cohort module treats as admit-nobody, instead of failing to start. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…gistry, not AGENTS.md Co-Authored-By: Claude Fable 5.1 <[email protected]>
…n-secret setting Co-Authored-By: Claude Fable 5.1 <[email protected]>
Git-on-my-level
marked this pull request as ready for review
September 21, 2026 04:34
test_verify_pusher_cohost_env_diff splices a probe key after 'env:' using that entry as its anchor; inserting the free-tier keys above it broke the anchor. Order within the list has no runtime meaning, so move the new entries below it and leave the test alone. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Git-on-my-level
deleted the
feat/free-tier-local-processing-deploy-plumbing
branch
September 21, 2026 05:28
This was referenced Sep 21, 2026
Git-on-my-level
added a commit
that referenced
this pull request
Sep 21, 2026
…er cohort as an input (#15348) ## Summary **Unbreaks every backend deploy from `main`.** #15334 (mine, merged 2026-09-21T05:28Z as `f2320d8762`) referenced `${{ vars.DEV_FREE_TIER_LOCAL_PROCESSING_COHORT }}` inside the composite action `.github/actions/deploy-backend-stack`. A composite action cannot read the `vars` context, so GitHub rejects the action at load time: ``` action.yml (Line: 543, Col: 44): Unrecognized named-value: 'vars' Failed to load ./.github/actions/deploy-backend-stack/action.yml ``` Observed on "Auto Deploy Backend to Development" run 35565085049 for `8169b2eb88`. The same action is used by `gcp_backend.yml`, so a **production** backend deploy from `main` would fail the same way. It fails closed — nothing wrong was deployed — but nothing can be deployed either. ### Fix The cohort becomes an action **input** (`dev_free_tier_local_processing_cohort`, default empty). Only the calling workflows read the variable: `gcp_backend_auto_dev.yml` passes it; `gcp_backend.yml` passes it only when the dispatch is for `development`, so a production run never carries it. The prod overlay still renders a literal empty regardless. ### Why it got through The file is valid YAML; the wiring test asserted the exact `vars.…` string it should never have contained; an independent model review checked scope fallback and injection but not context availability; and nothing in preflight executes or context-checks a composite action. New test `test_no_composite_action_reads_a_context_it_cannot_access` scans every composite action's expressions for `vars.`/`secrets.`. **Verified red against `origin/main`** (3 offenders, lines 543/568/960) and green here. Also verified: every job that reads the variable declares `environment:`, which an environment-scoped variable requires in order to resolve at all. ## Product invariants affected - INV-DATA-1 — touched by path only (deploy workflow + composite action). No routing, endpoint, or data-plane selection changes. Failure-Class: new New class `FC-composite-action-reads-unavailable-context`, defined in this PR. ## Verification Layer: **repository checks and unit tests. Not yet verified by a live deploy** — the first "Auto Deploy Backend to Development" run after merge is the real proof, and I will report its result on this PR. - `actionlint` on both calling workflows — clean. - `test_free_tier_basic_gates.py` — 138 passed, including the new context test and the updated caller-wiring assertions. - `scripts/pr-preflight --pr-body-file …` — **passed, 42 checks**. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.
Summary
Plumbs the free-tier on-device summary rollout switch through the backend deploy path, so Stage 1 (Omi Beta, explicit accounts, Apple Foundation Models only) can be lit by setting one GitHub Actions variable instead of an out-of-band
gcloudedit. Merging this widens exposure to nobody. Production is dark by construction. In development the cohort is one test account that was already admitted (see "State found before merge").Decision this implements (David, 2026-09-21): desktop on-device summarization ships on AFM only; no second local engine. Record:
omi-knowledge-base:projects/local-models-free-tier/evidence/2026-09-21-afm-only-decision-and-ship-packet.md.FREE_TIER_LOCAL_PROCESSINGtruefalseFREE_TIER_LOCAL_PROCESSING_COHORTDEV_FREE_TIER_LOCAL_PROCESSING_COHORT; empty when unsetFREE_TIER_EMERGENCY_STOPfalsefalseFREE_TIER_MEMORY_SUPPRESSIONis deliberately not plumbed: it has no on-device replacement, so lighting it would be takeaway without replacement.State found before merge (2026-09-21)
The dev Cloud Run
backendservice already carriedFREE_TIER_LOCAL_PROCESSING=trueand a one-uid cohort (the basic-plan test account), set out-of-band by an earlier session and preserved by CI's merge-style env updates; no other host had it. Deploying this PR with the variable unset would have silently de-admitted that account, soDEV_FREE_TIER_LOCAL_PROCESSING_COHORTwas set atdevelopmentscope to that same single uid first (repo scope verified empty). Net effect of the merge: the same one account, now admitted consistently on all seven hosts, reviewable in config, withFREE_TIER_EMERGENCY_STOPavailable as a rollback.Why merging is otherwise inert
utils/free_tier_cohortmakes a lit flag mean "lit for the configured cohort" and admits nobody when the cohort is unset, empty or malformed. The only production call site passes a uid, and no metric or alert reads the boolean.Why production cannot be reached
false/ empty /falseinprod.overlay.yaml; the renderer takes a literalvaluebefore it consults any environment source.varscontext falls back from environment to repository scope, so "only set it on thedevelopmentenvironment" is a convention, not a boundary; not reading it is the boundary. A test asserts the prod workflow contains no such reference.validate_free_tier_deploy_contract('prod', …)rejects activation on any host, parametrized over every host path.Hosts
backend,backend-sync,backend-sync-backfill,backend-integration,backend-listen,pusher(all reachprocess_conversation), plusdesktop-backend(shares the emergency-stop reader).backend-integrationwas found by tracing importers; it is not in #14316's roster.Deploy-boundary validation
The cohort is validated at render time for both transports (Cloud Run env and GKE ConfigMap): empty, or comma-separated
uid:<non-empty>. Percentages are rejected at deploy even though the runtime parser supports them — Beta serves through the development plane on the production data plane, so a percentage would select real people by hash with no way to know whose Mac can run AFM. Newlines, CR, U+2028/2029 and NUL are rejected; commas are escaped fordeploy-cloudrun; the GKE path writes an env file consumed bykubectl --from-env-file, so the value is never shell-evaluated.Found in independent review and fixed here
A second-model adversarial review (read-only) confirmed production is dark under every input and flagged two hazards, both fixed in the second commit:
DEV_….configMapKeyRefisoptional: true, so a pod that starts first starts dark rather than failing.Known and accepted: co-hosts snapshot the cohort at pod start, so after the variable changes, listener and pusher can briefly differ. At Stage 1 both directions are safe — the stale side simply summarizes in the cloud as today. The runbook redeploys the backend stack, then pusher. Also accepted: the multi-uid Cloud Run escaping test asserts the renderer's own transformation rather than gcloud's grammar; the backend and desktop deploy paths have a live post-deploy env readback.
Product invariants affected
FREE_TIER_MEMORY_SUPPRESSIONis deliberately left unplumbed and unset, so memory formation is unchanged for every user in every environment.Verification
Layer: repository checks and unit tests only. Nothing was deployed and no live service was contacted.
bash backend/scripts/pre-deploy-check.sh— 252 passed, plus source-admission fixtures.test_free_tier_basic_gates137,test_backend_runtime_env_validator42,test_render_backend_runtime_env22,test_render_gke_backend_config6,test_verify_pusher_config_references119 — all pass.check_runtime_env_compose.sh— generatedruntime_env.yamlis current.verify_pusher_cohost_env_diff.py— dev and prod pass.check_deployment_secret_boundary.py, desktop-backend release policy (37) — pass.scripts/pr-preflight --pr-body-file …— passed, 54 checks. CI: all checks green on9de7e5ff9f. One real failure was found by CI and fixed (test_verify_pusher_cohost_env_diffanchors onREFERRAL_PUBLIC_BASE_URLbeing the first listen env entry; the new keys were moved below it, the test untouched).Not verified: a live deployment, Helm rendering against a cluster, the full backend suite.
To light Stage 1 after merge (not done by this PR)
then redeploy the development backend stack, then pusher. Success is the backend log line
free-tier: stored projected conversation … mode=store_projectionwithclient_processing.provenance.model_id == "afm";mode=deterministic_minimumfor a real user is the alarm.🤖 Generated with Claude Code