Repository navigation
fix(relay): accept MIG version-name reconciliation and recreate stranded cells without rewriting the MIG - #24373
Conversation
…ded cells without rewriting the MIG The stranded-rollback recovery ran a gcloud rolling action, which renames the MIG version outside Terraform. Every later plan for that cell then reverted the label, and the capacity-plan validator refused the revert as an unreviewed MIG change, so the cell could be neither rolled nor rolled back. The validator now accepts a MIG field moving back to what relay-gce-cells.tf declares (version name and update policy), in every mode, and a test pins those values to the Terraform file. The stranded branch recreates the cell's single instance with recreate-instances, which leaves the MIG untouched. Claude-Session: ced32ebb-7155-4413-adad-1eccd14c2010
|
|
… stranded rollback A stranded rollback whose template is already in place plans only the version name revert. The validator still required the MIG template to move, so that plan was refused, and the recreate gate (changes == 0) would have skipped a plan of one change and left the drain flag set. Require the template move only when no declared field reconciles, and recreate whenever the template was not replaced (changes < 2). Claude-Session: ced32ebb-7155-4413-adad-1eccd14c2010
| gcloud compute instance-groups managed rolling-action replace "${MIG_NAME}" \ | ||
| --project "${GCP_PROJECT_ID}" --zone "${TARGET_ZONE}" \ | ||
| --replacement-method recreate --max-surge 0 --max-unavailable 1 | ||
| && jq -e '.changes < 2' <<< "${PLAN_REVIEW}" >/dev/null; then |
There was a problem hiding this comment.
Stranded cell recreated twice A one-change plan does not always mean the MIG's template stayed put: the validator also accepts a MIG-only template correction. In a stranded rollback, that correction can replace the instance during Terraform apply under the MIG's proactive RECREATE policy. This condition then recreates the instance again, causing a second, unnecessary interruption. Check whether the reviewed MIG template changed instead of relying on the resource-change count.

ELI5
When a relay cell gets stuck mid-rollout ("stranded"), the recovery restarts its server with a gcloud command. That command also quietly renamed a label on the cell's server group. The next time Terraform looked at the cell, it wanted to put the label back, and our safety check refused that as an unreviewed change. From then on the cell could be neither upgraded nor rolled back. This PR lets the safety check accept putting things back the way Terraform declares them, and changes the recovery so it no longer renames anything.
What Changed
Before: production-gce-c29's same-cap canary apply (run 36856633548) was refused at "Apply only the selected same-cap template and MIG". The plan's only extra change was the managed instance group (MIG) version name going from
0/2026-10-01 10:41:28...back toprimary. Every later apply or rollback for that cell would be refused the same way.After:
cloud/dev/scripts/validate-relay-capacity-plan.mjs): a MIG field may change only when it moves back to the valuerelay-gce-cells.tfdeclares. The fields are the version name (primary) and the update policy (type,minimal_action,most_disruptive_allowed_action,replacement_method,max_surge_fixed,max_unavailable_fixed). This applies in every mode that reviews the MIG. It replaces a narrower rule that accepted the version name only when paired with a RESTART to REPLACE policy flip. Any other MIG change, or any field moving away from its declared value, is still refused. A new test readsrelay-gce-cells.tfand fails if the validator's declared values drift from it.A plan whose only MIG change is such a revert, with the template left in place, is now accepted too. This is c29's stranded-rollback shape, because its template already carries the image it serves.
.github/workflows/cloud-deploy-relay-production-same-cap-job.yml): instead ofrolling-action replace, the job lists the MIG's instances, asserts there is exactly one, and runsrecreate-instanceson it, then waits for the group to be stable as before. It now does this whenever the template was not replaced, which is fewer than two reviewed changes. Before, it fired only at zero changes, so a label-only reconciliation would have left the instance, and its drain flag, in place.recreate-instancesrebuilds the instance from the MIG's current template, which is the template the plan just reviewed, and it does not touch the MIG's version or update policy.cloud/docs/relay-workflows.md): the stranded recovery description now says what it does and why it avoids a rolling action.Why
Putting a field back to its declared value is never a capacity change, so allowing exactly that is safe. The values come from a fixed list that a test ties to the Terraform file. Fixing only the workflow would leave c29, and any other cell an older rolling action touched, permanently blocked. Fixing only the validator would keep producing drift on every stranded recovery. Alternatives considered:
primarywith gcloud. It unblocks one cell once, needs a production mutation outside the reviewed path, and leaves the cause in place.version.nameentirely. A label move to an arbitrary value would then pass unreviewed.This PR touches files in the relay evidence same-code set (validator and same-cap job), so a fresh aggregate monitor run is required after merge before the next same-cap dispatch.
Not changed: a
resumerollback still requires either no changes or the template-and-MIG pair. A resume on a cell carrying only the label drift is refused, as before. The stranded and roll paths are the ones that reconcile it.Linked Issue
N/A, production rollout tooling fix for production-gce-c29.
Visual Proof
N/A. This changes CI workflow and validation script behaviour, with no UI.
Testing
node --testover the fullcloud/package.jsontest list: all 652 tests touching this code pass. The one failure,relay-load-control-peer, cannot resolve@orca-cloud/relay-contractin a lane without cloud workspace packages built, and is unrelated.New validator cases cover several plans. A same-cap plan whose MIG diff is the new template plus version name back to
primarypasses. The same plan with an unrelated MIG change fails. Each update policy field passes when reverting to its declared value and fails when moving away from it.Mutation checks: disabling the declared-value comparison, changing the declared version name, or requiring a template move on a label-only plan each fail the suite.
A label-only plan with the template in place passes. The same plan fails with a resize, a second version, or a label moving away from
primary. The shipped stranded gate recreates at zero and one changes, and not at two.Workflow shape tests assert the stranded branch uses
recreate-instanceson the one listed instance, never a rolling action, and waits for stability afterwards. The shipped jq instance filter is run against zero, one, and two instances.Automated tests added/updated
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Cloud tooling only. There is no desktop, SSH, or mobile impact.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)