Repository navigation
fix(deploy): read gcloud's export in the dialect gcloud writes - #12083
Merged
Merged
Conversation
Development backend deploys fail at the post-deploy runtime-env validator:
ERROR [cloud_run/backend]: env MEMORY_ENABLED value mismatch: expected 'on'
The deploy sets it correctly -- the gcloud command carries MEMORY_ENABLED=on
-- and the live revision then holds 'true'. The sidecar attach rewrites it
in between.
gcloud emits YAML 1.2, where `on` is a string; production's untouched export
literally contains `value: on`. PyYAML implements YAML 1.1, where on/off/yes/no
are booleans. `attach_sidecar` safe_loads that export, patches it, and
safe_dumps it back through `services replace`, so `on` lands as the string
'true'. All three of the manifest's on/off keys are rewritten; none survive.
Nothing fails at attach time. Cloud Run stores the rewritten string, and every
consumer accepts the coerced spelling, so behaviour is unchanged. It surfaces
one step later in a validator, on a service nobody edited -- the same delayed
shape as #12080 and #12081.
Restrict the bool resolver to the YAML 1.2 core set so the round trip preserves
what gcloud wrote. safe_dump already quotes ambiguous strings, so only the read
side changes. containerPort, periodSeconds and containerConcurrency still load
as integers and real booleans still load as booleans.
Production has never attached the sidecar, so its export still says `value: on`.
Its first attach would rewrite all three flags and then fail its own gate.
The test fixture is copied verbatim from a real `--format=export` of the
production service, including the unquoted `value: on`. A hand-written fixture
would have been written in the dialect the author already assumes.
Failure-Class: new
Co-Authored-By: Claude Opus 5 <[email protected]>
This was referenced Aug 23, 2026
formed2forge
pushed a commit
to formed2forge/omi
that referenced
this pull request
Aug 24, 2026
…Hardware#12083) Development backend deploys fail at the post-deploy runtime-env validator: ERROR [cloud_run/backend]: env MEMORY_ENABLED value mismatch: expected 'on' The deploy sets it correctly -- the gcloud command carries MEMORY_ENABLED=on -- and the live revision then holds 'true'. The sidecar attach rewrites it in between. gcloud emits YAML 1.2, where `on` is a string; production's untouched export literally contains `value: on`. PyYAML implements YAML 1.1, where on/off/yes/no are booleans. `attach_sidecar` safe_loads that export, patches it, and safe_dumps it back through `services replace`, so `on` lands as the string 'true'. All three of the manifest's on/off keys are rewritten; none survive. Nothing fails at attach time. Cloud Run stores the rewritten string, and every consumer accepts the coerced spelling, so behaviour is unchanged. It surfaces one step later in a validator, on a service nobody edited -- the same delayed shape as BasedHardware#12080 and BasedHardware#12081. Restrict the bool resolver to the YAML 1.2 core set so the round trip preserves what gcloud wrote. safe_dump already quotes ambiguous strings, so only the read side changes. containerPort, periodSeconds and containerConcurrency still load as integers and real booleans still load as booleans. Production has never attached the sidecar, so its export still says `value: on`. Its first attach would rewrite all three flags and then fail its own gate. The test fixture is copied verbatim from a real `--format=export` of the production service, including the unquoted `value: on`. A hand-written fixture would have been written in the dialect the author already assumes. Failure-Class: new Co-authored-by: r <r@r> Co-authored-by: Claude Opus 5 <[email protected]>
Git-on-my-level
pushed a commit
that referenced
this pull request
Aug 24, 2026
…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
added a commit
that referenced
this pull request
Aug 24, 2026
…r requires (#12147) 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. Co-authored-by: r <r@r>
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.
What breaks
Development backend deploys fail at the post-deploy runtime-env validator:
The deploy sets these correctly — the gcloud command in the run log contains
MEMORY_ENABLED=on,ACCOUNT_CUTOVER_ENFORCEMENT=off,PUBLIC_SHARED_CONVERSATION_CHAT_MODE=off. The live revision then holds'true','false','false'.attach_cloud_run_gmp_sidecar.pyrewrites them in between.The chain
gcloud emits YAML 1.2, where
onis a string. Production's untouched export literally contains:PyYAML implements YAML 1.1, where
on/off/yes/noare booleans. The attach script doesyaml.safe_loadof that export, patches it, andyaml.safe_dumps it back throughgcloud run services replace:MEMORY_ENABLED=onvalue: onunquotedyaml.safe_load→ PythonTrueyaml.safe_dump→value: trueservices replacestores the string"true"'on'and failsEvery one of the three
on/offkeys the manifest declares is affected — 3 of 3, none survive.Why it read as unrelated
Nothing fails at attach time. Cloud Run accepts the rewritten string, and all three consumers accept the coerced spelling (
_ENABLED_ON = {"on", "true", "1"}; the other two only enable onon/gateway, sofalsedisables exactly asoffdid). No behaviour changes. It surfaces one step later, in a validator, on a service nobody edited — the same shape as #12080 and #12081.Production
Production has never attached the sidecar, so its export still says
value: on. Its first attach would rewrite all three flags and then fail its own deploy gate. This lands before that.The fix
Pin the loader to the dialect gcloud actually emits: restrict the bool resolver to the YAML 1.2 core set (
true/false), soon/off/yes/nostay strings.yaml.safe_dumpalready quotes ambiguous strings correctly, so only the read side needed changing.Structural values are untouched —
containerPort: 8080,periodSeconds: 240andcontainerConcurrency: 80still load as integers, and real booleans still load as booleans.Verification
The fixture in the new test is copied verbatim from a real
gcloud run services describe --format=exportof the production service, including the unquotedvalue: on. A hand-written fixture would have been written in the dialect the author already assumes and would not have reproduced this.Both new tests fail against the current script and pass with the fix. 113 passed across
test_attach_cloud_run_gmp_sidecar.py,test_preflight_cloud_run_deploy.py, andtest_backend_runtime_env_validator.py.The live dev service still carries the coerced values; the next deploy re-sets them to
on/offand, with this fix, they survive the attach.Failure-Class: new