Skip to content

feat(staging): lane 2 bootstrap, isolation fence, overlay, deploy.sh (contract (i)) - #22432

Merged
Git-on-my-level merged 13 commits into
integration/legacy-retirefrom
lr/02-staging
Oct 19, 2026
Merged

Git-on-my-level merged 13 commits into
integration/legacy-retirefrom
lr/02-staging

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Summary

Lane 2 (staging builder), M1 slice of contract (i) (omi-knowledge-base projects/backend-target-architecture/contracts.md). Targets integration/legacy-retire.

  • backend/deploy/staging/bootstrap_iam.sh: a one-time, human-tier script that David runs (decision S1). It runs as a dry run by default, takes --apply / --verify, and --rollback --apply undoes it. It creates the staging-* service accounts, the named Firestore DB staging, the staging buckets, the AR repo, and the staging-* secrets (random, or copies of dev's test keys; payloads are never printed). It also makes staging-scoped grants, sets up GKE namespace RBAC, adds the in-cluster Redis password secret (S2), and puts an IAM deny policy on based-hardware.
  • backend/deploy/staging/create_queues.sh: creates the nine staging-* Cloud Tasks queues on dev-operator. They were already applied in based-hardware-dev.
  • backend/utils/staging_fence.py: assert_staging_isolation(). A process with OMI_DEPLOYMENT=staging refuses to start if its env reaches prod. It checks project ids, the database, the Firebase auth project and signer, the Redis host, committed sha256 hashes of prod identifiers, and any based-hardware (non -dev) reference. It counts omi_staging_fence_total{reason}.
  • backend/deploy/runtime_env/staging.overlay.yaml + compose_runtime_env.py --env staging: staging = composed prod + allowlisted transforms (names, identity, network, env, queues, secrets). It composes to a separate file; runtime_env.yaml is unchanged. Any prod-pointing value fails compose via the fence.
  • backend/scripts/cross_service_checks/staging.py: invariant staging-mirrors-prod + STAGING_DIFF_ALLOWLIST (lane 1 registers it). It reports 0 differences on this tree.
  • backend/deploy/staging/deploy.sh (+ render_cloud_run.py, cloudbuild.yaml, redis.yaml) runs these steps in order:
    • takes the GCS lock;
    • makes a git archive of the integration SHA;
    • runs the fence tests and the mirror check on that tree;
    • brings up in-cluster Redis (S2);
    • builds with Cloud Build as staging-builder;
    • does a declarative gcloud run deploy;
    • verifies the serving revision's env, including OMI_BACKEND_RELEASE_SHA and OMI_RELEASE_TREE.
  • backend/database/_client.py (_firestore_database_id only): runs the fence before any Firestore client is built. It allows FIRESTORE_DATABASE_ID=staging only for staging in based-hardware-dev. No behaviour change outside staging: the rejection of other named DBs is unchanged.

Product invariants affected

  • INV-DATA-1: unchanged for prod and dev. This change does not alter the Firebase/Firestore project or serving endpoints of any existing deployment. database/_client.py additionally allows the named DB staging only when OMI_DEPLOYMENT=staging and the client project is based-hardware-dev, and the staging fence refuses any staging process that points at prod.

Failure class

Failure-Class: none

(d0c7eef fixes a one-off bug in the new bootstrap script: a RETURN trap referenced a local under set -u. It is not a recurring class.)

Verification

  • pytest tests/unit/test_staging_fence.py tests/unit/test_staging_overlay.py: 33 passed (unit; one negative case per fence bullet in contract (i), plus the _client allowance).
  • pytest tests/unit/test_data_plane_firestore_client.py tests/unit/test_keyless_runtime_identity.py: passed (unit).
  • shellcheck -S warning is clean on both scripts. I reviewed the dry run of bootstrap and rollback.

🤖 Generated with Claude Code

Git-on-my-level and others added 6 commits October 19, 2026 13:15
…t (i), S1)

bootstrap_iam.sh: one-time David-run script creating staging-* SAs, the
named Firestore DB, staging buckets, AR repo, staging-* secrets (random or
copied from dev test keys, payloads never printed), staging-scoped grants,
GKE namespace RBAC, optional Memorystore (S2), and an IAM deny policy on
based-hardware. Dry run by default; --rollback --apply undoes it.

