Skip to content

chore(cloud): add the relay fence broker, ops console, Terraform root, scripts, and 24 cloud-* workflows - #18413

Merged
Jinwoo-H merged 10 commits into
mainfrom
relay-split/extraction
Sep 3, 2026
Merged

Jinwoo-H merged 10 commits into
mainfrom
relay-split/extraction

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 143 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​35947 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​35947
Prod 236 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​54744 $\color{#cf222e}{\Huge{\mathbf{−}}}$​8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​54736

Phase 6 of the relay split: the relay's full deploy/operate surface moves into this repo under cloud/, so nothing relay-related needs stablyai/orca-cloud any more.

What lands

  • cloud/apps/relay-fence-broker, cloud/apps/relay-ops (plus a sync of cloud/apps/relay and cloud/packages/relay-contract to orca-cloud main).
  • cloud/infra/terraform: the relay Terraform root, byte-identical to orca-cloud main. The foundation and apps roots (Cloud SQL, API, auth) stay private.
  • cloud/dev/scripts + cloud/dev/contracts: the relay script closure and its tests; relay-repository.mjs is the one place naming the repository, the cloud- filename prefix, and the workflow directory depth.
  • .github/actions/cloud-sql-rollout-lease and 24 workflows as .github/workflows/cloud-*.yml. Display names are unchanged so the workflow_run chain (Prove → Recover → Requeue) still matches; every top job is gated on the repo variable ORCA_CLOUD_OPERATIONS_ENABLED == 'true' (currently false), so nothing runs, including the two schedules, until the cutover flips it.
  • Cloud Verify gains a terraform fmt -check + validate -backend=false job. It still has no environment and no id-token, so fork PRs stay inert.
  • CODEOWNERS claims cloud/, cloud-*.yml, and the lease action.

Guarantees

  • No cloud-*.yml references secrets.* other than GITHUB_TOKEN (test).
  • No job-level if: reads an environment-scoped variable (they read empty before the environment binds and skip the job silently; see orca-cloud Use fish species for default worktree names #462).
  • gitleaks over cloud/ and .github/ clean; no node_modules, dist, .tfstate, or .tfplan in the tree.
  • cd cloud && pnpm install --frozen-lockfile && pnpm test: relay 428 passed, fence broker 16, ops 75, scripts 130 + 493.

GitHub-side setup already done: production and staging environments (deployment branch policy main) with the 14 + 9 relay variables mirrored from orca-cloud; ORCA_CLOUD_OPERATIONS_ENABLED=false; evaluate-mode ruleset main-cloud-paths-review.

Cutover order after merge: orca-cloud dual-accept apply (both envs) → set ORCA_CLOUD_OPERATIONS_ENABLED=true → verify cloud-monitor-relay-clock-skew → cloud-monitor-relay-production → cloud-power-relay-staging → staging deploy path → production publish → retire the orca-cloud copies and drop the orca-cloud arm.

Jinwoo-H and others added 6 commits September 2, 2026 20:58
Import the relay server and its wire contract under cloud/ as an independent
pnpm workspace, with a Cloud Verify workflow that builds, tests, and
secret-scans it.
The sanitized import dropped the checks that read dev/scripts and
infra/terraform because neither shipped. Both land in this branch.
…, and scripts

Copies the private repository's relay side: the IAM-only fence broker, the
operations console and incident monitor, the relay Terraform root with its
backend configuration and tfvars, and the deploy/capacity/admission/rehome/
monitoring scripts the workflows call, with their contract tests, contracts,
and fixtures.

The foundation and apps Terraform roots and the API and auth services stay
private. Four surfaces that spanned both trees are narrowed to the relay side
rather than left with a dangling read: the infra runner and the root-partition
and workload-identity-condition renderers now declare only the relay root, and
the Cloud SQL rollout census drops the six app workflows that are not here.
…ase action

Each workflow is copied under a cloud- prefix, runs from cloud/ through a
workflow-level defaults block, and resolves pnpm and the Node cache against
cloud/package.json and cloud/pnpm-lock.yaml. Display names are unchanged
because the recovery chain matches on them; every reusable call, gh dispatch,
and jq run-path check was repointed to the prefixed filenames.

Every job that can start on its own is gated on the repository variable
ORCA_CLOUD_OPERATIONS_ENABLED, so both scheduled triggers and every manual
dispatch skip without running a step until the owner enables them. Reusable
jobs inherit the caller's gate rather than restating it. A new contract test
pins the gate, the three chained display names, and the absence of any
repository secret other than the automatic token.
Format-checks, initialises without a backend, and validates cloud/infra/terraform
on the same pinned Terraform the private repository's CI uses. Fork pull requests
reach this workflow, so the job configures no backend and holds no credential.
…lay surface

A job-level `if:` is evaluated before the job's environment is resolved, so
every `vars.PRODUCTION_*` / `vars.STAGING_*` check in one reads empty in this
repository and would skip the job with no failing run to notice. The five
job-level checks are removed; each variable is still read where it is used, in
the authentication step that resolves it.

The multi-target gate loses its whole mode branch: with both identity clauses
gone the two arms are exhaustive, so only the branch check remains.

CODEOWNERS claims the workspace, the cloud-* workflows, and the lease action.
@pullfrog

pullfrog Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Pullfrog  | View workflow run | via Pullfrog | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@greptile-apps

greptile-apps Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

Too many files changed for review (379 files, 100 file limit).

Bypass the limit by tagging @greptile-apps to review.

…epo linters

The action lives outside cloud/, so the root oxlint (curly) and oxfmt apply to
it; the copied files were on orca-cloud's prettier style.
…ease tests from cloud/

defaults.run.working-directory: cloud does not exist before actions/checkout,
so the eight guard/gate steps that run first (and the two checkout-free jobs,
clock-skew and requeue) failed to start. Pin those steps to '.'. The pretest
lease-action paths are ../.github from cloud/, and the two bare pnpm setups
read cloud/package.json instead of the root's pnpm 12. Cloud Verify now also
triggers on the lease action.
…of the public tree

Drop the two runbooks that walk through the foundation/apps roots, trim the
Cloud SQL consumer contract's source notes to what the relay needs, scan the
lease action's history in Cloud Verify, and exclude that action from the
monorepo formatter so syncs from the private repo stay byte-identical.
…ccept identity change

Ports orca-cloud f24f3b4 (#464). The Terraform root is byte-identical to that
commit, including the new github_accepted_repositories variable and
relay-github-workflow-trust.tf, so every relay provider now admits
stablyai/orca alongside stablyai/orca-cloud. The tfvars already name this
repository's cloud- prefixed workflow paths on the stablyai/orca arm.

Ten scripts were three-way merged so the public-repo adaptations survive: the
relayWorkflowFile/relayWorkflowPath/readRelayWorkflow indirection, the census
keys, and the workflow directory depth. The condition renderer keeps the apps
root declared and skips it when the directory is absent, so its expectations
stay a straight copy of the private original. The staging deploy identity's
rendered-length pin keeps the private repository's 797 and derives this copy's
difference from the filename prefix.
@Jinwoo-H
Jinwoo-H merged commit 3eec77c into main Sep 3, 2026
31 checks passed
Jinwoo-H added a commit that referenced this pull request Sep 21, 2026
…ogging

A read-only production plan for production-gce-c7 showed the live US cell
backends carry no `log_config` at all, while relay-gce-cells.tf has declared
`log_config { enable = true, sample_rate = var.relay_gce_cell_log_sample_rate }`
on every cell backend since the Terraform root landed in 3eec77c (#18413).
Nothing has applied it because every production apply since is a per-cell
targeted plan that names only the template and the MIG.

So the real canary plan's backend moves two paths, not one:
`["connection_draining_timeout_sec", "log_config.0"]`. The drain-only validator
rejected exactly that plan, which would have stranded the cell mid-wave after
the drain had already started.

Accept both, each optional, for this cell's backend only: the drain landing on
RELAY_CELL_CONNECTION_DRAIN_SECONDS, and a log_config of exactly one block with
`enable = true` and `sample_rate` equal to RELAY_CELL_LOG_SAMPLE_RATE, the
declared default of a variable no environment file overrides. Any third path,
a different sample rate, disabled logging, another cell, or a replacement still
fails. The accepted paths are reported as `backendUpdate`, which the resume
branch now reads instead of the drain-only flag.

Verified against the real production plan: the masked, three-target plan for
production-gce-c7 contains exactly that cell's template, MIG, and backend
service and nothing else, and this validator returns
`{"changes":2,"backendUpdate":["connection_draining_timeout_sec","log_config.0"]}`.

Claude-Session: relay-same-cap-targets-cell-backend
Jinwoo-H added a commit that referenced this pull request Sep 21, 2026
…gs inside each same-cap wave (#21860)

* chore(relay): target each cell's backend service from the same-cap job

The 60 s connection drain timeout merged in #21848 has no safe apply path.
A root plan scoped to the backend services alone still pulls every
`google_compute_instance_template.relay_gce_cell` in as a dependency, and
standing image drift turns all 29 into replacements, so applying it would roll
the fleet at once.

Add `google_compute_backend_service.relay_gce_cell["${TARGET_CELL_ID}"]` to
both plan invocations in the per-cell same-cap job, next to the template and
MIG it already targets, and teach the reviewed plan validator to allow exactly
one extra change: an in-place update of that one cell's backend whose only
changed attribute is `connection_draining_timeout_sec`, landing on the
constant `validate-relay-asia-topology-plan.mjs` exports. Any other attribute,
any other resource, or a backend for another cell still fails the validator.

The accepted update is reported as `connectionDrainUpdate` and kept out of
`changes`, so the apply step's stranded branch and the resume step's drift
branch keep reading the template-and-MIG count they were written against; the
resume branch additionally accepts a plan whose only pending change is that
drain update, which restarts nothing.

Claude-Session: relay-same-cap-targets-cell-backend

* fix(relay): also let the same-cap wave apply this cell's LB request logging

A read-only production plan for production-gce-c7 showed the live US cell
backends carry no `log_config` at all, while relay-gce-cells.tf has declared
`log_config { enable = true, sample_rate = var.relay_gce_cell_log_sample_rate }`
on every cell backend since the Terraform root landed in 3eec77c (#18413).
Nothing has applied it because every production apply since is a per-cell
targeted plan that names only the template and the MIG.

So the real canary plan's backend moves two paths, not one:
`["connection_draining_timeout_sec", "log_config.0"]`. The drain-only validator
rejected exactly that plan, which would have stranded the cell mid-wave after
the drain had already started.

Accept both, each optional, for this cell's backend only: the drain landing on
RELAY_CELL_CONNECTION_DRAIN_SECONDS, and a log_config of exactly one block with
`enable = true` and `sample_rate` equal to RELAY_CELL_LOG_SAMPLE_RATE, the
declared default of a variable no environment file overrides. Any third path,
a different sample rate, disabled logging, another cell, or a replacement still
fails. The accepted paths are reported as `backendUpdate`, which the resume
branch now reads instead of the drain-only flag.

Verified against the real production plan: the masked, three-target plan for
production-gce-c7 contains exactly that cell's template, MIG, and backend
service and nothing else, and this validator returns
`{"changes":2,"backendUpdate":["connection_draining_timeout_sec","log_config.0"]}`.

Claude-Session: relay-same-cap-targets-cell-backend
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…, scripts, and 24 cloud-* workflows (stablyai#18413)

Phase 6 of the relay split: the relay's deploy/operate surface moves under cloud/ with 24 cloud-* workflows gated on ORCA_CLOUD_OPERATIONS_ENABLED, the Cloud SQL rollout lease action, the relay Terraform root (dual-accept identities for both repositories), scripts, docs, CODEOWNERS, and a terraform validate job in Cloud Verify.
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