Skip to content

Verify & ship ​

Summarised from the monorepo agent docs (AGENTS.md, CODING_STANDARDS.md, docs/agent-workflow.md) and CD notes in README / prod-infra ADR. Not a substitute for reading those.

Definition of done ​

  1. bunx tsc --noEmit and bun test clean in packages you touched.
  2. Live-verified on the environment your worktree is bound to (side-env for feature work). “Should work” is not evidence. Staging live checks are lead-owned from main.
  3. Studio UI surfaces (preview, Code tab, composer, turn): bun scripts/e2e-smoke.ts --env <name>.
  4. Non-trivial branch has a check that can fail if the logic breaks.
  5. Frontend PRs: screenshots (desktop + phone where relevant); scripts/pr-assets.sh helps upload.
  6. New surprises → add an entry under the matching file in gotchas/ (or update/delete entries your change made untrue).

Loop ​

Build → simplify → review with fresh eyes → verify live. Green typecheck alone has never been sufficient.

Where agent instructions live (#594, merged) ​

Since #594 (merged 2026-10-07 20:55 IDT, yoni-monday, merge 449f7118, docs only; included in the 2026-10-08 staging deploy of dce2558b), root AGENTS.md no longer loads every rule on every task. It is a 24-line task router (334 lines / 2,927 words before, 203 words after): a "Before… / Read" table that points agents at the doc for the operation they are about to do, plus a short always-on Boundaries list.

Before…Read
Any taskgotchas/README.md to pick the relevant symptom sections (not whole area files)
Editing codeCODING_STANDARDS.md: Placement, Effect, Comments and prompts, Security, Checks
Editing the studio SPAapps/control-plane/web/AGENTS.md
Changing visual design, icons or copyDESIGN.md (owns icon policy; the old icon section in the standards was removed)
Starting a slice bigger than a small fix (delegate by default)docs/agent-workflow.md#delegation
Cloud resources, AWS, secretsdocs/agent-workflow.md#infrastructure-and-aws
Finishing runtime/UI work, choosing/deploying/tearing down an envdocs/agent-workflow.md#verification
Local or cloud-agent devdocs/agent-workflow.md#local-and-cloud-development
Committing, opening a PR, deferring findingsdocs/agent-workflow.md#shipping-and-tracking
Running a continuous issue queuedocs/agent-workflow.md#continuous-backlog-execution (not permission to expand a bounded task)

Always-on boundaries: never kill a process you did not start; durable staging/prod cloud resources are declared and provisioned in infra/pulumi; never hardcode secrets (test credentials obviously fake); staging deploys and verification are lead-only from a clean worktree on main, and branches use their own environment. Docs-only changes verify references and anchors instead of deploying.

When this wiki cites "AGENTS.md § …" for something older (Effect, placement, delegation, AWS profile), that text now lives in CODING_STANDARDS.md or docs/agent-workflow.md.

Agent process (#320, updated by #594) ​

First landed in AGENTS.md via #320 (merged; docs-only split from #318); since #594 it lives in docs/agent-workflow.md § Delegation. Prefer the monorepo file if this drifts.

  • Delegate by default when starting a slice bigger than a small fix: one scripted subagent call with the workflow field, split by component, two to four concurrent children when components are independent. Children build → simplify → review → fix and verify on their own side envs, scope diffs to exclusive owned paths, and never commit, stash, revert others' files or deploy staging. The lead defines contracts, reviews actual diffs, commits (explicit paths, never git add -A while children write) and owns staging verification/deploys. Give a contended component (usually conductor) one owner; steer toward convergence around 50 turns or 800k tokens.
  • bun install: agents may install in their own worktree with bun install --backend=copyfile. If node_modules is linked to main, remove the links first (see gotchas/testing-and-tooling.md). New worktrees use scripts/worktree-node-modules.sh, not a plain symlink. No new dependencies without asking. On macOS, a non-copyfile install can break esbuild — fix with rm -rf node_modules/@esbuild/darwin-arm64 && bun install --backend=copyfile.
  • Models (set explicitly per child; since #594): implementation children run on glm-5.3 (not Flash) at high reasoning effort; review children on claude-opus-5-5 with fresh context; claude-fable-5 only for deep research or judgement where depth matters, justified in the brief. Resolve the exact provider/id from the current registry. This replaces the earlier claude-sonnet-5-5 implementation / gemini-3.8-flash review split from #320 and #441.
  • Keep yourself for one-file fixes, live browser/staging verification, product judgement, credentials, or staging deploys.

Deploy rules (#222 + #241, merged) ​

#222 landed the exact-sha / candidate / release-evidence pipeline. #241 (merged) removed the STAGING_CD gate: every green verify of a push to main deploys candidate, then staging. Manual workflow_dispatch stays always allowed. Staging needs the admin read-only + infra allow-deletes setup or admin / candidate will fail closed.

Verify workflow (#273, merged) ​

Landed in #273 (merged). Also documented under gotchas/deploying.md.

  • Main never cancels. Concurrency was verify-<ref> with cancel-in-progress: true, so each push to main cancelled the previous merge’s verify. Deploy needs a green verify on the exact sha, so cancelled merges never shipped. Main now uses a group per sha and does not cancel; PR branches still cancel their own older run.
  • Plain queueing is not enough. A GitHub concurrency group keeps one running + one pending; a third arrival cancels the pending one. So main’s verifies run in parallel.
  • Stale-release guard. Parallel verifies mean an older merge can finish last and its deploy would roll staging back. On workflow_run deploys, scripts/deploy/stale-release.ts checks staging /health: if compare sha…stagingSha is ahead, candidate and staging are skipped (step summary says so). Any other answer or error deploys as before. Manual dispatches are never skipped (deliberate rollback still works).
  • Known leftover (#278). A late older run can still cancel the pending deploy of a newer merge in the deploy-staging concurrency group, then skip itself as stale, leaving staging behind until the next merge. Re-run the newest merge’s deploy by hand when staging’s sha lags main.
  • One CI job per check. bun scripts/verify.ts --list feeds a matrix (~37 jobs: one per workspace package + gates like biome, knip, builds, migrations, worker-boot; the web package is split into a typecheck and test shards since #538, three shards since #633), fail-fast: false. Aggregate job verify is green only when all pass. Chromium only where Playwright is used; Postgres + full history only for migrations.
  • Local bun run verify runs every check and prints a PASS/FAIL table (no longer stops at the first red package and hides gates).

Exact-sha gates ​

  • .github/workflows/deploy.yml resolves one 40-char sha for the whole run (from a green verify on main, or an explicit dispatch input). Dispatch without an input uses $GITHUB_SHA (the commit at dispatch), not a live resolve of main.
  • It deploys only that sha. require-checks.ts needs a green verify that came from a push on main of this repo, and the sha must still be reachable from main (identical or behind). A red verify, a PR-only verify, or an unreachable sha never deploys.
  • Run title (run-name): deploy <env> <sha> — this is the only place the run records what it was asked to deploy.

Verify gates (migration / workerd / journeys) ​

  • Verify fails when the drizzle journal misses a file or the DB has columns the schema doesn’t know.
  • worker-boot runs wrangler’s pinned workerd.
  • Entry scripts, smoke, bench, and evals are typechecked.
  • site-build (#387, merged): bun run build in apps/site prerenders every page (~9 s). A page that throws at build time fails here, not in CD’s site step.
  • Deterministic platform journeys with no model turn: create, data, publish, HMR, reload, tenant isolation, deletion. Missing teardown results fail the run; the journeys report records the release sha.
  • Real sign-in identities (#521, merged, staging only): the permissions journey's invited runtime-only user (e2e-runtime@e2e.brilliant.rocks) and signed-in link visitor (e2e-link-visitor@e2e.brilliant.rocks) are real Auth0 users whose passwords live in brilliant/staging/e2e-users. Prod has none. The first staging apply failed on an Auth0 connection-client error; the users only exist once #522 (open) merges and applies. See Secrets & environments — staging Auth0 test users.
  • e2e-gc only sweeps e2e-<8 base36> sandboxes created inside the window.
  • Unanswered create cleanup (#256, merged): scripts/e2e.ts sets E2EResources.requestedName before POST /apps. If the create times out (or otherwise never records an appId) after the server already made the workspace, cleanupUnansweredCreate deletes live workspaces with exactly that name through teardownJourney (contract e2e-cleanup-finds-unanswered-create, same path as journeys’ journey-teardown-finds-unanswered-create). Listing/delete failures surface as cleanup failures. Previously those leaks waited for e2e-gc (#232).

gdp lint gate (#647, merged) ​

On main since 2026-10-08 15:42 IDT (merge ff69849c). scripts/verify.ts has a repo-wide, fatal gdp gate right after biome: bun scripts/gdp-lint.ts runs only the gdp-ts lint rules (oxlint with every built-in category off; Biome stays the linter) over apps/control-plane/src and services/conductor/src. Run it alone with bun scripts/verify.ts --only gdp. Rules: no defineProof outside **/proofs/**, no assertion to a proof or Named type, no non-null assertion, no exported prover inside trusted modules. The script runs the repo’s own node_modules/.bin/oxlint with --format unix (a clean run prints nothing, in CI and in agent shells) from a temp config, so the repo globs carry a leading **/; a regression test in scripts/gdp-lint.test.ts plants a forged proof under apps/control-plane/src to prove the repo run really lints those files. Fix findings; don’t disable a rule. Strict mode is off. Why this exists: Authorization as compile-time proofs.

e2e after the permissions refactor (#543, merged) ​

Merged to main 2026-10-07 00:51 IDT by yoni-monday (merge dc7a424a). Two fixes to the five-step scripts/e2e.ts journey that the candidate (ci) and staging run:

  • Early admission_unavailable is retried. Within about 5 s of creating an app, the environment's builder admission can still answer 503 {"error":"admission_unavailable"} (seen on ci and permp04). It is retryable and admits nothing, so sendSessionPrompt in scripts/e2e-lib.ts now retries that exact 503 every 2 s for up to 60 s. Any other error, or the same one after 60 s, still fails the step.
  • STEP 2 checks the generated model, not a collection file. Collections are platform-managed since #516, so the agent no longer writes packages/data/src/collections/notes.ts. After the turn, scripts/e2e/steps/2-run-turn.ts greps packages/data/src/generated/manifest.json for the notes collection (plus a route under apps/web/src/routes/ mentioning notes), and on failure prints that manifest. See Permissions & app data.

Verified on side env permp04: bun scripts/e2e.ts --env permp04 passed all five steps; smoke was already 8/8 on the ci candidate.

Faster CI/CD critical path (#538, merged) ​

Merged to main 2026-10-07 08:50 IDT by yoni-monday (merge d35a20a2). Before it, a main verify took about 326 s (306 s in the web package) and CD about 1083 s, and the candidate rebuilt and pushed the agent image even when a matching tag was already in the registry, because it never resolved the tag to a digest. The PR shortens the serial path without dropping any gate. No speedup is measured yet: the PR only has local timings, and CD duration still needs a real candidate → staging run on main.

Verify (verify.yml, scripts/verify.ts)

  • The web package is split. pkg:apps/control-plane/web is now typecheck only, and its tests run as two shards, pkg:apps/control-plane/web:test-1 and :test-2, each with Bun 1.4 --isolate (fresh globals and module registry per file, so one file's DOM fake can't leak into the next). Local bun run verify runs the same checks.
  • The parent control-plane typecheck no longer repeats the web typecheck. When you change Studio code, run the web package's typecheck (or root verify).
  • New local actions dependency-cache (Bun and Chromium downloads only, never node_modules, build output, env state or secrets) and install-browser. bun install --frozen-lockfile still runs on every runner.

Deploy (deploy.yml)

  • One validated config render. CD renders canonical configs once into a snapshot bound to run, attempt, sha and environment, and passes it as BRILLIANT_CONFIG_SNAPSHOT. Reuse checks those plus base and rendered fingerprints and refuses modified or missing configs (file existence is not enough). Only conductor's digest pin may change after rendering. Standalone deploy.ts / secrets:push still render normally; never cache the snapshot between runners.
  • Two worker lanes (scripts/deploy/workers.ts). Foundation deploys template-share → dispatch alongside demo-data, and dispatch must serve the release before the control plane binds its new collection entrypoints. After the control plane, agents → workflows run alongside admin → site → staging-only evals. Each worker's deferred secrets follow its code and D1 migrations still run before admin/evals. Both lanes finish, and control-plane health is confirmed, before conductor runs (conductor.sh can stash, change checkout and rewrite image config, so it never shares a checkout with concurrent deploys). wait-health takes --worker to wait on one worker.
  • Candidate image reuse works. The candidate resolves a matching clean <sha12> / ci-<sha12> tag to a digest with authenticated registry access and the same manifest layer guard as a push, and records whether this run pushed. A same-sha rerun should show pushed=false with no Docker build or crane push. Developer <env>-<sha12> tags are never reused by the candidate. See Side environments: tag → digest reuse.
  • Less repeated work. No unconditional candidate control-plane bootstrap/rebind or repeated admin-role provisioning (cold-env bootstrap fallback and Pulumi reconciliation of side-ci stay). Infra ci/preview.sh runs one JSON Pulumi preview for both the resource summary and the deletion gate, instead of evaluating the program twice; apply keeps its own preview.
  • Older releases still deploy. A dispatch can check out a release older than main's workflow. Cache steps are inline, and a release without workers.ts takes the tested serial fallback (which still gets AWS credentials to fetch ids).

Unchanged: exact-sha main verify, candidate smoke/e2e before staging, staging health/smoke/e2e, production approval and status gates, destructive migration/infra gates, staging-only evals, and serial candidate EnvState writes. No new dependencies or durable resources.

First release after the merge may legitimately rebuild the image, because an image-input script (scripts/deploy/push-agent-image.sh) changed. Repo notes: gotchas/deploying.md ("Parallel CD deploys must share a validated render", "Infra preview used to evaluate the Pulumi program twice") and gotchas/testing-and-tooling.md (web shards).

Update (#633, merged 2026-10-08): web tests now run as three shards. With two, each shard took 613–648s against the verify step's 600s limit, and the timeout killed Chromium under whatever test was running, which showed up as random “browser has been closed” failures. Phone harnesses also rebuild once when Bun 1.4 reports an existing file as unresolvable.

Candidate before staging ​

  • Before staging sees the sha, the same commit is deployed to the long-lived ci side env (GitHub Environment candidate, OIDC role brilliant-gha-candidate).
  • Candidate must pass smoke + e2e. A red candidate leaves staging untouched.
  • Candidate refuses a state missing any worker, or whose admin read-only URL is not brilliant_admin_ro_<env> on brilliant_<env>.
  • Production skips the candidate job; it never runs on ci.

Staging and production ​

Deploy status (as of 2026-10-08 09:22 IDT): staging runs dce2558b. Run 37735680926 (deploy staging dce2558b…, automatic after the #611 merge) went green at 09:22 IDT and shipped everything merged since the previous tip: #611 (collection create requestIds scoped to the app), #606 (branch routing reverted), #588 (preview socket lease renewed instead of closed every 30 s), #594 (agent instructions no longer all loaded on every task; docs only), #591 (chat screenshot cards served again) and #592 (@cc code contracts, CONTRACTS and the cc-check gate removed). The previous staging tip was fe6314ed (#579, run 37622337607, green 2026-10-07 15:55 IDT; green deploys had resumed earlier that day with 92a5a77c, run 37617420591). Between the two, three staging deploys failed on 2026-10-07, each in the candidate's e2e step, so the deploy job was skipped and staging stayed on fe6314ed: 37636701486 (cc573568, #592, 17:26 IDT), 37637848258 (cb3f4291, #591, 17:34 IDT) and 37664483627 (449f7118, #594, 21:08 IDT). Run 37664290151 for 4f2129bc (#588) was cancelled and run 37678399354 for f6628296 (#606) was skipped. The #611 commit names the tenant-wide 409 conflict on collection create as why the e2e turn wrote no files and blocked staging promotion; see Permissions & app data — collection create requestIds.

History: deploy status after #516 (as of 2026-10-07 00:51 IDT). #516 merged 2026-10-06 21:54 IDT and deploy.yml was disabled (disabled_manually) right after. It was re-enabled around 22:00 IDT, and staging deploys were tried: dispatches for 2fa68450 (run 37516075011 failed at the candidate gate, which refused a sha with no successful verify on main), then for the #539 merge 09920110 (the automatic run 37517609977 was skipped and dispatch 37517799352 failed). deploy.yml was disabled again at 22:26 IDT, then re-enabled at 00:10 IDT on 2026-10-07 (GitHub API shows active). A dispatch deploy staging ab35dfcc for the #541 merge (run 37531941619) failed in the candidate's e2e STEP 2; #543 fixed the e2e script (see e2e after the permissions refactor). No deploy run for the #543 merge dc7a424a existed yet when this was written. The last successful staging deploy was f6d5a4c5 (run 37490656484, 18:48 IDT). Before retrying a deploy, confirm the cutover runbook prerequisites (new keys, legacy teardown and schema reset, reseed) are done; this page doesn't record whether they have run on staging. deploy.yml now deploys dispatch before the control plane. See Permissions & app data.

TargetPath
Side-envbun run deploy from service directories after env:up
StagingAfter a green candidate: secrets push → migrate → seven workers → wait-health (all /health report the release sha) → smoke + e2e → upload release manifest + evidence → write commit status brilliant/staging-verified
Prodworkflow_dispatch with an explicit sha behind GitHub Environment production. Needs staging to run that sha (or, since #919, a later main commit that descends from it) and the sha to carry a successful brilliant/staging-verified that passes the prod gate. Prod has no seeded E2E tenant, so smoke/e2e stay staging-only; prod’s check is that every worker serves the sha

Studio SPA deploy still uploads hidden source maps to Sentry then deletes every .map from dist/ before public assets ship (optional SENTRY_AUTH_TOKEN; #191, merged). #296 (merged) carries forward the previous build’s hashed chunks (via asset-manifest.json) for one more deploy so open tabs do not hit the SPA HTML fallback — see Control plane — carry chunks. #387 (merged) fetches that manifest from the control plane’s workers.dev host on canonical envs (after a host cutover the custom domain is the marketing site).

Prod gate / staging-verified ​

Any GITHUB_TOKEN writes commit statuses as github-actions[bot], so the creator is not trusted. Readers follow the status target_url to the Actions run and require:

  • main’s deploy.yml from this repo
  • at exactly that full 40-hex sha (no prefix match)
  • titled deploy staging <sha> (the new run-name)
  • completed green

head_sha is not checked (#513, merged). GitHub sets a workflow_run run’s head_sha to main’s tip when the run starts, not to the sha it deploys, so the run title is what binds the run to the sha.

Trust the run title, not head_sha (#513, merged) ​

Before #513 (yoni-monday, merged 2026-10-06 07:00 IDT, merge df289b72, fixes #501), the reader also required the run’s head_sha to equal the deployed sha. Any sha that had another PR merge while it was still in verify got rejected at the prod gate, even though staging served and verified it:

REJECTED: brilliant/staging-verified on <sha>… is untrusted (…/runs/<id>: run is at <newer sha>)

It first showed up in prod deploy 37318209927: 3552aaca was rejected because #493 merged (190b817f) while it was still in verify. What #513 changed:

  • deployRunMismatch in scripts/deploy/commit-status.ts no longer checks head_sha === sha;
  • the staging-verified-read-fails-closed contract now says head_sha must not be required to match, and why;
  • the gotchas/deploying.md entry that called this rejection intended is rewritten.

Everything else still has to hold for a success to count: the status creator is the workflow bot, target_url is exactly a run of this repo, the workflow is .github/workflows/deploy.yml, the event is workflow_run or workflow_dispatch, the branch is main in this repo, the title is exactly deploy staging <sha>, and the run completed with conclusion success. The title binds the run to the sha because main’s deploy.yml writes it from the same sha it deploys and tests (inputs.sha || workflow_run.head_sha). Runs on other branches or workflows are still rejected, and the live check that staging serves the sha doesn’t change.

If you still see the run is at <newer sha> rejection, the prod run is using a gate from before #513: dispatch prod from current main. The old workaround (redeploy staging at that sha with gh workflow run deploy.yml -f sha=<full 40-char sha>, then dispatch prod again) also still works.

Tests: a new case reads success for a green staging deploy with a newer head_sha (it fails with the old check restored), and the "run at another commit" rejection case is gone. scripts/deploy/commit-status passes 24/24. scripts/deploy/conductor.sh failed 4 tests on clean main too at merge time, which the PR says is older and unrelated.

The live sha check (scripts/deploy/prod-gate.ts → staging /health) also has to reach the control plane. #306 (merged) keeps the contract and brilliant/staging-verified status check unchanged, but stops treating a runner↔custom-domain blip as “staging is wrong”:

  • Default hosts: try STAGING_URLS.controlPlaneUrl (https://app.brilliant.rocks after #361) first, then the same Worker’s STAGING_WORKERS_DEV_URLS.controlPlaneUrl (brilliant-control-plane.brilliant-ai-staging.workers.dev). Both are staging’s control plane.
  • An explicit --url / STAGING_CONTROL_PLANE_URL is the only host asked (no fallback).
  • If both default hosts fail, the error names both. Re-dispatch a blocked prod deploy — the gate is a plain script, so the next run picks this up without a staging redeploy.

Release evidence ​

  • Every worker’s /health reports its sha; wait-health waits until all seven serve the release.
  • Each run uploads a release manifest (health, conductor image tag, newest migration, smoke/e2e outcomes) plus smoke/e2e artifacts.
  • If the run pushed a new agent image, smoke retries once; otherwise a red smoke stays red. Since #538 the candidate reads an explicit push verdict, so a rerun that reused an image built at the release sha counts as not pushed.

Other CD notes ​

  • Infra (Pulumi): .github/workflows/infra.yml — merge to main touching infra/pulumi/** or infra/secrets/** previews and ups staging; prod apply is a separate workflow_dispatch behind Environment infra-production. No PR previews; deletes/replaces blocked unless allow-deletes (#210, merged — see Hosting & Pulumi).
  • Secret fan-out after an admin save: secrets-sync.yml (workflow_dispatch with env + VersionId). Shares the same deploy-<environment> concurrency lock as code deploy; production still needs Environment approval. See Admin Secrets.
  • secrets:push: deferred secrets avoid Cloudflare 10053 wedges when a key moved from var to secret; a missing base secret fails loudly. Role keys reach only the steps that call AWS. #387 (merged): conductor/workflows CONTROL_PLANE_URL comes from origins.studio (stored ASM key ignored) — Secrets.
  • Site deploy fail-hard (#387, merged): writeRenderedConfigs refuses early and canonical envs throw when origins.site is missing (no skip-with-warning). Release health probes for control-plane use workers.dev. Prod needs infra.yml (origins.site) before the next prod deploy — Hosting — cutover hardening.
  • DATABASE_URL: deploy reads Pulumi add-on brilliant/<env>/database first, then falls back to the base blob. Admin Secrets UI still shows the base key only — keep the base key until admin reads the add-on.
  • Conductor image: separate from Worker; may not roll back with Worker code (GOTCHAS).
  • Admin Postgres: admin reads as brilliant_admin_ro through its own Hyperdrive (ADMIN_READONLY_DATABASE_URL / ADMIN_HYPERDRIVE). Role, password, add-on secret, and Hyperdrive are Pulumi-owned (#248, merged); grants apply after migrate — see Hosting & Pulumi.

Staging prerequisites (#241) ​

#241 turned on automatic staging CD. These must stay true on staging or candidate / admin fail closed:

  1. Staging infra apply with allow-deletes (removes empty brilliant-apps namespace; attaches candidate role policy).
  2. Staging admin read-only path from #248 (merged; supersedes the hand-create steps from #209): Pulumi owns brilliant_admin_ro, brilliant/staging/admin-readonly, and Hyperdrive ADMIN_HYPERDRIVE. Deploy applies grants from apps/admin/readonly-role.sql after migrate. Without ADMIN_HYPERDRIVE in cloudflare-ids, admin throws Missing hyperdrive entry in ids: ADMIN_HYPERDRIVE.

Contracts ​

No code contracts anymore. Since #592 (merged 2026-10-07 17:21 IDT; live on staging since 2026-10-08 09:22 IDT (deploy dce2558b, run 37735680926)), the repo has no @cc contracts, no root CONTRACTS file and no cc-check gate. Don't run cc-check list, and don't add @cc blocks or contract changes to a diff. Explain fail-open/closed choices and trust-boundary rules in a plain why comment and pin them with tests.

Code contracts removed (#592, merged) ​

#592 (merged 2026-10-07 17:21 IDT by yoni-monday, merge commit cc573568; opened by Brilliant Fixer at Yoni's request in Slack) removed code contracts from the repo entirely. It is live on staging since 2026-10-08 09:22 IDT (deploy dce2558b, run 37735680926); its own deploy run 37636701486 failed in the candidate e2e step.

  • Deleted: every @cc doc-comment contract (1,111 contracts in 568 .ts/.tsx files, comment lines only, no code changes; other JSDoc text and @param tags stay), root CONTRACTS, the code-contracts agent skill (.agents/skills/code-contracts, the .claude/skills/code-contracts symlink, and skills-lock.json).
  • Gate removed: cc-check is dropped from scripts/verify.ts (and verify.test.ts), so bun run verify and CI no longer run it.
  • Instructions removed: the AGENTS.md "Code contracts" section, the cc-check note in gotchas/testing-and-tooling.md, the "Contracts to respect" section of docs/new-integration.md, cc-check steps in the permissions plan docs, the @cc field in the QA ADR, and the Contracts: lines in docs/qa/feature-registry.md.
  • Left alone: historical design prose in docs/plans/*, ordinary "API contracts" wording, and packages/service-contracts (Effect Schema wire shapes, unrelated to @cc).
  • Review check: the bot review compared all 573 modified .ts/.tsx files with comments stripped; 570 were identical and the other 3 were the intended edits (scripts/verify.ts, scripts/verify.test.ts, one renamed test in apps/control-plane/test/admin.test.ts). CI was 49/49 green.
  • Heads-up: 11 touched files are conductor image inputs (packages/template/**, infra/agent-image/run-script-harness.ts), so the next conductor deploy rebuilds the image even though the change is comment-only (the first green staging deploy after it was dce2558b on 2026-10-08). #591 edits the dev-version-thumbnails-cannot-serve-owner-pixels block in services/conductor/src/routes/dev.ts; that conflict was resolved by dropping the block, and #591 merged 2026-10-07 17:29 IDT with the rule kept as a plain comment.

Open follow-ups from the review (owner's call, not done in #592):

  • 590 of the removed contracts were tagged label:security, and on some functions the @cc block was the only text stating the fail-closed rule (for example verifyReadonlyRole in apps/admin/src/lib/db-connection.ts). The review suggested checking that each such rule has a test, or keeping a one-line why comment.
  • docs/qa/feature-registry.md still cites three dangling ids (access-mutations-are-admin-only, access-patch-kv-sync-fail-closed, enablement-fails-open).
  • Reviewer and Fixer agent instructions outside the repo still asked for cc-check list and a "Code contracts" review section and need updating.

Contract ids quoted elsewhere in this wiki (for example @cc ... names on subsystem pages) record the design intent at the time; they no longer exist in source.

Container typecheck uses bun check (#712, merged) ​

PR #712 merged 2026-10-10 09:59 IDT.

  • The agent container image installs Bun canary (1.4.3), which ships the built-in multi-threaded bun check typechecker (ported from typescript-go).
  • Conductor buildTypecheckCmd and buildDeployBuildScript run bun check in container workspaces instead of node_modules/.bin/tsc --noEmit.
  • Template apps/web/package.json and root package.json typecheck scripts now call bun check.
  • LSP is unchanged: in-container LSP still runs tsgo --lsp --stdio; bun check is batch only.
  • Measured: about 10.6s cold with tsc vs 334ms (299 files) with bun check in packages/template.
  • Escape hatch: CONDUCTOR_PLATFORM_CONFIG=off keeps the legacy fallback command routing. Two-way door, blast radius limited to container typecheck and deploy verification.

Test bar (CODING_STANDARDS.md → Tests) ​

Landed on main via PR #779, merged 2026-10-11 11:52 IDT.

  • Every test must answer one question: name a realistic bug it catches that nothing else would. The rule now lives in the Tests section of CODING_STANDARDS.md.
  • Not allowed: duplicates of another test, copy/class-name/markup-only checks, tests that cannot fail (constants, exports exist), tests of the mock instead of the code, pass-through or library behaviour or type-checked shapes, and repeats of the deploy e2e happy path.
  • About 870 tests were deleted (33 files removed, 379 trimmed, about 14.4k lines), plus 11 source exports only those tests used.
  • Kept on purpose: security, data-safety and regression tests (signature forgery, authorization loosening, wiki private-parent access, tenant_id scoping, token leaks in share surfaces, side-env passphrase, deleteBlobPrefix guard, least-privilege Dockerfile, idempotent create/evaluate, public-app access policy, admin auth gate on destructive routes, BI forgery refusal, RunDO early chat() rejection), the 44 design-suite behaviours in scripts/design-suite/behaviours.ts, and all template db access-rule tests.
  • Bugs the removed tests would have caught now surface in kept tests, the deploy e2e (scripts/e2e.ts, scripts/e2e-smoke.ts), or review. Any deleted test can be restored from history.

Studio smoke clears the clarify turn gate (#913, merged) ​

#913 (merged to main 2026-10-14 11:55 IDT by yoni-monday, merge 67c87b62, fixes #912) teaches Studio smoke to dismiss the clarify setup card so the first prompt’s turn can start.

Why it mattered: since #900, a first Studio prompt can open the clarify card (“Question 1 of 3 … Pick for me / Skip, just build it”). Until that card is answered or skipped, the prompt is held (doEntries=0), so candidate → studio smoke failed preview_components_budget, turn_finishes_minimal, and publish_live.

What smoke does now:

  • clearTurnGates in scripts/e2e/browser-helpers.ts clicks labels from exported TURN_GATE_BUTTONS, including Skip, just build it (skip-clarify). The permissions journey’s clearGates gets the same label.
  • runPreviewComponentsBudget calls clearTurnGates inside its poll loop (the card can appear only after “Reading your request”), and logs cleared turn gate: ….
  • turn-gates.test.ts pins the skip-clarify label to the text QuestionCardSkipAllFooter renders.
  • STUDIO-ASK-001.golden stays skipped: smoke dismisses the card and never answers it; a dedicated journey is still needed.

Out of scope / follow-up: packages/clarify thresholds are unchanged. Skip this question no longer exists in the product for that flow (dead gate in both lists); tracked in #914.

Related: Troubleshooting: studio smoke held by clarify, Control plane: clarify card holds the first turn.

Studio smoke fails a held turn after 3m and says why (#918, merged) ​

#918 (merged to main 2026-10-14 13:42 IDT by yoni-monday, merge f216de61) shortens red candidate Studio smoke when nothing owns the prompt, fails billing refusals on sight, and puts the hold reason in the log instead of only in the screenshot artifact.

Why it mattered: every staging deploy from Oct 13 17:17 to Oct 14 11:55 (12 runs) failed turn_finishes_minimal with turn did not settle within 12m: doEntries=0 after the full 12-minute poll. The real hold was visible in the studio the whole time — first Out of credits. Ask an admin. (ci tenant, fixed by #907), then #900’s clarify card (fixed by #913) — but only in the screenshot artifact.

What smoke does on main:

  • A visible billing refusal ([data-testid="billing-blocked"], any data-reason) fails the turn immediately via billingBlockedReason: billing refusal holds the prompt: reason=…. (Review caught that gating on the composer being enabled would miss this case — a billing hold disables the composer.)
  • Otherwise studioTurnNeverStarted in scripts/e2e/verdicts.ts: no session entry and session idle for the whole start budget → hold. A run that owns the prompt marks the session busy before its first entry, so a slow container start does not trip this.
  • TURN_START_BUDGET_MS in scripts/e2e/smoke-workspace-checks.ts is 3 minutes. runTurnFinishesMinimal fails early with turn never started: no session entry for 3m … instead of waiting out the full turn budget.
  • turnHoldHint in scripts/e2e/browser-helpers.ts appends the composer placeholder="…" and any role=alert text to retry-pill, billing, never-started, and timeout failure messages, so the Actions log shows e.g. placeholder="Out of credits. Ask an admin.".
  • Unit coverage in scripts/e2e/verdicts.test.ts (budget boundary; not a hold when busy or entries>0).

Impact: red candidate runs go from ~16 min to ~5 min; green runs are unchanged. Blast radius is candidate and staging smoke verdicts only. Live evidence for the billing path and a cold-start green is the first candidate runs after this merge (smoke needs runner-only secrets).

Related: Clarify turn gate (#913), Troubleshooting: held turn / never started.

Prod gate accepts a staging that moved past the verified sha (#919, merged) ​

#919 (merged to main 2026-10-14 13:42 IDT by yoni-monday, merge f02981d5) loosens the production gate in one case and cleans up the dispatch sha.

Why it mattered: three of the week's four failed production dispatches were the gates, not the release. Two (runs 38418140364 and 38378220282) failed sha must be 7-40 lowercase hex characters because the sha was pasted with a leading space. One (run 38415204430) failed SHA mismatch: staging is running c652df3a…, but deploy target is 4699e170… because a newer merge reached staging between verifying the target and dispatching it, and the only way through was to redeploy staging to the older sha and race the next merge.

What landed:

  • Dispatch sha is trimmed. In .github/workflows/deploy.yml the release job strips whitespace from the dispatch sha input and lower-cases it before the 7-40 hex regex checks it.
  • Staging ahead of the target passes. scripts/deploy/prod-gate.ts still reads staging /health. When the sha there differs from the target, checkProductionGate asks GitHub's compare API (/compare/<target>...<staging sha>) whether staging is a descendant of the target. Only ahead passes.
  • Only a full 40-hex staging sha is compared. GitHub's compare endpoint resolves refs and prefixes, so a short or symbolic /health sha could look like a descendant. Anything that isn't a full sha (isFullSha) skips the compare and keeps the plain mismatch refusal.
  • Everything else still refuses. behind, diverged, or identical (a different sha string) keep the mismatch refusal, and the error now names the compare status (… (staging is behind the target)), so a staging rolled back behind the target cannot ship it. A compare API error fails closed with cannot compare <sha> with staging: ….
  • brilliant/staging-verified is still required on the target sha and still checked against its own run (see Trust the run title, not head_sha (#513)), so the target itself must have passed staging smoke and e2e.
  • The run log shows what prod will not get. On a pass, the gate prints [prod-gate] PASSED: <sha> is staging-verified; staging serves <staging sha>. When staging is past the target it adds [prod-gate] staging is <N> commit(s) past this release; production will not get: followed by each commit headline from the same compare response. Read that list before approving: a revert of something in this release would show up there.
  • The compare call uses the workflow's existing GITHUB_TOKEN (contents: read).

In practice: when a newer merge lands on staging after you verified a sha, just dispatch prod at the verified sha. You no longer need to redeploy staging back to it.

Evidence in the PR: scripts/deploy/prod-gate.test.ts (18 pass) covers ahead passing with its headlines, ahead without the status refused as absent, no compare call for a short staging sha, behind/diverged/identical refused with the status named, and a compare HTTP 500 failing closed. deploy-workflow.test.ts 9 pass; deploy-scripts-typecheck and biome ci pass. The PR notes conductor.test.ts legacy-path tests hit the 5s default timeout on a laptop with or without this change and pass with --timeout 30000.

Blast radius: manual production dispatch only; the PR calls it a two-way door.

Related: Troubleshooting: prod gate SHA mismatch / bad sha.

Deploy runs are titled by what they deploy (#963, merged) ​

#963 (merged to main 2026-10-15 14:58 IDT by yoni-monday, merge 4647c374, head d6b85dc5, branch deploy-run-title) changes the deploy.yml run title so the Actions run list says what each run ships, not only its sha. #962 had the same change on branch assets and was closed without merge at 14:58 IDT.

Run title, before and after:

  • Before: deploy staging <40-hex sha>
  • After: deploy staging: <description> (<40-hex sha>), for example deploy staging: Add a thing (#12) (<sha>)

Where the description comes from:

  • Automatic staging deploy (workflow_run after verify): the verify run's display_title, which is the head commit's first line. For a squash-merged PR that's the PR title plus (#N).
  • Manual dispatch: a new optional description input (gh workflow run deploy.yml -f sha=<full sha> -f description="…"). It defaults to manual dispatch.

What the prod gate trusts: deployRunMismatch in scripts/deploy/commit-status.ts accepts a staging run only when its title starts with deploy staging: and ends with (<full 40-hex sha>). The description is free text, so nothing in it counts. A title that mentions this sha inside the description but ends with another sha (deploy staging: revert (<sha>) (<other sha>)) is refused, as are the old sha-only title, a short sha, and a production title. The sha stays in the title on purpose: head_sha is still not the sha a run deployed (see Trust the run title, not head_sha (#513)). Keep the sha last if you ever touch run-name.

Operational note (now live): any staging run that finished under the old title, or was in flight at merge, no longer satisfies the prod gate. Re-dispatch staging for any sha you want to promote, then dispatch prod.

Evidence in the PR: commit-status.test.ts greens the new title and rejects the four cases above; bun test scripts/deploy/{commit-status,prod-gate,deploy-workflow,candidate,workers}.test.ts has 60 passing. The title expression itself only runs on GitHub, so the first real run after merge is its proof.

Blast radius: the prod gate; the PR calls it a two-way door.

Related: Troubleshooting: prod gate says a run "is not a staging deploy of this sha", Prod gate accepts a staging that moved past the verified sha (#919).

Release announcements in #brilliant-releases ​

Release announcements go to the #brilliant-releases channel in the monday Slack workspace (created 2026-10-08). Yoni asked the Release Herald bot to post them there, and Amichay asked for an update every time a new version reaches staging or production, written in product-manager-friendly language focused on customer value.

What gets posted, and when (as Release Herald set it up on 2026-10-08):

  • A short top-level post each time the deploy workflow in DaPulse/brilliant-ai finishes green on staging or production. Each post says which environment it is about (Yoni asked for staging vs prod to be called out).
  • The post leads with what customers gain, in plain language. A small footer carries the sha, the deploy run and the PR links.
  • It checks every 30 minutes, Sunday to Thursday, 8 AM to 8 PM Israel time. Anything that ships outside those hours is posted at the next check.
  • Failed or cancelled deploys are skipped. Several staging deploys between two checks are rolled into one post.
  • Updates with visible changes come with screenshots, usually the ones already attached to the PRs (Amichay's request, 2026-10-08).
  • The summaries come from PR descriptions, not hands-on testing.

Demo videos. The Demo Producer bot watches the channel. When a release update adds a big customer-facing feature, it posts a heads-up, records a short captioned demo on staging and shares the video in the thread. Each demo starts by saying whether the feature is on staging or production. For fixes and small tweaks it posts nothing.

Asking on demand. You can also tag Release Herald in the channel with a question, for example "which product changes were released to staging or production today?", and it answers in the thread from that day's merges and deploy runs.

Both routines run under the account of the person who asked for them, who can see or change them in their own chat with the bot in the Grok Bot app.

Source: Slack #brilliant-releases, 2026-10-08 (threads at 13:10, 19:09, 19:12 and 19:57 IDT).

Staging e2e accepts a root publish URL (#1006, merged) ​

PR #1006 "Fix staging e2e rejecting a root publish URL" (opened 2026-10-17 13:02 IDT, merged 2026-10-17 14:17 IDT by yoni-monday, merge 2e9b32db, final head 2ac459a7) fixes the staging deploy e2e after published apps moved to a public host at / (#994).

What broke. From cd675e63 (#994) on, staging publish answers https://<host-label>.brilliant-app.rocks/. Step 4 of scripts/e2e.ts (scripts/e2e/steps/4-publish.ts) only accepted /a/<script>/, so it threw publish answered no /a/<script> url and step 5 never opened the app. That failed every staging deploy on main from cd675e63 until this fix (four red runs on cd675e63, 1912b491 and 8a8c7c8e; last green staging deploy 74ecb3d0). Candidate stayed green because a side env has no apps domain and still answers the path form. Smoke publish_live also stayed green, because it opens whatever URL publish returns.

How the e2e reads a publish URL now (scripts/e2e/published-url.ts):

  • Step 4 accepts either the dispatch path form /a/<script>/ (relative or absolute, on any host) or a root host https://<label>.<apps domain>/ with no explicit port and a valid host label. Anything else, such as another domain, the studio host, or a root host on an env with no apps domain, throws publish answered no live app url: <url>.
  • It stores publishedHost (the host label for a root publish, or the /a/<script>/ segment for a path publish) and publishedUrl. The old scriptName field is gone, because a host label is not the Worker script name.
  • Step 5 opens the returned URL (plus the dedicated route and brilliant_token) instead of rebuilding ${dispatchUrl}/a/<script>/. On a root page it fails the run if a same-origin request goes under /a/ (the page is still on the old base), or if a same-origin static file (document, script, stylesheet, image, font) returns 400 or higher. The app's own fetch/xhr calls and /favicon.ico are ignored.

Apps domain per target. scripts/env/lib/targets.ts now has appsDomain: brilliant-app.rocks on staging, brilliant-app.ai on prod, and empty on a side env. These are literals copied from brilliant-infra:cloudflare.domains.apps in infra/pulumi/Pulumi.staging.yaml and Pulumi.prod.yaml; the resolveTargets test in scripts/env/test/render.test.ts reads both stack files and fails if a literal drifts. APPS_DOMAIN overrides the target value when running bun scripts/e2e.ts.

Not covered yet: the 308 from the legacy /a/<script>/ URL to the root host is not asserted, because the publish body ({ url, basePath: "/", versionId, … }) and GET /apps/:id don't include the Worker id. scripts/e2e-journeys.ts still requires /a/<script> but is not run by deploy.yml.

Related: Troubleshooting: staging e2e fails at step 4 with publish answered no /a/<script> url.