Skip to content

SCA-3804: restore release-floor and live preflight controls for bound Backend deploys - #26569

Merged
Git-on-my-level merged 3 commits into
mainfrom
agent/omi-control-opencode-deepseek/d18d71c48bcb
Nov 28, 2026
Merged

Git-on-my-level merged 3 commits into
mainfrom
agent/omi-control-opencode-deepseek/d18d71c48bcb

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

What changed and why

Scoped revert of the two #26499 hunks that weakened controls for bound multi-revision Backend deploys, per Release's R26 ruling on SCA-3804 (2026-11-28T02:48Z), plus the repair of Luna's two FIX-FIRST findings on this PR.

  1. Rollback release floor. cloud_run_split_canary.py restore-completed runs verify_backend_release_floor.py over every revision in the admitted inverse before it reads or replaces traffic; a below-floor target refuses the restore and leaves traffic untouched. --release-floor-check is required on both restore-completed and recover-run, and a refusal now carries the verifier's reason. Both rollback paths pass it: the in-workflow "Restore admitted inverse after a failed bound acceptance gate" step (after fetching current main, mirroring the non-bound snapshot restore) and the recover-bound-split recover-run job.
  2. Live preflight checks. "Validate backend runtime env after deploy" and "Report live Cloud Run env drift from manifest" run for bound multi-revision plans again; Preserve Backend traffic splits during Cloud Run image moves #26499 had skipped both whenever selected_split_binding != '' and the plan contained a split.

FIX-FIRST repair in this head:

  • Recovery checkout depth (blocking). The recover-bound-split job fetched main with --depth=1, so the floor verifier could not resolve an eligible historical revision (git cat-file rejects a commit outside the shallow history). The step now deepens with --unshallow before the restore, the same pattern the non-bound snapshot restore already uses. A regression test builds a two-commit history and shows the verifier refuses the floor commit from a depth-1 clone and admits it after --unshallow.
  • Env-changing split plans (major). The image-only candidate clones the donor template, so a plan whose inherited config cannot satisfy the source's manifest must not promote and then fail the live checks. stage_split_image.py --verify --expected-state now compares the candidate's inherited env (value and secret refs, release stamp excluded) against render_backend_runtime_env.py --state-output and refuses with split_plan_changes_runtime_env:<keys> before promotion. Both live checks stay enabled for compatible plans.
  • The floor flag is mandatory in the CLI, refusal reasons are preserved, and tests cover the recovery fetch depth, main-level floor wiring and the env guard.

Not reverted: the split routing itself, candidate staging, receipt custody, and the capture-time exemption from --expected-serving-revision (a single-admitted-serving precondition that cannot hold for a split and is not the rollback floor check).

Product invariants affected

  • INV-DATA-1

How it was verified

  • check-gcp-backend-production-boundary.py passes, including the bound-restore rollback-coverage clause.
  • restore_completed refuses without reading or replacing traffic when the floor rejects a target; release_floor checks every target, carries the verifier's stderr and fails closed; both CLI verbs reject a missing --release-floor-check.
  • Synthetic history reproduction: depth-1 clone rejects the eligible floor commit at git cat-file; git fetch --unshallow makes the same verifier admit it.
  • require_inherited_env accepts a matching plan and refuses value changes, added/removed keys, secret-version changes and a missing rendered state.
  • Backend unit tests are left to CI (SCA-2134 placement: this host does not run backend suites).

Tests

backend/tests/unit/test_split_release_controls.py covers the floor refusal, per-revision floor check, required CLI flag, recovery fetch depth/order and preflight exemption assertions. backend/tests/unit/test_stage_split_image.py covers the env-changing plan guard.

… Backend deploys

Scoped revert of the two #26499 hunks that weakened controls for bound
multi-revision Backend deploys:

- The bound rollback path (restore-completed and the recover-run recovery
  route) now runs the published backend release floor over every revision
  in the admitted inverse before it moves traffic, and refuses the restore
  when any target is below the floor.
- The live runtime-env validation and live Cloud Run env drift report run
  for bound multi-revision plans again instead of being skipped.
@Git-on-my-level

Copy link
Copy Markdown
Member Author

DESIGN: scoped revert of the two #26499 bound-deploy control regressions, at 73c9a4861857431acc21d42611253a7787455d7b.

