Skip to content

toil killers: skip duplicated pre-push for CI-green SHAs; persist ops env in prod manifest - #22978

Merged
Git-on-my-level merged 8 commits into
mainfrom
lane/toil-killers
Oct 21, 2026
Merged

Git-on-my-level merged 8 commits into
mainfrom
lane/toil-killers

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Summary

Two toil killers from the two-lane rollout (P12, toil-killers).

1. Pre-push: skip the duplicated local suite for CI-green exact SHAs. Fast-forwarding a branch to a SHA that GitHub CI already certified re-ran the whole local pre-push suite against an unchanged tree. That cost about 55 minutes on sync 14 and again on sync 15. scripts/pre-push now calls scripts/pre_push_ci_verified.py right after reading the pushed refs, and exits early only when every pushed SHA meets all of these:

  • GitHub returns that exact commit, and its tree equals the local tree.
  • At least one push or merge_group run on that SHA concluded success. Those are the only runs that check out the commit itself. A pull_request run tests the PR merge ref, whose tree differs whenever the branch is behind main.
  • Every push, merge_group, pull_request and default-CodeQL (dynamic) run on it is terminal and concluded success or skipped. pull_request_target runs, which check out the base, are ignored.
  • If it has any commit statuses, their combined state is success.

In practice the skip applies to fast-forwards onto a main commit whose push CI has settled. A PR head that only has pull_request runs always runs the full suite.

