Repository navigation
fix(ci): admit desktop-backend traffic on lineage, not branch recency - #11768
Merged
Merged
Conversation
The dev deploy refused to route traffic whenever `origin/main` advanced during the build, so under sustained merge pressure every candidate was discarded after its Cloud Build and acceptance probes had already run. Three consecutive runs failed this way on 2026-08-17 (19:15, 22:01, 22:11), stranding #11764 in a built-but-unrouted revision while the prod job green-checked and re-shipped the last accepted image. The check was also redundant with the protection it appeared to provide. Run ordering is already guaranteed by the `desktop-backend-auto-dev` concurrency group with `cancel-in-progress: false`, and the debounce that prevents stacked Cloud Builds is the entry guard in `Resolve immutable candidate identity`, which exits before any build is spent. Re-asking the same question after the build could only throw finished work away. Gate the promotion on lineage instead: refuse only when the candidate does not descend from the release SHA recorded on the revision serving 100% traffic. That keeps the real property — never move desktop-backend backwards — without requiring that nobody merged. Unknown lineage (legacy revisions with no recorded SHA, unreachable commits) warns and admits, so a service already serving a pre-SHA revision cannot deadlock. Scoped to the dev workflow; `desktop_backend_prod.yml` admits via `admitted-source` and never carried this guard. Verification: python3 -m pytest .github/scripts/test_check_desktop_backend_traffic_regression.py -q -> 11 passed python3 .github/scripts/check-desktop-backend-release-policy.py -> OK python3 .github/scripts/check-deployment-concurrency.py -> OK python3 -m pytest .github/scripts/test_check_desktop_backend_release_policy.py -q -> 27 passed Replayed the three real failures against the SHA prod serves (34bd15d) — 03f50eb, fc458ef and a7ff90a all now ADMITTED. Reverse direction (candidate 34bd15d vs serving 03f50eb) REFUSED. Empty serving SHA (dev's current pre-SHA revision) ADMITTED with a warning. Exercised the live discovery path against the prod service: extract_single_cloud_run_traffic_revision.py resolved desktop-backend-34bd15da499c-32074856543-1 and the jq expression read OMI_DESKTOP_BACKEND_RELEASE_SHA=34bd15da499cbfe314f1b5d9014b79611f91736c. The dev project was not reachable from the read-only bot (run.services.get denied), so that half runs first in CI. Failure-Class: new
Git-on-my-level
force-pushed
the
fix/desktop-backend-traffic-lineage-guard
branch
from
August 17, 2026 23:16
1c6db2b to
5664818
Compare
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.
Problem
The dev desktop-backend deploy refuses to route traffic whenever
origin/mainadvances during the build:A desktop-backend deploy takes ~5 minutes. When commits land faster than that, every run is pre-empted at the last step — after Cloud Build and the acceptance probes have already run. The check cannot prevent a build; by the time it fires, the build is finished. All it can do is discard it.
Three consecutive runs failed this way on 2026-08-17:
4f8da45ffc458ef3a7ff90a403f50eb101517240The failure mode is worse than a stuck pipeline. Prod promotes the last dev-accepted candidate, so with dev unable to accept anything since 19:06, the prod run at 22:11 reported success while re-shipping the
34bd15daimage. #11764 is merged, built, and sitting in an unrouted revision — while the dashboard reads green.It is also self-reinforcing: the more the team merges, the less likely any deploy ever lands.
Why the check was redundant
The two protections it appeared to provide are both already in place elsewhere, and they fight each other:
desktop-backend-auto-devconcurrency group withcancel-in-progress: false. A newer run cannot route while an older one holds the lock. But holding that lock for the full build is exactly what guaranteesmainhas moved by the time the older run reaches the traffic step — a queued run behind it has its commit onmainby definition.Resolve immutable candidate identity(:68), which exits before Google Auth and before any build is spent. This PR does not touch it. Superseded commits still bail out early; a burst of three merges still builds only the newest.Re-asking the same question after the build could only throw away finished work.
Change
Gate the promotion on lineage rather than recency: refuse only when the candidate does not descend from the release SHA recorded on the revision currently serving 100% traffic. That preserves the real safety property — never move desktop-backend backwards — without requiring that nobody merged during the build.
Unknown lineage (a legacy revision with no recorded SHA, or a commit unreachable in the checkout) warns and admits. Dev is currently serving
desktop-backend-00461-qiy, a pre-SHA revision, so refusing on unknown lineage would deadlock the pipeline on the very next run.Scoped to the dev workflow.
desktop_backend_prod.ymladmits viaadmitted-sourceand never carried this guard.Verification
Replayed the three real failures against the SHA prod actually serves (
34bd15da):03f50eb1(#11764)fc458ef3a7ff90a4(#11760)34bd15davs serving03f50eb1::warningExercised the live discovery path against the prod service:
extract_single_cloud_run_traffic_revision.pyresolveddesktop-backend-34bd15da499c-32074856543-1, and thejqexpression readOMI_DESKTOP_BACKEND_RELEASE_SHA=34bd15da499cbfe314f1b5d9014b79611f91736coff it. The dev project was not reachable from the read-only bot (run.services.getdenied), so that half runs first in CI.The unit tests cover the decision function through an injected ancestry oracle, and the
gitseam itself against a real temporary repository — including the unreachable-commit path — rather than stubbing it.Risk
Traffic shifts become more frequent, because builds that pass acceptance now actually ship instead of being discarded. That is the intent. If churn needs bounding, the correct lever is the entry-side debounce, not discarding completed work at the exit.
Failure-Class: new
Adds
FC-promotion-gate-admits-on-recency-not-lineage— a gate between an accepted candidate and its traffic promotion may refuse only backwards promotions, never merely because the branch advanced during the build. Guard artifact is the checked-in decision function and its fixtures.