Decision record: Release's R26 ruling on SCA-3804 (2026-11-28T02:48Z) chose revert over fix-forward and named the two controls to restore. This PR implements exactly that; it adds no new deploy route and keeps the configured release hold.

Controls restored:

  1. Rollback release floor for bound runs — restore-completed and recover-run run verify_backend_release_floor.py over every revision in the admitted inverse before any traffic read or replace, and refuse the restore on a below-floor target. The workflow fetches current main first so the check reads the published floor, mirroring the non-bound snapshot restore.
  2. Both live preflight checks (runtime-env validation, live env drift report) for bound multi-revision plans, instead of skipping them.

Deliberately unchanged: split routing, candidate staging, receipt custody, and the capture-time --expected-serving-revision exemption (a single-admitted-serving precondition that cannot hold for a split; it is not the rollback floor check).

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T03:54:24.998609Z 7c47b8a 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: 73c9a48618

ℹ️ 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 thread .github/workflows/gcp_backend.yml Outdated
Comment on lines +1615 to +1617
git fetch --no-tags --depth=1 \
"https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" \
+refs/heads/main:refs/remotes/origin/main

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 Fetch complete history before checking recovery targets

In the recover-bound-split job, the checkout is shallow and this fetch retains only the main tip, so a previously deployed inverse revision's release SHA will normally be absent locally. verify_backend_release_floor.py requires both git cat-file -t <sha> and git merge-base --is-ancestor <floor> <sha> to succeed; consequently, even floor-qualified rollback revisions are rejected before traffic can be restored, leaving the failed promotion serving. Fetch complete history here, as the in-workflow restore already does. The local git fetch -h documents --unshallow as “convert to a complete repository”; a local depth-one reproduction confirmed that the current fetch leaves older target commits unavailable.

Useful? React with 👍 / 👎.

…t plans

FIX-FIRST from the panel review at 73c9a48:

- recover-bound-split deepens history with --unshallow before the floor
  check. A depth-1 checkout cannot resolve an eligible historical revision
  (git cat-file rejects it), so the recovery rollback would have refused
  every legitimate restore.
- stage_split_image --verify --expected-state compares the candidate's
  inherited env and secret refs against the source's rendered state and
  refuses env-changing split plans before promotion, instead of leaving the
  live checks to fail after staging. Both live checks stay enabled.
- --release-floor-check is required on restore-completed and recover-run,
  and the verifier's refusal reason is preserved.

Regression tests cover the shallow-history reproduction, the required
flag, the stderr reason and the env-change refusals.
@Git-on-my-level

Copy link
Copy Markdown
Member Author

FIX-FIRST repair pushed at 7c47b8a21f9660c40b01dfd6c361b59ed3d8cf03.

Blocking — recovery history. The recover-bound-split job now deepens the immutable checkout with git fetch --unshallow before the floor check instead of --depth=1. Regression test test_recovery_checkout_needs_history_to_resolve_an_eligible_release builds a two-commit history, clones it depth-1, and shows the verifier refusing the eligible floor commit at git cat-file and admitting it after --unshallow; a workflow contract assertion pins the unshallow before the restore and forbids --depth in that step.

Major — env-changing split plans. stage_split_image.py --verify now takes --expected-state (the render_backend_runtime_env.py --state-output file) and compares the candidate's inherited env values and secret refs, excluding the release stamp, against the manifest render. It refuses with split_plan_changes_runtime_env:<keys> before promotion, so both live checks stay enabled for compatible plans and incompatible ones never reach the deploy. Tests cover value changes, added/removed keys, secret-version changes and a missing rendered state.

Also: --release-floor-check is now required on both restore-completed and recover-run, the verifier's stderr reason is kept in the refusal, and tests cover the required flag and the main-level wiring.

Local pre-push gate at this head: backend unit selection 648 passed / 0 failed (both changed test files included), backend typecheck passed, production-boundary check passed. CI is running; no local backend run beyond the push gate.

@Git-on-my-level
Git-on-my-level merged commit 0c0d83a into main Nov 28, 2026
72 checks passed
@Git-on-my-level
Git-on-my-level deleted the agent/omi-control-opencode-deepseek/d18d71c48bcb branch November 28, 2026 07: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