Skip to content

feat(deploy): feature activation manifest and read-only checker; conversations-v3 first (SCA-2967) - #25713

Merged
Git-on-my-level merged 7 commits into
mainfrom
lane/activation-manifest
Nov 21, 2026
Merged

Git-on-my-level merged 7 commits into
mainfrom
lane/activation-manifest

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

What changed and why

SCA-2967. Activating conversations-v3 for TestFlight on 2026-11-17 needed several services to move in a fixed order: backend Cloud Run, then llm-gateway, then pusher, then listen. Nothing encoded that order, and each gap was found in prod or by luck:

  • llm-gateway was two weeks stale and had no v3 lanes;
  • pusher lacked the SYNC_TASKS_PROJECT/SYNC_TASKS_LOCATION that listen sets;
  • pusher's image was 8 days old (version skew);
  • the conversations-v3 queue and the v3 scheduler jobs did not exist.

KB evidence: evidence/2026-11-17-v3-testflight-activation-escapes.md (#7, #8) and 2026-11-17-delivery-debt-from-v3-rollout.md (D1, D8).

This PR adds a feature activation manifest (data) and a read-only tool that checks it against live serving state. The first manifest is conversations-v3. The tool is not wired into any gate.

  • backend/deploy/activation/conversations-v3.yaml lists:

    • the services and the commits each must contain (ancestry, not an exact SHA);
    • the order they must move in;
    • env keys that must be set, and equal across runtimes where that matters;
    • gateway lanes, the queue and the scheduler jobs.

    Each entry has a why that points at the code or incident behind it. The format is in backend/deploy/activation/README.md.

  • backend/scripts/activation_check.py is pure: manifest + state JSON in, verdict out. Each requirement is satisfied, missing, unknown or deferred.

    • Exit codes: 0 READY; 1 BLOCKED (a controlled requirement is missing); 2 UNKNOWN (nothing missing, but a controlled requirement could not be read); 3 invalid input.
    • unknown never counts as satisfied.
    • Some requirements are owned elsewhere: anything marked controlled: false (the backfill queue), and anything listed under not_checked (Firestore indexes, owned by the index readiness gate). They are always reported, and the report says who owns them, but they never change the exit code.
    • --before <service> checks only the requirements due before that service moves.
    • The verdict prints the state's collected_at.
  • backend/scripts/activation_collect.py reads prod metadata only:

    • Cloud Run: only the revisions receiving traffic, from status.traffic, never the spec.
    • GKE: the Deployment template env, with ConfigMaps resolved, and the image digests of running pods.
    • Cloud Tasks queues and Scheduler jobs: one list call per location.

    Serving identity comes from the image: its OCI org.opencontainers.image.revision label, else its commit tag. The prod pusher digest is looked up in the dev registry it was promoted from. OMI_BACKEND_RELEASE_SHA is only recorded, as release_env: env merges never remove a value, so it can name a release the revision does not serve.

    The collector never reads Secrets and records only the env keys the manifest names. The checker's report prints key and runtime names, never values.

v3 requirements

Kind Requirement
Order 1. backend, backend-sync, backend-sync-backfill, backend-integration, desktop-backend → 2. llm-gateway → 3. pusher → 4. backend-listen → lever (CONVERSATIONS_V3_STAGE / CONVERSATIONS_V3)
Contains Writers (backend, backend-integration, backend-listen): #25500, #25588, #25658, #25661. Builder hosts (backend-sync, backend-sync-backfill): the same plus #25691. llm-gateway: #25500 (v3 lanes). pusher: #25500 (v3-aware finalization), #25658 (admission)
Gateway lanes omi:auto:conversation-v3-outline, -summary, -summary-open, omi:auto:conv-action-items
Env v3-task-binding: SYNC_TASKS_PROJECT/LOCATION/INVOKER_SA set and equal on the six writers.
v3-task-target: CONVERSATIONS_V3_TASKS_URL or SYNC_TASKS_HANDLER_URL.
v3-stage: CONVERSATIONS_V3_STAGE equal on the writers and desktop (code default beta for an absent key).
v3-kill-switch: CONVERSATIONS_V3 equal.
v3-gateway-endpoint: OMI_LLM_GATEWAY_URL on backend and backend-sync; the placeholders http://127.0.0.1:9 and :9080 count as unset
Queues conversations-v3 (controlled); conversations-v3-backfill (controlled: false)
Scheduler conversations-v3-sweep, conversations-v3-legacy-users (ENABLED)
Not checked Firestore composite indexes (index readiness gate)

How Release calls it (not in this PR)

Before each step of the train, and before a stage or kill-switch move:

  1. source ~/.local/bin/gcp-agent-env.sh ro-prod && git fetch origin.
  2. python3 backend/scripts/activation_collect.py --manifest backend/deploy/activation/<feature>.yaml --cluster prod-omi-gke --promoted-from-gcloud-config ~/.config/gcloud-agent/ro-dev --out state.json.
  3. python3 backend/scripts/activation_check.py --manifest … --state state.json --before <service|activate> --json.
  4. On exit 1, stop and name the missing requirements. On exit 2, a human reviews the unknowns. On exit 0, proceed.

Only controlled requirements affect the exit code, so the check trips only on signals the activation controls. The meta-repo train (omi-deploy-prod / train.sh) can call these two scripts from its release checkout; that wiring is a separate change.

Product invariants affected

none

How it was verified

  • backend/.venv/bin/python -m pytest -q backend/tests/unit/test_activation_manifest.py: 38 passed.

  • 2026-11-17 fixture (backend/tests/unit/fixtures/activation/state-2026-11-17.json): verdict=BLOCKED, exit 1, satisfied=63, missing=14, unknown=1. Missing:

    • stale gateway: service:llm-gateway:contains:012329830a9e, plus the three lanes lane:omi:auto:conversation-v3-outline / -summary / -summary-open;
    • old pusher image: service:pusher:contains:012329830a9e and :156b50921d7e;
    • pusher task binding: env:v3-task-binding:pusher:SYNC_TASKS_PROJECT and :SYNC_TASKS_LOCATION, with their two env-equal results;
    • infra: queue:conversations-v3, scheduler-job:conversations-v3-sweep, scheduler-job:conversations-v3-legacy-users;
    • the backfill queue (advisory).

    The one unknown is the advisory Firestore-index item. With --before backend-listen, the gateway, pusher and infra gaps still block, and listen's own 10 requirements are deferred.

  • Correct-state fixture (state-ready.json): verdict=READY, exit 0, satisfied=77, missing=0; the only unknown is the advisory Firestore-index item.

  • Current prod, collected 2026-11-18T19:24:59Z with the read-only ro-prod identity, plus ro-dev for the dev-registry tag only. Metadata reads only, no writes.

    • verdict=READY, exit 0: satisfied=77, missing=0, unknown=1 (advisory external:firestore-indexes).
    • All 9 services resolved to a source commit, all 4 lanes are served, all env requirements are met and equal, the conversations-v3 queue is RUNNING, and both v3 jobs are ENABLED.
    • The first manifest draft required fix(conversations-v3): short tasks stop sending json_object to a lane without structured output #25691 on backend-listen, and prod (listen serving 44d0a4f) reported it missing. Short-task extraction runs only on the sync task handler, so that requirement now applies to the builder hosts only.
  • scripts/pr-preflight --pr-body-file passed, and so did python3 .github/scripts/check_release_rings.py (the scope panel warned against reusing the forbidden "release ring" names).

Panels

  • Scope scope-20261118t174316-a7fd: only glm-flash completed; luna failed to launch (journal busy) and deepseek failed. Taken from it:

    • activation naming;
    • CLI and tests only, with no checks-manifest entry or cross-service invariant (check budget);
    • queue and scheduler ownership (ops_train, scheduler_reconcile);
    • keep the manifest from drifting away from runtime_env (handled by a drift test).

    Two of its claims were contradicted by live reads, and I resolved them that way:

    • It said OMI_BACKEND_RELEASE_SHA is the true marker. Image identity is used instead, per the documented env-merge misread.
    • It said prod pusher's digest has no live source. The dev-registry tag does resolve it.
  • Review review-20261118t185330-8905 (FIX-FIRST; deepseek and glm-flash; luna failed to launch):

    • Accepted and fixed in d204e36: F1, F4–F17.
    • F2/F3: the PR body first posted was another lane's (SCA-2966), because a scratch file was shared between sessions. It has been replaced with this one.

Tests

backend/tests/unit/test_activation_manifest.py covers:

  • Fixtures: each 11-17 escape is reported by name; the correct state passes.
  • Unknown handling: an unreadable service, ancestry or lanes gives UNKNOWN (exit 2), never satisfied; missing beats unknown; uncontrolled requirements never change the exit code; split traffic (every serving revision must contain the commit); an env-equal result with one unreadable unit is unknown.
  • Env values: stage skew, code defaults versus an explicit empty value, the placeholder URLs, any_of and Secret refs.
  • Order and input: order deferral; invalid YAML, manifest and state exit 3.
  • Collector, with fakes: reads status.traffic and never the spec; never reads Secrets; resolves ConfigMap and envFrom; resolves promoted digests; failed reads become unknown; pod digest counting; container choice; Registry.source (label, index, tag fallback, ambiguity); only Google registry hosts.
  • Drift: queue, job and lane names are parsed exactly from ops/prod.yaml, scheduler/jobs.yaml and generated_route_overrides.yaml. Every required env key is declared for each runtime in the composed prod runtime_env.yaml; this would have caught pusher's missing task binding at PR time.

UI evidence

UI-Evidence: none -- backend tooling, no UI

Failure class (fixes)

Failure-Class: none

🤖 Generated with Claude Code

Git-on-my-level and others added 3 commits November 19, 2026 01:10
…ersations-v3 first (SCA-2967)

A manifest declares what a lever move needs from live serving state: services with the commits
each must contain (ancestry), env keys set and equal across runtimes, gateway lanes, Cloud Tasks
queues, scheduler jobs, and the required move order. activation_collect.py reads prod metadata
read-only (status.traffic revisions, image source identity, GKE pods/ConfigMaps, queue and job
lists); activation_check.py is a pure manifest + state -> satisfied/missing/unknown verdict.
Unknown never counts as satisfied; requirements the activation does not own never change the exit.

The conversations-v3 manifest reproduces every 2026-11-17 activation escape on its fixture and
passes on a correct-state fixture. Not wired into any gate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…8t185330-8905)

