Repository navigation
fix(showcase/railway): promote re-asserts SSOT replica config so redeploy doesn't de-scale harness-workers to 1 - #5754
Merged
Conversation
…ploy doesn't de-scale harness-workers to 1
A `bin/railway promote` issued only `serviceInstanceUpdate(input:{source:{image}})`
(plus the optional healthcheckPath) followed by `serviceInstanceDeployV2`. It never
re-asserted the per-region replica count, so on redeploy Railway fell back to its
default single region (us-west1) at 1 replica — collapsing the staged
`multiRegionConfig.us-west2.numReplicas = 6`. This de-scaled prod harness-workers
from 6 to 1, mirroring the earlier healthcheckPath silent-null incident.
Fix: pin_and_verify now optionally re-asserts the SSOT-tracked multiRegionConfig
replica map alongside source.image, exactly like the healthcheckPath re-assertion.
A new dynamic builder (build_update_image_mutation) composes source.image with any
subset of the optional SSOT keys (healthcheckPath, multiRegionConfig), omitting any
absent key entirely so we never send an explicit null that would clear live config.
The promote loop reads the count from the SSOT
(workerProvisioning.<env>.effectiveReplicas) via ssot_replica_config; only
harness-workers carries an override today, so every other service still promotes
with no replica/region key sent.
Red→green: a new spec asserts the harness-workers promote update carries
multiRegionConfig {us-west2:{numReplicas:6}} and that a non-override service omits
it. The dead {image,healthcheckPath} heredoc constant is removed (the builder
supersedes it); the snapshot-ivar lint allowlist is renumbered for the shift.
jpr5
requested review from
marthakelly,
mme,
ranst91 and
tylerslaton
as code owners
June 28, 2026 19:56
Contributor
📣 Social Copy GeneratorGenerate social media copies (Twitter/X, LinkedIn, Blog Post) for this PR using Claude.
|
Contributor
Production Digest-Pinning AuditAll 41 services digest-pinned. Run 2026-06-28 12:57:07 PDT — 0 finding(s). |
jpr5
added a commit
that referenced
this pull request
Jun 28, 2026
…omote) (#5755) PR #5754's serviceInstanceUpdate used a non-existent GraphQL type `ServiceMultiRegionConfigInput` → HTTP 400 Unknown type → promote FAILS on harness-workers + gates the tier (caught by live value-test promote run 28334337133). Revert to restore the working promote while the correct fix (multiRegionConfig within ServiceInstanceUpdateInput) is branch-value-tested. harness-workers prod held at 6 manually meanwhile. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
pull Bot
pushed a commit
to erickirt/CopilotKit
that referenced
this pull request
Jun 28, 2026
… so redeploy doesn't de-scale harness-workers to 1 (CopilotKit#5754)" This reverts commit 5289aac, reversing changes made to 39ae165.
jpr5
added a commit
that referenced
this pull request
Jun 28, 2026
…l ServiceInstanceUpdateInput shape
Promote now re-asserts the SSOT multiRegionConfig replica count
({"us-west2":{numReplicas:6}} for harness-workers) alongside source.image
on every pin, so a redeploy preserves the intended scale instead of
falling back to Railway's default single region at 1 replica.
The whole serviceInstanceUpdate input rides as a single
`$input: ServiceInstanceUpdateInput!` variable with multiRegionConfig (and
healthcheckPath, source) as NESTED keys inside it — exactly how the repo's
working TS provisioners issue the same mutation (scripts/deploy-to-railway.ts
~501-509, scripts/provision-starter-fleet.ts ~594-602). Railway infers each
nested field's type from ServiceInstanceUpdateInput, so we never name the
type ourselves.
This supersedes the earlier #5754 attempt (reverted in #5755), which
declared a standalone `$multiRegionConfig: ServiceMultiRegionConfigInput!`
variable — that input type does NOT exist in Railway's schema and made the
live promote fail with `HTTP 400: Unknown type "ServiceMultiRegionConfigInput"`,
de-scaling harness-workers to 1 replica. Live-proven against real Railway
(promote run 28334807622 succeeded).
Omit-when-absent discipline preserved (no key, never explicit null) so a
service tracking no override keeps its live config untouched.
Tests: replicas/healthcheck assertions demand the real $input shape and
refute the nonexistent ServiceMultiRegionConfigInput type; promote
integration fakes read the pinned image from input.source.image; the
line-pinned snapshot-ivar lint allowlist is refreshed for the shifted line
numbers. Full bin/railway suite green (183 runs, 0 failures).
jpr5
added a commit
that referenced
this pull request
Jun 28, 2026
…UpdateInput shape (drop nonexistent ServiceMultiRegionConfigInput type) (#5756) ## The bug `bin/railway` promote re-asserts the SSOT replica config on the `serviceInstanceUpdate` pin, but built the mutation by declaring a standalone variable: ```graphql $multiRegionConfig: ServiceMultiRegionConfigInput! ``` **That input type does not exist in Railway's schema.** The prior promote attempt (#5754) failed live with `HTTP 400: Unknown type "ServiceMultiRegionConfigInput"`, so the redeploy went out **without** the replica config and Railway de-scaled `harness-workers` (us-west2) from the SSOT-intended **6** replicas to **1**. The wrong type name was a guess, never verified against the real schema. ## Real schema — source of truth Railway's mutation is `serviceInstanceUpdate(serviceId: String!, environmentId: String!, input: ServiceInstanceUpdateInput!)`. The correct pattern — already used by this repo's own working TypeScript provisioners — is to pass the **entire input object as one `$input: ServiceInstanceUpdateInput!` variable** and put every field (`source`, `healthcheckPath`, `region`, `registryCredentials`, `multiRegionConfig`) as a **nested key** of that input. Railway resolves each nested field's type from the `ServiceInstanceUpdateInput` schema, so you never name nested input types yourself: - `showcase/scripts/deploy-to-railway.ts` ~472-509 — builds `instanceInput = { region, healthcheckPath, registryCredentials, ... }`, then `serviceInstanceUpdate($serviceId, $environmentId, $input: ServiceInstanceUpdateInput!)` passing `input: instanceInput`. - `showcase/scripts/provision-starter-fleet.ts` ~575-602 — same single-`$input` pattern. The replica shape itself (`multiRegionConfig.<region>.numReplicas`, e.g. `{ "us-west2": { "numReplicas": 6 } }`) is confirmed in `showcase/scripts/railway-envs.ts` ~150-194, ~719-752 and `railway-envs.generated.json` ~161-169 — and was already correct in the Ruby. **Only the GraphQL type declaration was wrong.** ## The fix `showcase/bin/railway` — `RestoreCommand.build_update_image_mutation` (~859): **Before** — one typed variable per optional key (and the invented type): ```graphql mutation UpdateImage($serviceId: String!, $envId: String!, $image: String!, $healthcheckPath: String!, $multiRegionConfig: ServiceMultiRegionConfigInput!) { serviceInstanceUpdate(serviceId: $serviceId, environmentId: $envId, input: { source: { image: $image }, healthcheckPath: $healthcheckPath, multiRegionConfig: $multiRegionConfig }) } ``` **After** — the whole input as one `ServiceInstanceUpdateInput!`, fields nested: ```graphql mutation UpdateImage($serviceId: String!, $envId: String!, $input: ServiceInstanceUpdateInput!) { serviceInstanceUpdate(serviceId: $serviceId, environmentId: $envId, input: $input) } ``` with `vars = { input: { source: { image: ... }, healthcheckPath: ..., multiRegionConfig: { "us-west2" => { numReplicas: 6 } } } }`. Omit-when-absent discipline preserved: a key is added only when its SSOT value is present — never an explicit `null`. ## Red → green proof The replica/healthcheck spec assertions previously asserted the **buggy** `ServiceMultiRegionConfigInput` shape — that wrong assertion is exactly why the bug shipped "green". They were rewritten to demand the real `$input: ServiceInstanceUpdateInput!` shape (and to assert the nonexistent type is **absent**). **RED** (new assertions vs the pristine buggy `bin/railway`): ``` $ ruby showcase/bin/spec/test_promote_replicas_reassert.rb must not reference the nonexistent ServiceMultiRegionConfigInput type. Expected /ServiceMultiRegionConfigInput/ to not match "...$multiRegionConfig: ServiceMultiRegionConfigInput!) { serviceInstanceUpdate(... )}" 6 runs, 13 assertions, 2 failures, 0 errors, 0 skips ``` **GREEN** (same spec, with the fix applied): ``` $ ruby showcase/bin/spec/test_promote_replicas_reassert.rb 6 runs, 23 assertions, 0 failures, 0 errors, 0 skips ``` **Full `bin/railway` suite** (after updating integration fakes to read `input.source.image` and refreshing the line-pinned ivar-lint allowlist for shifted line numbers): ``` $ ruby showcase/bin/spec/all_tests.rb 183 runs, 710 assertions, 0 failures, 0 errors, 0 skips ``` `ruby -c showcase/bin/railway` → Syntax OK. ## Note This fixes the GraphQL shape and the unit/integration coverage. **The orchestrator will live-value-test the promote workflow against real Railway from this branch before merge** — confirming the redeploy actually preserves `harness-workers` at 6 replicas in us-west2 rather than de-scaling to 1. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.
Incident (confirmed, observed)
Running
bin/railway promote(viashowcase_promote.yml) reset prodharness-workers(us-west) to 1 replica. The SSOT intends 6 (workerProvisioning.{prod,staging}.effectiveReplicas = 6, i.e.multiRegionConfig.us-west2.numReplicas = 6). The fleet ran de-scaled until manually restored to 6.Root cause
PromoteCommand.pin_and_verify(showcase/bin/railway) promotes each service with:serviceInstanceUpdate(input: { source: { image } })— only the image (plus the optional SSOThealthcheckPath), andserviceInstanceDeployV2— spawns the new deployment.Neither call carries the per-region replica config. The authoritative replica knob is
multiRegionConfig.us-west2.numReplicas(documented inshowcase/scripts/railway-envs.ts~150-194 andRAILWAY.md~278-345; the top-levelnumReplicasis only a mirror). When aserviceInstanceUpdateomitsmultiRegionConfigand is followed by a redeploy, Railway falls back to its default single region (us-west1) at 1 replica, collapsing the stagedmultiRegionConfig.us-west2.numReplicas = 6.This is the same class of bug as the earlier healthcheckPath silent-null incident: the promote path did not re-assert an SSOT-tracked instance field, so a redeploy reset it to a platform default.
Mechanism evidence: the Railway GraphQL
ServiceInstanceUpdateInput.multiRegionConfig(shape{ <region>: { numReplicas } }) is the documented replica field, and Railway is known to injectus-west1/a placeholder replica whenmultiRegionConfigis absent on update+deploy (Railway Help Station: "serviceInstanceUpdate with multiRegionConfig", "Problem with multi region").Fix
showcase/bin/railway:RestoreCommand.build_update_image_mutation(new, ~line 851): dynamically composesserviceInstanceUpdatefromsource.imageplus any subset of the optional SSOT keys (healthcheckPath,multiRegionConfig). Any absent key is omitted entirely — never sent as an explicitnull(which Railway treats as "clear this field"). Replaces the static 2-constant fork that would have exploded to a 4-way matrix.PromoteCommand.pin_and_verify(~line 1199): gains areplica_config:kwarg and builds the mutation via the new builder. The@sha256:guard and all P5/serving-digest verification are unchanged.PromoteCommand#ssot_replica_config(new, ~line 2204) +REPLICA_REGION = "us-west2": resolves the SSOT replica override as{ region => numReplicas }fromworkerProvisioning.<env>.effectiveReplicas, ornilwhen the service tracks none.ssot_replica_config(svc, "prod")and threads it intopin_and_verifyalongside the existinghealthcheck_path.Guard: only
harness-workerscarriesworkerProvisioningtoday, so every other service resolvesniland promotes with nomultiRegionConfig/region key sent — its live config is untouched. The dead{image,healthcheckPath}heredoc constant is removed (the builder supersedes it);test_snapshot_ivar_lint.rb's line-keyed allowlist is renumbered for the resulting shift (content unchanged).Red → green proof
New spec
showcase/bin/spec/test_promote_replicas_reassert.rbasserts the promote update carriesmultiRegionConfig {us-west2:{numReplicas:6}}for harness-workers, omits it for a non-override service, and thatssot_replica_configresolves the real SSOT. (Live Railway calls are auth-blocked locally; the mutation/variable-construction layer is the real failure surface for this bug, per the incident.)RED — against pre-fix
bin/railway(the promote path has no way to carry replica config, so the mutation omits it → Railway de-scales to 1):GREEN — against the fix (mutation vars now carry
multiRegionConfig {us-west2:{numReplicas:6}}for harness-workers):Regression — full Ruby suite green (includes the healthcheckPath re-assert test, the P6 advisory tests, and the renumbered snapshot-ivar lint):
🤖 Generated with Claude Code