create_queues.sh: dev-operator creation of the nine staging-* Cloud Tasks
queues.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
David chose in-cluster Redis (StatefulSet in namespace staging). Bootstrap
now generates staging-redis-password, writes it to the k8s Secret
staging/staging-redis, and grants agent-dev-operator compute.networkUser
on the dev subnet so staging Cloud Run reaches Redis by Direct VPC egress.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
utils/staging_fence.assert_staging_isolation() refuses to start a process
with OMI_DEPLOYMENT=staging whose env reaches prod: project ids, database,
Firebase auth project and signer, non-private Redis host, committed sha256
hashes of prod data-plane identifiers, and any based-hardware (non -dev)
reference. Counts omi_staging_fence_total{reason}; never logs values.

database/_client.py runs the fence before building any Firestore client and
allows FIRESTORE_DATABASE_ID=staging only for staging in based-hardware-dev.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- runtime_env/staging.overlay.yaml: staging = composed prod + allowlisted
  transforms (service names, identity, network, env_all, queue_map,
  secret_map). compose_runtime_env.py --env staging composes it to a
  separate file (runtime_env.yaml unchanged) and runs the staging fence
  over every service's env; any prod-pointing value fails compose.
- scripts/cross_service_checks/staging.py: invariant staging-mirrors-prod
  with STAGING_DIFF_ALLOWLIST (registered by lane 1).
- deploy/staging/deploy.sh: GCS lock, git-archive of the integration SHA,
  fence tests + mirror check on that tree, in-cluster Redis (S2), Cloud
  Build as staging-builder, declarative gcloud run deploy, serving verify
  of OMI_BACKEND_RELEASE_SHA / OMI_RELEASE_TREE. Plus render_cloud_run.py,
  cloudbuild.yaml, redis.yaml; staging-account-deletion queue; builder
  read on the gcr.io base-image repo.
- staging_fence: pyright fixes; prod project number in the reference rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Load runtime_env YAML with libyaml's SafeLoader when available (output
unchanged; compose --check passes), compose only prod in the
staging-mirrors-prod check, and import database._client at collection.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
agent-dev-operator gets secret-level secretAccessor on
staging-encryption-secret (mirror re-encryption) and staging-admin-key
(synthetic-user replay) only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level marked this pull request as ready for review October 19, 2026 07:50
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T09:04:46.916187Z 0648dbb New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 18646130c7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +369 to +374
echo "== Cloud Tasks queue access (queues come from create_queues.sh, run first on dev-operator)"
if [[ "$MODE" == apply ]]; then
while IFS= read -r queue; do
[[ "$queue" == staging-* ]] || continue
for role in roles/cloudtasks.enqueuer roles/cloudtasks.viewer; do
gcloud tasks queues add-iam-policy-binding "$queue" --location="$REGION" --project="$DEV" \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Grant queue IAM after creating the queues

When bootstrap runs before create_queues.sh as instructed at the end of this script, this loop sees no staging-* queues and grants the runtime service account nothing; create_queues.sh subsequently creates the queues but adds no IAM bindings. The deployed services will therefore receive PERMISSION_DENIED when enqueueing sync, finalization, audio-merge, or account-deletion tasks until someone happens to rerun bootstrap. Move the grants into queue creation or explicitly rerun/apply them afterward.

AGENTS.md reference: backend/AGENTS.md:L145-L145

Useful? React with 👍 / 👎.

Comment on lines +125 to +128
for name in sorted(set(s_secrets)):
secret = str((s_secrets[name] or {}).get('secret', ''))
if not secret.startswith(STAGING_SECRET_PREFIX):
problems.append((service, name, 'staging secret binding is not a staging-* secret'))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject unallowlisted secret bindings dropped from staging

This loop checks only secrets that survived into staging and never compares p_secrets - s_secrets. Consequently, deleting or misspelling any secret_map entry silently drops the production binding during composition while staging_diff() still returns no violation, so the claimed mirror check can approve a revision missing required credentials. Compare both secret-name sets and require dropped secrets to appear in an explicit allowlist.

AGENTS.md reference: backend/AGENTS.md:L153-L153

Useful? React with 👍 / 👎.

Comment on lines +141 to +143
from utils.staging_fence import STAGING_DATABASE, STAGING_PROJECT, assert_staging_isolation, is_staging

assert_staging_isolation()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Run the staging fence before importing service clients

The only process-environment assertion is reached through _firestore_database_id(), so it is not a boot-time fence: main.py imports routers that import database.redis_db, whose global Redis client is constructed before any Firestore getter calls this function, and GCS paths are likewise unguarded. With a drifted staging revision, the process can become ready and access a production-pointing Redis or bucket before Firestore happens to trigger the check; invoke the fence immediately after environment loading in each serving entrypoint instead of only here.