- Invalid YAML or malformed state values exit 3 (invalid), not 1 (BLOCKED); the collector reports
  an invalid manifest cleanly.
- An explicit empty env value is compared as itself, not folded into the code default
  (CONVERSATIONS_V3_STAGE='' falls through to the cohort, not beta).
- env-equal is UNKNOWN when any serving unit of a runtime is unreadable.
- The verdict shows the state's collected_at.
- Collector: git merge-base and registry token failures become unknown; pods with unreadable
  digests are counted correctly; the app container is the named or port-bearing one; a malformed
  lanes file records lanes_error.
- The gateway code default http://127.0.0.1:9080 also counts as unset.
- Tests: Registry.source (label, index, tag fallback, ambiguity), exact YAML parsing in the
  drift test, defaulted keys checked against runtime_env.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Group running pods by image and their own environment evidence. Treat startup-resolved values as unknown when metadata cannot establish parity.

Co-authored-by: multica-agent <[email protected]>

Copy link
Copy Markdown
Member Author

SCA-3606 correction is verified locally at 9e3305406db944a8a467afdc35db1f40ff4585d0, based on the current PR head d204e36b61553d7d8c658395ac16ed1b456a2c8c. The collector now uses each running GKE pod’s own environment evidence. The mixed-generation regression covers pods with the same image digest. Literal stage skew blocks, and ConfigMap-backed values whose startup value cannot be proved report UNKNOWN. Collection uses read-only metadata and does not fetch Secret values.

