Build, CI, and release
This page links the owners of each release path. Each owner keeps its own procedure.
Continuous integration
.github/workflows/ci.ymlowns pull-request and main checks plus the existing staging deploys. Every run checks engineering skills and documentation. CI selection adds the full Rust, database, infrastructure and image suite for product/build or mixed changes, and the runtime clinicalskills/count as product; unavailable comparisons also select full. A change undercrates/workspace-tools/sandbox/selects only thesandboxjob, which runsnix flake check ./crates/workspace-tools/sandbox; a rootCargo.tomlorCargo.lockchange selects it beside the full suite, andCI resultrequires it whenever it is selected. Browser tests are ignored by the ordinary test harness; their explicit targets run onworkflow_dispatch. A green routine CI run does not establish browser qualification. The workflow and its comments own the exact step list.maintakes pull requests through GitHub’s merge queue, set in the repository’smainruleset. A pull request passesCI resulton its own branch and need not be level withmain. Merging it, or auto-merge, adds it to the queue, which builds a candidate frommain, the entries ahead and this pull request, and runs the workflow on that candidate as amerge_groupevent. The pull request merges when the candidate’sCI resultpasses, so other merges do not send it back for another branch update and run. A candidate is scoped by what it adds to the commit it was built on, runs no deployment, and saves no build cache.- The other jobs are
foundations(offline cloud foundation contracts and mocked release adapters),images(the locked Nix images, built and run but not pushed),postgres(fresh migrations and the Postgres proofs),observability(the collector config and its OpenTofu roots), andcargo-deny(which appliesdeny.toml). deploy-public-site-stagingapplies the public site’s reviewed staging plan after full validation on pushes tomainonly when the repository variablePUBLIC_SITE_STAGING_DEPLOYisenabled(public site)..github/workflows/promote-public-site.ymlis a manual workflow that promotes the image staging tested for onemaincommit to public-site production, with theproductionenvironment’s approval (promotion)..github/workflows/doppler-watch.ymlis a separate daily workflow that watches the pinned Doppler CLI for releases and advisories.- PStack skill updates pushes
codex/update-pstack-skillswhen the vendored verification skills differ from upstream and opens or refreshes a review PR when Actions PR creation is enabled, or opens or refreshes a tracking issue with a compare link when repository settings disable Actions PR creation. It deletes the update branch and closes any open tracking issue oncemainis current. A maintainer with write access approves CI runs on any resulting PR. deploy-stagingruns after full validation on pushes tomainonly when the repository variableRUST_STAGING_DEPLOYisenabled. It downloads the successful image proof’s archives from the same run, verifies their commit and checksums, and publishes those exact images without rebuilding. It runs both migration jobs and moves thecoda-rust-stagingservices to Ready revisions on the new digests.physician-workeris updated once the scaling plan has created that service; direct staging rollout describes the three-day artifact retention, retry behavior and how to turn it off.- The staging release command in
workspace-toolsowns rollout receipts and final-state reconciliation. It updates only each service’s product container image and refuses a rollout that moves a sidecar or any other infrastructure-owned field (direct staging rollout). A partial rollout or unknown traffic is not success. Operating limits and failure investigation distinguishes declared resource limits from verified spending controls; privacy recovery describes the additional Duet restore gate. Mocked release tests and successful image checks do not qualify a hosted database restore. - Skills/docs-only main pushes skip both deployments. A successful
CI resultconfirms the selected checks passed, not that a deployment occurred. rust-toolchain.tomlis the one Rust pin. The Nix packages and dev shells read it throughnix/rust-toolchain.nix, thecijob installs it withrustup, andcargo-denyruns on it. A toolchain bump is its own PR, andci_scope.pytreats it as a dependency change. The Rust cache key includes the version, so it only changes in that PR.- A weekly
schedulerun onmaintakes the full path without browser qualification or deployments. Restoring therust-v2-*andpostgres-*-shard*entries keeps them from being evicted after seven idle days, so the first PR after a quiet week starts warm. The private Nix cache has no idle expiry, so onlymainpushes publish to it.workflow_dispatchalso runs the full path, plus browser qualification. - Postgres shard caches save one entry per
mainor scheduled commit, so concurrent merges don’t race for a key. Restores fall back from the same dependency set to the same shard. A PR saves only whenmainhad nothing for its dependency set. - Rust build caches are best effort. A restore, save, or cache-size failure can make the next build slower; it does not invalidate passing checks.
- CI installs
wasm-bindgen, mdBook, and lychee from pinned, checksum-verified release archives, not withcargo install. The comments next to each install step give the reason for its pin. - CI makes no anonymous GitHub downloads that it can authenticate, because GitHub throttles anonymous traffic first. Release archives (
release-archive, with curl, since theactimage has nogh) and the Doppler CLI come through the GitHub API with the job token;github.comdownload URLs ignore the token. OpenTofu fetches providers from those URLs and cannot send a token, sotofu-providerscaches them per job, keyed on the committed lock files. - CI runs on GitHub-hosted
ubuntu-24.04runners and servesactions/cachefrom GitHub’s workflow cache..actrcmapsubuntu-24.04and custom runner labels to theactimage, and.github/actionlint.yamldeclares self-hosted labels outside GitHub’s hosted set. - The repository variable
CI_JOB_RUNNERmoves thecijob to another runner label (such ascyrene-coda); deleting it returns the job to GitHub-hostedubuntu-24.04.1 - Run the workflow locally with
actfromnix develop; it needs the host’s Docker daemon, which the shell does not provide..actrcselects the runner image and thecijob. Check the workflow withactionlint .github/workflows/ci.yml. Where there is no Docker,coda-sandbox ci run [<repo-path-or-commit>] --job <job>fromcrates/workspace-tools/sandbox/runs the job of a committed revision the same way on a self-hosted CI spool, with no secrets, and exits with its status.1 .githooks/pre-commitruns the same rustfmt and clippy steps before a commit.
Private Nix binary cache
infra/gcp/nix-cache owns an isolated private GCS bucket
and bucket-scoped reader/writer identities. Select its project and remote-state
backend explicitly; apply only an operator-approved saved plan. It does not own
product deployment permissions. Nix uses GCS’s S3 interoperability endpoint, so
its HMAC credentials are distinct from the WIF credentials used by deploy jobs.
Keep HMAC and signing secrets in Doppler, outside OpenTofu state. Deliver the
reader credentials to CI separately from the writer credentials. The reader HMAC
pair is a repository secret, because every Nix job reads the cache and most run
outside any environment; it grants only object reads on this bucket. The GitHub
nix-cache-write environment must restrict deployment branches to main before
installing any writer or signing secrets. Never put those secrets at repository
scope: a workflow condition alone cannot protect secrets from edited PR code.
Only the nix-cache-publish job enters nix-cache-write. It runs on a main
push after images passes, rebuilds the allowlisted roots from the cache, and
uploads them. images itself holds no cache-writer secrets on any event.
Changing cache trust or rotating its signing key requires operator review.
Publishers share the nix-cache-main-writer concurrency group because create-only
object permissions cannot safely handle simultaneous uploads of the same object.
An active publisher is not cancelled; GitHub may replace an older pending one
with a newer one, whose closure supersedes it. The image proofs, CI result and
deployments stay outside that group and do not wait for publication, so a burst
of merges cannot cancel them. Any additional publisher must use the same
serialization policy rather than weakening the bucket permissions.
The cache retains compiled dependency artifacts as well as application outputs;
final image closures alone do not retain the intermediate Rust compilation work.
Native server, WebAssembly and patient-bank builds keep separate dependency
artifacts in nix/packages.nix. Cache reads preserve Nix’s
signature verification and the upstream substituter. A cache miss or outage must
still run the build and all image proofs. Disabling NIX_CACHE_ENABLED restores
the uncached workflow without changing the proof commands.
The cache contains private build inputs and outputs. Do not make the bucket public or copy credentials into the Nix store. Object-age deletion is not a safe cache garbage collector: deleting a NAR while retaining its metadata or references can break substitution. Retention changes must account for the reference graph.
Local cache warming with act
The local workflow builds the same
allowlisted roots as the hosted writer: three
dependency artifacts, six runtime, migration and job images, and the three dev
shells CI enters (agent, release, observability). It only warms the
binary cache; it does not load or push images, deploy services, or replace the
hosted image proofs. Hosted publication remains a protected main-push operation.
Local publication is an explicit operator-authorized exception for a reviewed,
full commit SHA. Serialize it with every other writer: do not run it while a
hosted or another local publication is active. act does not participate in
GitHub’s writer concurrency group.
Use a clean, standalone checkout containing the reviewed commit, not a linked
worktree: act copies files into the container, and a worktree’s .git file points
outside that copy. A local git clone --no-hardlinks /path/to/repository /path/to/cache-warm-checkout provides a standalone checkout without a GitHub token;
check out the reviewed SHA there. Commit the reviewed changes before running; do
not bypass cleanliness checks. The workflow verifies HEAD and tracked/untracked
changes before installation and credentials, and the publisher rechecks the
revision. Never pass unreviewed local code signing credentials.
From that checkout, enter nix develop .#agent. First check workflow selection and
syntax without credentials or a build:
EXPECTED_SHA="$(git rev-parse HEAD)"
act workflow_dispatch -W .github/workflows/nix-cache-local.yml -j nix-cache-local \
--var ACT=true --input expected_sha="$EXPECTED_SHA" \
--env-file /dev/null --secret-file /dev/null --var-file /dev/null --input-file /dev/null \
--container-daemon-socket - --list
# Repeat the command with --dryrun instead of --list to validate step planning.
The explicit -W and -j nix-cache-local are required: .actrc
defaults to -j ci. Both the manual event and the local ACT checks are required;
a hosted manual dispatch cannot publish. The installer uses
cachix/install-nix-action@v31 with --no-daemon: its single-user branch clears
build-users-group and exports the user profile, without systemd. The container
uses its own disposable /nix, with sandboxing disabled inside Docker. Do not add
host /nix, systemd, home, credential or Docker-socket mounts, --bind,
--privileged, or --reuse. The Docker daemon is needed by act on the host, not
inside the job. A cold build can need substantial time and disk space.
For an authorized write, first record the current NIX_CACHE_ENABLED repository
variable, set it to false with operator approval, and wait for active hosted
writers to finish. This pauses private reads as well as writes. Restore the exact
previous value after the local run, including failures. Do not assume a local lock
coordinates with GitHub’s concurrency group.
The launcher fetches only seven named settings from
Doppler: bucket, public key, writer HMAC pair, signing key, and reader HMAC pair.
It passes names rather than values on act arguments; no unrelated Doppler
secrets are forwarded. The writer HMAC remains bucket-scoped and create-only.
# Inside nix develop .#agent, with a clean reviewed standalone checkout
# and hosted publishers paused/drained under operator authorization:
python scripts/nix-cache/warm_nix_cache.py \
--expected-sha "$(git rev-parse HEAD)" \
--doppler-config stg_nix_cache --acknowledge-exclusive-writer
Do not use broad Doppler export/forwarding, .secrets files, literal secret
arguments, shell tracing, --verbose, --insecure-secrets, or environment dumps.
Only publication receives writer/signing credentials; the subsequent fresh-reader
step receives only reader credentials and the public key. Publication first sends
a leaf-derivation smoke closure, then the full closure twice to prove safe reuse.
The reader copies the server-dependency closure into an empty disposable store
from the private cache alone, without builds, and verifies contents and trust.
All temporary credential files and the reader store are removed on normal failure
or completion; act --rm also removes the job container on failure. Abrupt host
termination can require removing that specific stopped act container/volume; do
not prune unrelated Docker resources.
The helper reports stages, elapsed heartbeats, exit codes, and fixed error categories without printing raw SDK output. A heartbeat means the process is alive, not that an object was uploaded. It seeds repeated NAR content before the parallel copy to avoid create-only HEAD/PUT races within one publisher. This does not make multiple publishers safe. Unknown errors remain withheld; reproduce with synthetic local transport credentials rather than enabling verbose real-secret logs. Failures are fatal locally. No cache credentials are needed for list, dry-run, checkout verification, installation, or building from the upstream cache.
CI timing reports
scripts/ci_timings.py collects GitHub job and step
timings through gh api and renders inspectable graphs with raw data. The
CI result job retains a report artifact and links it from the step summary.
Reporting is best effort and does not replace the required result gate. Its live
snapshot excludes unfinished jobs; deployments occur after validation and must
not be counted as PR validation latency. Historical comparisons separate full
successful validation from lightweight, failed, cancelled and manual runs.
Secrets: Doppler
The rule is in AGENTS.md.
- Doppler project
coda-rusthas the parent configsdev,stgandprd. Locally, log in once withdoppler loginand prefix a command withdoppler run --;doppler.yamlselectsdev, and the shell loads it when a login exists and continues when it does not. Creating a config is an operator step, and this repository stores no token and no secret value. scripts/doppler-fill.shnames the secretsdevholds and what reads each one. It asks for each missing value at a hidden prompt and saves it to Doppler;--checklists which are set.- Physician and Duet services read per-product, per-role child configs, never a parent, because a parent-scoped token would carry the other product’s secrets. GCP deployment lists those configs and how each image starts under
doppler run. - The public marketing site reads no secrets and runs without Doppler. CI installs the pinned CLI only to verify it and fetches no secrets through it; GitHub jobs reach GCP through Workload Identity Federation.
cargo run -p workspace-tools -- install-doppler OUTPUT_PATH(doppler.rs) installs the pinned, checksum-verified CLI for images and runners.
Retained physician infrastructure references
| Root | Owns | Owner document |
|---|---|---|
infra/gcp/physician-runtime | The private GKE Autopilot cluster, Cloud SQL with IAM authentication, and the site and migration identities for physician-sample and physician-auth | README, including its tofu test and validate commands |
infra/gcp/foundation | Shared project foundation | main.tf |
infra/gcp/staging | The hosted synthetic integration platform on Cloud Run | README |
infra/gcp/clinical-evidence | The production Clinical Evidence runbook | README |
This workspace does not run init against a backend and does not apply these roots. Apply authority stays with the product repositories and the operator of the target project. GCP deployment says what runs Duet production.
Workspace-owned roots
| Root | Owns | Owner document |
|---|---|---|
infra/gcp/public-site | Public-site Cloud Run: staging behind IAP, production behind the load balancer without sign-in. This workspace owns both states and applies each only from a reviewed saved plan; production applies require explicit operator authorization. | Public site |
infra/gcp/rust-environments | The isolated Rust Cloud Run environments for the physician and Duet services. It needs an administrator bootstrap before its first apply. | GCP deployment |
infra/gcp/shared-mail | Production mail only in coda-health-prod, with separate state and operator-approved saved-plan applies. | Production shared mail |
infra/gcp/observability | The shared collector deployment | Observability |
iPhone and TestFlight
- The Rust bindings for iPhone are in
platform/ios(see the crate map).
Android and Google Play
nix develop .#android(nix/android-shell.nix) provides the Android SDK, NDK, emulator image, JDK and a Rust toolchain with the Android standard library. Run the commands below inside it.cargo run -p android -- build(crates/android) builds the debug APK for themobilemode shell.cargo run -p android -- avdcreates theduetAVD once, as CI does.cargo run -p duet-stubserves the host stand-in that the emulator calls.cargo run -p android -- windowopens the emulator, andcargo run -p android -- test coda.duet.ModeShellTestbuilds the APK and runs UI Automator (seecrates/android).- CI’s
Android emulatorjob runscargo run -p android -- test --headless coda.duet.ModeShellTeston a headless emulator. For now it runs only when CI is dispatched by hand: Actions, CI, Run workflow, choosing the branch (orgh workflow run ci.yml --ref <branch>). SettingMOBILE_ON_CHANGEinscripts/ci_scope.pymakes pull requests and main pushes run it whenever a change touches the APK’s build. - A debug APK is not a Play upload.
-
The
cyrene-codalabel is a disposable Firecracker microVM on Cyrene, the developer workstation. It runs the job in theactimage (catthehacker/ubuntu) rather than GitHub’s, so a step that passes underactpasses there, and it starts without GitHub’s runner cache, soactions/cacherestores miss. On Cyrene, agents work in thecoda-agentcontainer: Cursor connects to it with Remote-SSH, the main checkout is/agents/coda/src/coda-rust(snapshotted hourly), and git,ghanddopplerget a token limited to this repository (and a read-onlydevDoppler token) from a token broker on the host, which reads them from the developer’s keyring, so no token sits in a file in the container. The container cannot reach the host, the LAN or Tailscale and has no Docker;coda-sandbox ci runqueues its jobs on the same Firecracker runner.coda-sandbox worktree new <slug>makes each worktree under.worktrees/<slug>with atarget/that is a reflink clone of a seed of third-party build output on the build root its config names (/agents/coda/buildon Cyrene), so a worktree costs its source until a build diverges;coda-sandbox worktree --helplists the commands. Wherecoda-sandboxis not installed yet, run it from the checkout asnix run ./crates/workspace-tools/sandbox -- worktree new <slug>. The container, runner and their limits are described incrates/workspace-tools/sandbox/README.md, whose NixOS module declares them. ↩ ↩2