Useful? React with 👍 / 👎.

Comment on lines +139 to +144
def check_staging_mirrors_prod(ctx: Any) -> list[Any]:
"""Cross-service-contract entry point: one Violation per non-allowlisted staging/prod difference."""
from scripts.cross_service_contract import Violation

root = Path(getattr(ctx.source, 'root'))
return [Violation(INVARIANT, 'staging', f'{scope}/{name}', problem) for scope, name, problem in staging_diff(root)]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Register the staging invariant with the contract runner

This entry point is never imported or added to cross_service_contract.INVARIANTS (the tuple at backend/scripts/cross_service_contract.py:1278-1290 remains unchanged), and a repo-wide search finds only the manual staging deploy invoking the standalone script. As a result, normal cross-service validation does not catch a prod manifest change that makes staging diverge; the problem is discovered only when someone later attempts a staging deployment. Register this check with the shared runner as the module documentation claims.

AGENTS.md reference: backend/AGENTS.md:L153-L153

Useful? React with 👍 / 👎.

Comment on lines +262 to +264
for svc in "${DENY_SERVICES[@]}"; do
perms+="\"${svc}/*\","
done

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Generate valid IAM deny permission groups

The generated values such as datastore.googleapis.com/* are not valid IAM v2 permissions or permission groups, so gcloud iam policies create rejects the policy and the script merely emits its warning, leaving the advertised production deny fence absent. Google documents whole-service permission groups in the form SERVICE_FQDN/*.* and ordinary permissions as SERVICE_FQDN/RESOURCE.ACTION; generate supported groups or enumerate supported permissions instead. See Google Cloud's deny-policy format.

Useful? React with 👍 / 👎.

Comment on lines +87 to +90
DEV_COPY_SECRETS=(
OPENAI_API_KEY ANTHROPIC_API_KEY GEMINI_API_KEY OPENROUTER_API_KEY GROQ_API_KEY
DEEPGRAM_API_KEY SONIOX_API_KEY HUGGINGFACE_TOKEN FIREBASE_API_KEY STT_SERVICE_MODELS
MODULATE_API_KEY

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep STT_SERVICE_MODELS out of the secret copy list

The checked-in dev runtime and ExternalSecret manifests define STT_SERVICE_MODELS as a literal config value, not a Secret Manager source, but this list attempts to copy a same-named dev secret. On a project matching those manifests, copy_dev_secret leaves staging-stt-service-models without a version; the staging overlay then binds that secret at latest to every Cloud Run service through secret_add, preventing their revisions from deploying or starting. Render the literal model list as an environment value instead of requiring a secret version.

Useful? React with 👍 / 👎.

Comment on lines +383 to +385
echo "== task/scheduler invoker: staging-tasks-invoker"
project_binding "$inv" roles/run.invoker \
"resource.name.endsWith(\"-staging\")" "staging-services-only"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Bind Cloud Run roles on the staging services

The project-level resource.name.endsWith("-staging") condition does not grant access to Cloud Run resources: Cloud Run is absent from the resource types that expose the resource.name IAM-condition attribute, and its documented conditional invocation attributes are request.host and request.path. Consequently this binding does not let staging-tasks-invoker invoke task targets, and the identical condition at lines 399-400 does not let the agent deploy or administer the services. Create service-level role bindings after each *-staging service exists instead. See Cloud Run IAM conditions.

AGENTS.md reference: backend/AGENTS.md:L145-L145

Useful? React with 👍 / 👎.

Comment on lines +331 to +334
project_binding "$rt" roles/datastore.user \
"resource.name == \"projects/${DEV}/databases/${DB}\"" "staging-db-only"
for role in roles/logging.logWriter roles/monitoring.metricWriter roles/cloudtrace.agent roles/aiplatform.user; do
project_binding "$rt" "$role"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Grant the runtime Firebase Auth permissions

The newly created staging-runtime account receives Firestore, telemetry, Vertex, storage, task, and signing roles here, but no Firebase Authentication role. The backend initializes the Admin SDK with this attached identity and serving paths call auth.get_user, update_user, and delete_user; those operations require permissions such as firebaseauth.users.get and firebaseauth.users.delete, so staging authentication flows and the account-deletion wipe will fail with insufficient permission. Grant an appropriately scoped Firebase Authentication role or custom role; the required permissions are listed in Google Cloud's Firebase Authentication role reference.

Useful? React with 👍 / 👎.

Comment on lines +15 to +17
- id: push-backend
name: gcr.io/cloud-builders/docker
args: [push, '${_REPO}/backend:${_SHA}']

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Smoke-test staging images before publishing them

The staging build pushes the backend image immediately after docker build, and the optional worker follows the same build-and-push pattern without running its registered runtime-image smoke test. A missing dependency or broken entrypoint can therefore be published and handed directly to gcloud run deploy, instead of being rejected before publication as required for deployed Python images. Add the registry-driven smoke step before either push.

AGENTS.md reference: backend/AGENTS.md:L217-L217

Useful? React with 👍 / 👎.

Git-on-my-level and others added 3 commits October 19, 2026 15:09
…heduling

- charts/batch-pipeline-worker/staging_omi_batch-pipeline-worker_values.yaml:
  prod worker settings, staging image/SA/bucket/data plane, 2 replicas on
  parakeet-pool (never engine-pool).
- deploy/staging/worker_post_render.py: adds the staging identity and fence
  env to the shared chart's worker container (no chart edit).
- deploy.sh --with-worker: helm template + post-render + kubectl apply,
  rollout wait, release annotations; --teardown removes the worker.
- bootstrap_iam.sh: k8s secret staging/staging-batch-worker and worker
  accessor on staging-huggingface-token.
- redis.yaml: drop the default-pool selector (pool at max size).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The agent can write objects in the staging bucket but cannot read bucket
metadata, which 'builds submit <dir>' needs. deploy.sh uploads the git
archive and the build's first step fetches it as staging-builder.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e1c0faf0ee

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

the staging isolation fence runs first, so a staging process pointed at prod
never gets this far.
"""
from utils.staging_fence import STAGING_DATABASE, STAGING_PROJECT, assert_staging_isolation, is_staging

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Move the staging-fence import to module scope

Move this new import to module scope. The backend guide requires all imports to be top-level, and database/ is explicitly allowed to depend on utils/; keeping it inside _firestore_database_id() violates the repository's import convention on every Firestore-client construction path.

AGENTS.md reference: backend/AGENTS.md:L163-L169

Useful? React with 👍 / 👎.

Comment on lines +100 to +101
if [[ "$LOCK_HELD" == 1 ]]; then
gcloud storage rm "$LOCK" --quiet >/dev/null 2>&1 || echo "WARN: could not release $LOCK" >&2

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Delete only the acquired lock generation

When one deployment uses --break-lock while the previous process is still alive, the previous process's EXIT cleanup unconditionally deletes the replacement process's lock, allowing a third deployment to start concurrently. Record the generation created during acquisition and release it with --if-generation-match; that precondition is supported by gcloud storage rm and prevents an old holder from deleting a newer lock object.

Useful? React with 👍 / 👎.

tail -20 "$WORK/fence-tests.log" >&2
die "staging fence tests failed on $SHORT"
}
(cd "$WORK/src/backend" && "$PY" scripts/cross_service_checks/staging.py) || die "staging-mirrors-prod failed on $SHORT"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Gate staging deploys on named-database index readiness

Before advancing from these source checks to the build, verify that based-hardware-dev/staging has the admitted SHA's Firestore indexes READY. Bootstrap creates this named database from scratch, but a repo-wide search of the staging deployment files finds no invocation of the canonical reconciler for it; the checked-in manifest currently declares 198 composite indexes and 23 field overrides, so indexed serving queries can fail with FAILED_PRECONDITION while this deployment still reports success. Run the repository readiness check with --database=staging and require provisioning through the canonical index lane before rollout.

Useful? React with 👍 / 👎.

Comment on lines 254 to +255
data_plane_project = os.environ.get("OMI_FIRESTORE_DATA_PLANE_PROJECT", "").strip()
database = _firestore_database_id()
database = _firestore_database_id(data_plane_project or None)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve the staging project in the data-plane fallback

When the staging overlay is used, FIRESTORE_DATABASE_ID=staging is set but OMI_FIRESTORE_DATA_PLANE_PROJECT is absent, so every get_data_plane_firestore_client() call reaches this line with data_plane_project == '' and invokes _firestore_database_id(None) before the fallback at line 256. The new named-database guard rejects None, causing user/profile, batch-pipeline, memory, and account-deletion paths to raise RuntimeError instead of reusing the main staging Firestore client; handle the empty-project fallback first or pass the effective staging project.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0648dbb77f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# Public API surface takes Firebase-token auth like prod's backend; task targets are IAM-only
# (staging-tasks-invoker holds run.invoker on *-staging).
auth_flag() {
[[ "$1" == backend ]] && echo --allow-unauthenticated || echo --no-allow-unauthenticated

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Allow client-authenticated access to staging sync admission

When the staging replay or a client submits /v2/sync-local-files, backend/scripts/staging/replay.py targets backend-sync-staging and supplies an application-level ADMIN_KEY bearer rather than a Google IAM identity token. Applying --no-allow-unauthenticated here makes Cloud Run reject that request before FastAPI can validate the admin/Firebase credential, so the staging replay and client-like sync admission cannot run. Keep backend-sync-staging publicly invokable at the Cloud Run layer while retaining the route's application authentication.

AGENTS.md reference: backend/AGENTS.md:L145-L145

Useful? React with 👍 / 👎.

Comment on lines +352 to +353
for role in roles/logging.logWriter roles/monitoring.metricWriter; do
project_binding "$wk" "$role"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Grant staging-worker access to the staging Firestore database

When deployment uses --with-worker, diarizer.batch_pipeline_runtime constructs a FirestoreStore with get_data_plane_firestore_client(), but this worker identity receives only logging and monitoring project roles here, plus storage roles below. Its first queue/store operation against the named staging database therefore fails with PERMISSION_DENIED, preventing the GPU worker from draining admitted work. Grant staging-worker the same database-scoped roles/datastore.user access used for the runtime identity.

Useful? React with 👍 / 👎.

Comment on lines +63 to +65
BATCH_PIPELINE_API_URL: '{run_url:backend-sync}'
BATCH_PIPELINE_RECOVERY_TASK_AUDIENCE: '{run_url:backend-integration}'
BATCH_PIPELINE_WORKER_AUDIENCE: '{run_url:backend-sync}'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Override production STT endpoints in the staging overlay

When staging executes prerecorded or final-pass transcription, this override block replaces the batch service URLs but leaves the inherited production values HOSTED_PARAKEET_API_URL=http://parakeet.omi.me and HOSTED_{SPEAKER_EMBEDDING,DIARIZATION}_API_URL=http://172.16.160.20/... intact. Repository deployment documentation identifies those as the production Parakeet host and production internal-gateway VIP, so staging either consumes production capacity or times out trying to reach a production-only private address from the dev VPC. Override these with staging/dev endpoints or disable the affected paths.

AGENTS.md reference: backend/AGENTS.md:L142-L142

Useful? React with 👍 / 👎.

Comment on lines +129 to +132
p_flags = {str(k): v for k, v in (p_cfg.get('flags') or {}).items()}
s_flags = {str(k): v for k, v in (s_cfg.get('flags') or {}).items()}
for flag in sorted(set(p_flags) | set(s_flags)):
if p_flags.get(flag) != s_flags.get(flag) and not _allowed(flag, STAGING_FLAG_ALLOWLIST):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include shared network flags in the staging mirror check

When cloud_run.network_flags gains an accidental non-allowlisted option, this comparison never examines it: compose_staging() stores those values under cloud_run.network.flags, while the loop reads only each service's p_cfg['flags'] and s_cfg['flags']. Consequently staging-mirrors-prod can report a clean mirror despite an arbitrary shared Cloud Run flag difference; compare the top-level network flags as well, or merge them into each service before applying STAGING_FLAG_ALLOWLIST.

AGENTS.md reference: backend/AGENTS.md:L153-L153

Useful? React with 👍 / 👎.

SYNC_BACKFILL_TASKS_OIDC_AUDIENCE: '{run_url:backend-sync-backfill}/v2/sync-jobs/run'
BUCKET_FRAME_REQUESTS: based-hardware-dev-staging-batch
BUCKET_FRAME_REQUESTS_TEMPORARY: based-hardware-dev-staging-batch
OMI_LLM_GATEWAY_URL: 'http://127.0.0.1:9'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Point staging at a working LLM gateway

When staging exercises any company-paid LLM feature, it inherits the production gateway modes but this override sends the gateway client to localhost port 9. get_llm() always routes non-BYOK managed generation through that client, so chat, summarization, and memory-generation requests fail to connect instead of exercising the production-shaped path. Deploy or reference a staging gateway and require its readiness probe before rolling out these revisions.

AGENTS.md reference: backend/AGENTS.md:L153-L153

Useful? React with 👍 / 👎.

@Git-on-my-level
Git-on-my-level merged commit 305b62f into integration/legacy-retire Oct 19, 2026
24 checks passed
@Git-on-my-level
Git-on-my-level deleted the lr/02-staging branch October 19, 2026 09:12
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