On multica-worker-1 via bin/omi-heavy, all 40 focused tests and 37 repository preflight checks passed under bounded timeouts. Both new regression cases failed against the previous collector. The 2026-11-17 replay returned BLOCKED (exit 1) with 14 controlled failures, including three stale gateway lanes and missing pusher SYNC_TASKS_PROJECT and SYNC_TASKS_LOCATION.

Publication is blocked by this worker’s expired GitHub credential. The connected app uses a different commit author email from the configured address. The verified commit is preserved in a Git bundle on SCA-3606. Estimated publication is within one hour of restored write access. Round-two review and CI on the new PR head are pending publication. SCA-3022 remains held for round-two SHIP and green CI.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

GitHub now reports 9e3305406db944a8a467afdc35db1f40ff4585d0 as this PR’s head. This is the exact commit covered by the worker verification and incident replay. The worker reported 40 focused tests and 37 preflight checks passing. The 2026-11-17 replay returned BLOCKED for the expected stale gateway lanes and missing pusher task environment.

SCA-3022 remains out of merge admission pending an independent round-two SHIP and green CI on this SHA.

Copy link
Copy Markdown
Member Author

VERDICT: FIX — 9e33054 (round two)

The mixed-generation correction is sound: it uses each running pod’s own environment declarations and groups by image plus environment, so older pods cannot inherit the current Deployment template’s values. The focused activation suite passes locally (40/40).

