Repository navigation
fix(deploy): render the desktop-backend expected env state its sidecar requires - #12147
Merged
Merged
Conversation
…r requires attach_cloud_run_gmp_sidecar.py and updated only the backend caller, so both desktop-backend deploy paths have failed at the attach step with an argparse usage error ever since. Production run 32690712862 died there, and dev's serving revision has no collector container for the same reason -- it was failing, not waiting. Supply the argument rather than relaxing the guard: it is what catches the dialect-coercion class fixed in #12083. runtime_env.yaml already owns desktop_backend.env in both environments and all four values already match what the workflows deploy, so render the expectation from there instead of restating it in the workflow, which would recreate the drift this bug is an instance of. Keep the new --desktop-state-output separate from --state-output, which validate-backend-runtime-env.py reads, and let it write and return before the full render so desktop callers do not inherit the backend service env requirements. Bind the release policy to the step: it required the script name anywhere in the file, which still matched while both callers were broken.
Git-on-my-level
force-pushed
the
fix/desktop-sidecar-expected-env-state
branch
from
August 24, 2026 15:16
cbbc156 to
ea4f795
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.
Summary
attach_cloud_run_gmp_sidecar.pygained a required--expected-env-stateargument in #12098, and only one of its three callers was updated. Both desktop-backend deploy paths — production and automatic dev — have been failing at the sidecar attach step ever since:.github/actions/deploy-backend-stack/action.yml.github/workflows/desktop_backend_prod.yml.github/workflows/desktop_backend_auto_dev.ymlThis is what failed production run 32690712862. It also explains something that read as a benign rollout state: dev's serving desktop-backend revision has no
collectorcontainer because the last successful dev attach predates #12098 — dev was not waiting, it was failing every time.Approach
The guard is worth keeping — it is what catches the dialect-coercion class fixed in #12083 — so the fix supplies the argument rather than relaxing it.
The backend path renders its expectation from
backend/deploy/runtime_env.yamland hands the same file to the sidecar script, so the expectation cannot drift from the deploy. The desktop workflows set their env inline indeploy-cloudrun, so the obvious fix is to restate those values in a second place — which recreates the exact "two copies drift apart" shape that caused this.Instead,
runtime_env.yamlalready owns adesktop_backend.envsection in both environments (USE_VERTEX_AI,GOOGLE_CLOUD_PROJECT,GCP_LOCATION,PROMETHEUS_SIDECAR_PORT), and all four already match what the workflows deploy. So:render_backend_runtime_env.pygains--desktop-state-output, emitting{"services": {"desktop-backend": {"env": [...]}}}from that section.--expected-env-state.Two deliberate constraints:
--state-output. That file is also read byvalidate-backend-runtime-env.py, which walkscloud_run.services, anddesktop-backendis not one of them. Keeping the builders apart means this cannot perturb the backend deploy path.$CLOUD_RUN_VPC_NETWORKand friends).--desktop-state-outputwrites and returns before that, so desktop callers do not inherit the backend's environment requirements.The manifest owns a subset of desktop-backend's env today, and that is fine:
_expected_literal_envchecks only the names it is given. A subset guard is a real guard; the empty one it replaces was not. Moving the remaining inline values into the manifest is the follow-up.Why nothing caught it
check-desktop-backend-release-policy.pyrequired the stringattach_cloud_run_gmp_sidecar.pyto appear somewhere in the file. It did. Every one of its ~30 required fragments still matched, all 26 fixtures passed, and the workflow was broken. The check triggers onbackend/**/*.py, so it ran on #12098 — its contract was simply file-scoped where the defect was step-scoped.The requirement is now bound to the step via the existing
_step_blockhelper: the attach step must pass--expected-env-state, the render step must exist, must use--desktop-state-output, and must precede the attach.Verification
test_check_desktop_backend_release_policy.py: 27 passed, including three new mutation fixtures per environment — dropping the argument, dropping the render step, and rendering with the wrong flag each fail with the reason named.test_render_backend_runtime_env.py,test_backend_runtime_env_validator.py: 114 passed. The renderer change leaves the backend path untouched.test_desktop_state_output_is_shaped_for_the_sidecar_guardround-trips the rendered file through the consumer's own_expected_literal_env, so producer and consumer stay compatible by construction rather than by comment.test_desktop_manifest_env_matches_what_the_workflow_deploysasserts every manifest-owned value is what the workflow actually deploys. Negative proof: changing the manifest's prodPROMETHEUS_SIDECAR_PORTto9091fails withprod: PROMETHEUS_SIDECAR_PORT=9091 is not what the workflow deploys. Without this, drift would surface as a failed production deploy instead of a failed review.Product invariants affected
No serving authority, routing pin, image lineage, or traffic-promotion rule is changed. This restores an argument to a deploy step and renders it from the manifest that already owned the values.
Failure-Class: FC-workflow-script-input-contract