Skip to content

fix(deploy): read gcloud's export in the dialect gcloud writes - #12083

Merged
Git-on-my-level merged 1 commit into
mainfrom
fix/gmp-attach-yaml-bool-coercion
Aug 23, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
fix/gmp-attach-yaml-bool-coercion

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Aug 23, 2026 •

Copy link
Copy Markdown
Member

What breaks

Development backend deploys fail at the post-deploy runtime-env validator:

ERROR [cloud_run/backend]: env PUBLIC_SHARED_CONVERSATION_CHAT_MODE value mismatch: expected 'off'
ERROR [cloud_run/backend]: env ACCOUNT_CUTOVER_ENFORCEMENT value mismatch: expected 'off'
ERROR [cloud_run/backend]: env MEMORY_ENABLED value mismatch: expected 'on'

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.py rewrites them in between.

The chain

gcloud emits YAML 1.2, where on is a string. Production's untouched export literally contains:

- name: MEMORY_ENABLED
  value: on

PyYAML implements YAML 1.1, where on/off/yes/no are booleans. The attach script does yaml.safe_load of that export, patches it, and yaml.safe_dumps it back through gcloud run services replace:

  1. deploy writes MEMORY_ENABLED=on
  2. export emits value: on unquoted
  3. yaml.safe_load → Python True
  4. yaml.safe_dump → value: true
  5. services replace stores the string "true"
  6. the validator compares against the manifest's 'on' and fails

Every one of the three on/off keys 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 on on/gateway, so false disables exactly as off did). 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), so on/off/yes/no stay strings. yaml.safe_dump already quotes ambiguous strings correctly, so only the read side needed changing.

Structural values are untouched — containerPort: 8080, periodSeconds: 240 and containerConcurrency: 80 still 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=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 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, and test_backend_runtime_env_validator.py.

The live dev service still carries the coerced values; the next deploy re-sets them to on/off and, with this fix, they survive the attach.

Failure-Class: new

Review in cubic

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]>
@Git-on-my-level
Git-on-my-level merged commit 6f7c57a into main Aug 23, 2026
40 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/gmp-attach-yaml-bool-coercion branch August 23, 2026 07:10
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>
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