P1 — ConfigMap-backed production requirements cannot establish READY. A read-only ro-prod collect/check on this head at 2026-11-21T18:29:30Z returned UNKNOWN with 0 missing requirements and 11 controlled unknowns (plus one advisory external unknown). Pusher and backend-listen evidence for task binding, task target, stage, and kill switch is unreadable at container startup. The production charts use ConfigMap-backed stage values, and production runtime config uses ConfigMap-backed task bindings. Although service ancestry, gateway lanes, queue, and scheduler checks pass, this wiring leaves no path to prove readiness. Keep the fail-closed behavior, but add sound per-pod evidence for allowlisted non-secret values or immutable/versioned config evidence that proves each pod’s startup configuration, while preserving mixed-generation separation.

Hosted CI is still running on this SHA. Keep SCA-3022 out of merge admission until the readiness gap is resolved and CI is green.

Git-on-my-level and others added 2 commits November 21, 2026 18:40
Allow Release to pin the conversations-v3 bindings per rollout with a reviewed Helm values layer. Verify the collector can prove the resulting pod values and continues to fail closed for legacy pods. Keep the runtime manifest drift test inside the fast-unit CPU budget.

Co-authored-by: multica-agent <[email protected]>
Preserve backend-listen Secret references and reject collisions with the non-secret startup allowlist.

Co-authored-by: multica-agent <[email protected]>

Copy link
Copy Markdown
Member Author

VERDICT: SHIP — 0a0bc6a (independent round two)

Reviewed the new chart support and the merge with main. Both pusher and backend-listen templates accept exactly the seven allowlisted values, require explicit literal strings, and place them in each pod template. The render tests verify the values override legacy ConfigMap bindings, while envFrom and all non-allowlisted env entries are preserved. Backend-listen rejects collisions with privateEnv and privateSecretEnv; Secret values stay in Secret Manager and the collector records only Secret references.

The same-digest mixed-generation cases behave correctly: pinned rendered pods can evaluate READY, while a legacy pod still serving yields UNKNOWN; literal skew blocks. The 2026-11-17 replay fixture remains BLOCKED for the expected stale gateway lanes and missing pusher task project/location. The shard-7 change uses PyYAML's LibYAML safe loader when available (SafeLoader fallback); locally the focused suite passes 46/46, and hosted Backend unit shard 7/8 is SUCCESS. CI currently has no unfinished or failing checks. git diff --check is clean.

This SHIP covers the checker/chart implementation. The rendered READY is pre-rollout evidence; live readiness still requires Release's approved configuration-only rollout through both production Helm paths and a post-convergence read-only ro-prod check.

Copy link
Copy Markdown
Member Author