Deployment writers (the LOCK_CONTRACTS registry in check-deployment-concurrency.py, fetched from the push remote's main on GitHub, never from a local file or ref) neither certify nor block. On main they sit parked behind their lock or get cancelled by a newer push, and that says nothing about the commit.

This is not a skip hatch. The check reads no environment variable. It fails closed on any error, timeout, unknown SHA, non-GitHub remote or unparseable answer, and then the full suite runs. Every verdict is printed and appended to <git-common-dir>/omi-pre-push-ci-verified.log. The hook lives in scripts/; nothing under .github/workflows changes. The new test goes in .github/scripts/, registered in .github/checks-manifest.yaml, next to its sibling test_pre_push_ci_prediction.py.

2. Ops-env drift after every Cloud Run train. The prod overlay pinned old values for keys the lead hand-sets live, so every train reset them and they were restored by hand. The train logs (ops_env.py restore … drifted:) and a ro-prod read of the live services agree on the set. The overlay now records today's live values (values only, no secrets, no allowlists):

key service(s) was in manifest live / now
BATCH_PIPELINE_SPEECH_EMPTY_MULTILINGUAL_ENABLED backend, backend-sync, backend-sync-backfill false true (integration was already true)
SUMMARY_DEBT_REPAIR_ENABLED backend-sync true false
BATCH_PIPELINE_RECOVERY_ALL_ADMITTED backend-integration false true

After the change, a ro-prod diff of live env against the regenerated manifest shows no remaining value differences for the ops prefixes ops_env.py covers. Live-only keys (allowlists, FIRST_SUMMARY_DEADLINE_SECONDS, SYNC_ASSIGNMENT_RECOVERY_ENABLED) are not in the manifest, so deploys preserve them. They were never reset and are left alone.

The deploy-time assertion lives in render_backend_runtime_env.py, which the deploy action already runs before every Cloud Run deploy. Before emitting any output, it parses each service's and job's rendered env_vars text back through deploy-cloudrun's escape grammar. It fails the deploy if a manifest key is missing, duplicated or changed, or if it is also named in that service's --remove-env-vars set. Unset provisional keys keep their documented preserve-live omission.

test_summary_production_policy.py pinned SUMMARY_DEBT_REPAIR_ENABLED=true (#22172). It now pins the live false, with a comment. The rollout lead was notified on the bus before merge.

Lane / contract

P12 toil-killers (two-lane rollout swarm). Owner sign-offs for edits to other lanes' files: none.

Product invariants affected

  • INV-MEM-4: path match only. backend/deploy/runtime_env* is the production runtime manifest; no memory admission behaviour changes.

Verification

  • .github/scripts/test_pre_push_ci_verified.py: 25 tests pass, at two layers. Unit tests cover green, unknown, red, neutral, in-progress, pull_request-blocks-but-never-certifies, CodeQL dynamic, pull_request_target, wrong commit payload, deploy-writer, unreadable registry, tree-mismatch, commit-status, multi-SHA, unreachable and unexpected-error verdicts. Hook-level tests run the real scripts/pre-push in a fixture repo with a fake gh: a green exact SHA ends the hook before check selection; unknown, red and unreachable reach the full suite; env vars cannot force the skip.
  • Live, read-only gh api against BasedHardware/omi:
    • e6877adc9f06 (settled main head): verified, 8 successful push runs, tree matches, about 4s.
    • The current main head 34b3396cc208: not verified while its CodeQL dynamic run is still queued.
    • origin/main~6: not verified, because Repo Checks was cancelled.
    • An older SHA: not verified, no CI run on that exact SHA.
  • Backend: 49 runtime-manifest, renderer and registry test files through backend/test.sh (nice -n 19, omi-heavy). All pass, including 7 new renderer tests: every dev/prod Cloud Run service and job renders every manifest key, escape round-trip, missing / changed / duplicated / stray / removed keys fail, provisional omission allowed, and a full --env prod render emits nothing on failure.
  • compose_runtime_env.py and render_feature_flag_registry.py were regenerated. PR preflight passed.
  • Not run: the full backend suite (the selector widens to 2,092 files for overlay changes; CI runs it), and a real deploy (out of scope; the lead trains it).

Review response (Grok, FIX-FIRST on e9a6ab2b)

  • Blocker, pull_request/pull_request_target certify a tree they did not run. Fixed: only push/merge_group successes certify. pull_request blocks, pull_request_target is ignored, and neutral is no longer green.
  • Blocker, red CodeQL (dynamic) did not block. Fixed: a dynamic run blocks when non-terminal or red, and never certifies.
  • Major, PRE_PUSH_BASE_* could widen the ignore set. Fixed: the registry is fetched from GitHub main via gh api …/contents. On any failure it is empty, so deploy runs are judged as CI. --registry-ref is gone. The commit payload must now also carry the requested SHA.
  • Minor, the job removal set was only forbidden_env. Fixed: job renders also pass their own --remove-env-vars flag. Not done: moving gcp_notifications_job.yml's hardcoded removal list onto the job's manifest flags, because it needs a .github/workflows edit, which David must name. No key in that list is in the notifications job env today. desktop_backend stays outside the assertion; its env keys don't intersect its workflow's removal list today.
  • Minor, docs said debt repair is on in prod. Fixed: config/feature-flags.yaml summary (registry regenerated), runbooks/summary-guarantee.md and listen_pusher_pipeline.mdx now say it is held off (deferred 2026-10-20).

Rollback

Revert the PR. For the pre-push skip alone, revert scripts/pre-push's new block. For one ops value, flip it in backend/deploy/runtime_env/prod.overlay.yaml and regenerate.

Failure-Class: none

🤖 Generated with Claude Code

Git-on-my-level and others added 3 commits October 21, 2026 11:38
Fast-forwarding a branch to a SHA that GitHub CI already certified re-ran
the whole local pre-push suite against an unchanged tree (about 55 minutes
on each rollout sync). scripts/pre-push now asks GitHub about every pushed
SHA first and exits early only when each one has GitHub's tree equal to the
local tree, at least one successful CI workflow run (push / pull_request /
merge_group) and every CI run on it terminal and green, and no red commit
status. Deployment writers from the LOCK_CONTRACTS registry neither certify
nor block.

Not a skip hatch: the check reads no environment, fails closed on any
error, timeout, unknown SHA or non-GitHub remote, and logs every verdict to
<git-common-dir>/omi-pre-push-ci-verified.log.

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

Every Cloud Run train reset four ops values that the lead then restored by
hand, because the prod overlay pinned their old values. Record today's live
values (read with the ro-prod tier):

- BATCH_PIPELINE_SPEECH_EMPTY_MULTILINGUAL_ENABLED=true on backend,
  backend-sync and backend-sync-backfill (integration already true)
- SUMMARY_DEBT_REPAIR_ENABLED=false on backend-sync
- BATCH_PIPELINE_RECOVERY_ALL_ADMITTED=true on backend-integration

render_backend_runtime_env.py now fails the deploy before any output is
emitted when a manifest env key does not come back out of the exact text
handed to deploy-cloudrun (missing, duplicated, changed value) or is also
named for removal in the same deploy. Provisional keys without a supplied
value keep their documented preserve-live omission.

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

The deploy-writer registry decides which workflow runs the CI-verified check
ignores, so reading it from the working tree let a local edit widen that
set. The hook now passes its base ref and the registry is read with git show
at that ref. A combined commit status now has to be success whenever any
status exists; only GitHub's pending-with-zero-statuses answer is neutral.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 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-21T10:10:37.001719Z 1ce4b5a 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: e9a6ab2baa

ℹ️ 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 backend/docs/feature-flag-registry.md Outdated
| `STT_ROUTING_MODE` | Off shadow or cost-ordered health-gated live STT routing | backend | env | closed | declared | shadow (backend-listen (chart), gke/backend-listen) | on (backend-listen (chart), gke/backend-listen) | — | pending | undecided | 2026-11-04 | dazheng |
| `STT_ROUTING_ON_PERCENT` | Sticky UID percentage admitted to the cost router; zero keeps static routing | backend | env | closed | declared | 0 (backend-listen (chart), gke/backend-listen) | 90 (backend-listen (chart), gke/backend-listen) | — | pending | undecided | 2026-11-04 | dazheng |
| `SUMMARY_DEBT_REPAIR_ENABLED` | Code default false; production on for scheduled backend-sync; bounded completed server-minimum repair; requires first-summary gate | backend | env | closed | — | — | {value: 'true', category: rollout} | — | pending | undecided | 2026-11-04 | dazheng |
| `SUMMARY_DEBT_REPAIR_ENABLED` | Code default false; production on for scheduled backend-sync; bounded completed server-minimum repair; requires first-summary gate | backend | env | closed | — | — | {value: 'false', category: rollout} | — | pending | undecided | 2026-11-04 | dazheng |

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 Describe debt repair as disabled in production

The production value is now false, but this row still says the scheduled backend-sync sweep is on. The source summary in config/feature-flags.yaml:364 and the operational statement in backend/docs/listen_pusher_pipeline.mdx:5773 remain stale as well, so operators following the registry or regenerating it receive contradictory guidance and may restore the setting this change intends to keep disabled. Update the source description and affected operational documentation, then regenerate the registry.

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

Useful? React with 👍 / 👎.

Comment thread scripts/pre_push_ci_verified.py Outdated
Comment on lines +115 to +116
if not green:
raise NotVerified(f"{sha[:12]}: no successful CI workflow run on this exact 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.

P2 Badge Require a recognized CI suite before skipping checks

Any single successful run from CI_EVENTS is enough to satisfy this condition, even if that workflow performs no validation and every relevant check workflow is absent rather than pending or failed. For example, .github/workflows/pr-declined-comment.yml is a pull_request_target workflow included by CI_EVENTS, but its only job posts a comment; if that is the only eligible run reported for the SHA and there are no legacy statuses, this returns verified and scripts/pre-push exits before running any local checks. Require success from an allowlisted comprehensive check workflow or otherwise prove that the expected check set ran, rather than treating any successful workflow as certification.

Useful? React with 👍 / 👎.

… review

Grok review of #22978 (FIX-FIRST):

- pull_request runs test the PR merge ref, whose tree differs from the head
  whenever the branch is behind main, so they no longer certify a SHA; they
  still block when not terminal or not success/skipped. Only push and
  merge_group successes certify. pull_request_target (base checkout) is
  ignored. neutral is no longer green.
- Default CodeQL runs (event "dynamic") now block when queued or red.
- The deploy-writer registry is fetched from the push remote's main on
  GitHub instead of a local ref, so PRE_PUSH_BASE_* cannot widen the set of
  ignored runs. Any failure judges deploys as CI.
- The commit payload must carry the requested SHA.
- Job renders pass their own --remove-env-vars flag into the render
  assertion, not only forbidden_env.
- Docs and the flag summary now say debt repair is held off in prod.

Failure-Class: none

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

BATCH_PIPELINE_SPEECH_EMPTY_MULTILINGUAL_ENABLED:
value: 'true'

P2 Badge Reconcile the enabled multilingual recovery rollout

When this production overlay deploys the CPU recovery host, it enables multilingual recovery, but backend/docs/batch-pipeline-serving.md:429-440 still labels the feature dark and explicitly instructs operators to keep it off until an owner-scoped canary succeeds. This leaves the rollout and rollback guidance contradictory to the persisted production state; document the completed canary and enabled host scope, or keep the flag false until those prerequisites are met.

ℹ️ 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".

category: rollout
BATCH_PIPELINE_RECOVERY_ALL_ADMITTED:
value: 'false'
value: 'true'

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 Correct the all-admitted recovery control documentation

With production recovery mode already on, this value expands the recovery sweep from the owner allowlist to every admitted owner, but backend/docs/listen_pusher_pipeline.mdx:5461-5464 says that BATCH_PIPELINE_RECOVERY_ALL_ADMITTED=false permits that expansion. The implementation in backend/config/policy/stages.py:112-124 requires this flag to be true, so an operator following the owning pipeline documentation would apply the opposite setting; update that control description alongside the rollout.

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

Useful? React with 👍 / 👎.

Comment on lines +114 to +116
flags = _render_flag_values(_as_config_dict(job_config.get('flags')) or {})
listed = {name for name in flags.get('--remove-env-vars', '').split(',') if name}
return listed | set(job_config.get('forbidden_env', []))

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 workflow-only job removals in the assertion

This helper only inspects the manifest's flags, but existing jobs also remove variables through workflow-only flags—for example, .github/workflows/gcp_notifications_job.yml:220-223 carries a large literal --remove-env-vars list that is absent from the notifications manifest entry. If one of those names is later added to the manifest env, assert_manifest_env_renders will approve it even though the exact deploy command both updates and removes that key; the Cloud Run jobs command reference confirms these are separate environment-update controls. Source the actual workflow removal set, or move those removals into the manifest, before claiming every rendered key will land.

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

Useful? React with 👍 / 👎.

Git-on-my-level and others added 4 commits October 21, 2026 14:52
# Conflicts:
#	.github/checks-manifest.yaml
#22226 added test_first_attempt_past_the_per_attempt_deadline_still_summarizes
with a 0.1 s per-attempt budget after #22797's real-clock-budget ratchet
landed, so "Backend unit guardrails" fails on main for every PR that runs it
(main's own push CI does not select the job). Scale the per-attempt budget
to 0.5 s and the slow turn to 0.75 s: same ratio, still past one attempt and
inside the mount's import-time whole-transport deadline. The sleep is wall
time, so the CPU-time fast-unit guard is unaffected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	backend/tests/unit/test_conversation_structure_provider_timeout.py
@Git-on-my-level
Git-on-my-level merged commit 5a17082 into main Oct 21, 2026
61 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/toil-killers branch October 21, 2026 10:56
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