SCA-3606 verification is complete at 0a0bc6abc5da7b36e0000faa92bc621f7c21332b. GitHub reports this commit as the current PR head. CI is green with 38 successful checks, 23 skipped, and zero failed or pending. The combined commit status is success. Backend unit shard 7/8 passed. CI checks · Independent round-two SHIP

On multica-worker-1 via bin/omi-heavy, 46 focused tests passed with the timing guard enabled and all 45 local preflight checks passed. The November 17 replay returned BLOCKED (exit 1) with 13 controlled failures, including the stale gateway lanes and missing pusher task project and location. The rendered-pod READY result is pre-rollout evidence. Live readiness still requires the approved configuration rollout for both workloads and post-convergence readback.

Require exact project, environment and feature identity before evaluating serving evidence. Collect only against the declared project, region and GKE cluster, and block reads using a conflicting target.

Co-authored-by: multica-agent <[email protected]>

Copy link
Copy Markdown
Member Author

VERDICT: SHIP — e75d91e (fresh independent review)

This fixes the identity false pass found on 0a0bc6a. The checker now requires state project, environment, and feature identity and compares each exactly with the manifest before evaluating serving evidence. Missing, malformed, or mismatched identity fails with exit 3; matching ready-state coverage still reaches READY.

The manifest requires its project, region, and (for GKE) cluster. Conflicting explicit --project, --region, or --cluster options are rejected before subprocess collection or output replacement. Collection uses manifest targets, checks programmatic project/region before reads, and isolates GKE credentials in a temporary kubeconfig instead of ambient KUBECONFIG.

Independent verification: focused activation tests pass 73/73; target-conflict regressions and identity regressions are included. The 2026-11-17 fixture remains BLOCKED for stale gateway lanes and missing pusher task bindings. git diff --check is clean.

Hosted CI has no failures but is still running on this SHA, so SCA-3022 must remain out of merge admission until CI is green and applicable source-merge approval is present.

Require the collector region and cluster to match the manifest in snapshots. Verify both production chart renders retain fail-closed startup evidence when mutable configuration references cannot establish what a container consumed.

Co-authored-by: multica-agent <[email protected]>

Copy link
Copy Markdown
Member Author

SCA-3606 addresses the 22:49 UTC finding at the current head 7fd60b136151c973e5219517c2d470803ed1c9b5. Snapshots now carry region and cluster. The checker rejects a missing or mismatched target with exit 3 before evaluating readiness. Both production chart renders retain UNKNOWN for legacy ConfigMap-backed pods whose startup values cannot be established.

On multica-worker-1 via bin/omi-heavy and the canonical backend/test.sh timing guard, all 87 focused tests passed. The November 17 replay was BLOCKED (exit 1), including stale gateway lanes and missing pusher task project and location. git diff --check passed. Fresh independent review has already been requested on SCA-2967. The latest GitHub readback showed 23 checks running and none failed. Hosted checks

Copy link
Copy Markdown
Member Author

SHIP — reviewed exact PR head 7fd60b136151c973e5219517c2d470803ed1c9b5.

  • Snapshot region is required and compared exactly; cluster is required in state (explicit null only for a clusterless manifest) and compared with the manifest. Unit coverage rejects missing/mismatched region and cluster, and conflicting collector targets fail before reads.
  • Both production Helm paths (pusher and backend-listen) render the legacy ConfigMap/envFrom bindings as UNKNOWN; literal seven-key pinned renders reach READY. A same-image mixed generation remains UNKNOWN. Secret bindings remain reference-only, and collection reads only Deployment and pods.
  • Local focused suite: 87 passed. The Nov 17 fixture replay is BLOCKED on the expected stale gateway lanes and pusher task bindings.

Hosted CI was still running at review time (13 checks in progress, no failures reported). This SHIP is code-review evidence only; merge admission remains held pending green CI and applicable authorization.

@Git-on-my-level
Git-on-my-level merged commit d014517 into main Nov 21, 2026
64 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/activation-manifest branch November 21, 2026 23:42
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