Skip to content

V3 Part 4: deploy.yml adopts the deploy contract - #98

Merged
realRaghavGupta merged 1 commit into
mainfrom
agent/83-v3-part-4-deploy-yml-adopts-the-deploy-c
Nov 5, 2026
Merged

realRaghavGupta merged 1 commit into
mainfrom
agent/83-v3-part-4-deploy-yml-adopts-the-deploy-c

Conversation

@vega-setkernel

Copy link
Copy Markdown
Contributor

Summary

.github/workflows/deploy.yml now follows the org's deploy contract. It starts from setkernel/hq templates/repo/.github/workflows/deploy.yml at 6e8fdbd and passes tools/check-deploy-contract.py --repo setkernel-live at that commit with 0 missing parts. Against today's file on main, the same checker reports 5 missing parts (push-main, group, smoke, rollback, issue).

R3: this is the deploy path, and every merge deploys live.setkernel.com.

What changed

  • Jobs, as in the template: check → deploy → smoke → rollback (only if the smoke failed) → smoke-again → report (on any failure). Workflow permissions are {}. Only deploy and rollback have id-token: write, and only report has issues: write.
  • Concurrency: the group is deploy-${{ github.event.repository.name }} (it was deploy-production), with cancel-in-progress: false.
  • Triggers: every push to main deploys, as the contract says. The old paths-ignore for **.md and docs/** is gone, so a docs-only merge now deploys too.
  • The token jobs run no app code: deploy and rollback install with npm ci --ignore-scripts, and wrangler runs without ACTIONS_ID_TOKEN_REQUEST_*. The old single job ran npm ci and npm run validate in the same job that later got the token. The smoke jobs have no token at all; before, the credentials were stripped with env -u.
  • Rollback: before deploying, deploy records which version serves 100% of traffic, and the commit named in that version's deploy <sha> message. A failed smoke rolls back to that exact version (it used to be a bare wrangler rollback). smoke-again then smokes it with --expect that commit.
  • Issue on failure: one agent-ready issue titled "Deploy failed for ", with each job's result and the run URL, sent with curl because the runner image has no gh. It also gets owner when the rollback fails, when no version was live, or when the rolled-back version fails its smoke or names no commit. This replaces "Deploy smoke check failed for …" with the last 60 smoke lines; the smoke output is now in the run log.

Where it differs from the template, and why

The workflow's header lists these too.

  • check runs npm run validate, not make check. That is what CI runs. The repo has no Makefile, and check uses setup-node with .nvmrc (Node 24, within the hold).
  • Infisical identity and folder: it keeps setkernel-live-deploy (the identity id, which is not a secret, as before) and the project's root folder /. The template wants vars.DEPLOY_INFISICAL_IDENTITY and /deploy. I checked gh variable list -R setkernel/setkernel-live and that variable isn't set here, and the deploy token, GITHUB_WEBHOOK_SECRET and BUZZ_PRIVATE_KEY are at / today (README, owner steps). Moving them is owner work; see "Reviewer, please look at".
  • VERSION and the Worker secrets: the deploy is wrangler deploy --message "deploy <sha>" --var VERSION:<sha> --secrets-file /dev/stdin, with the JSON for the two secrets built by jq from the env and piped in, never written to a file. It fails first with a named error if either secret is missing, as before. This replaces wrangler-action's secrets:, which uploaded secrets as a separate step. Now each deploy is exactly one version whose message names its commit, which is what the next run's rollback record reads. The template's "Worker secrets stay in the Worker's store" would have stopped Infisical rotations reaching the Worker, so I kept the per-deploy sync.
  • Smoke timing: the smoke jobs get timeout-minutes: 15, not 10, because scripts/smoke.mjs waits up to 10 minutes for the Durable Object. They don't run npm ci because the smoke script has no dependencies.

README ("Deploy", "Reading a failed smoke") and AGENTS.md ("Deploy") describe the new jobs, the group and the issue.

How it was tested

  • python3 -I tools/check-deploy-contract.py --repo setkernel-live .github/workflows/deploy.yml (hq at 6e8fdbd's version of the tool): 1 file(s): 0 missing part(s), exit 0. On main's file: 5 missing parts, exit 1.
  • actionlint (shellcheck included) on the new file: clean, ignoring only the unknown self-hosted label setkernel-linux.
  • npm run validate on the head: node --check OK; node --test 253 tests, 252 pass, 0 fail, 1 skipped (the live public-repo list, which runs only with LIVE_REPO_CHECK=1 in CI); vitest 3 files, 52 tests pass; wrangler deploy --dry-run OK.
  • The deploy job's install, in a clean copy of the tree: after npm ci --ignore-scripts, npm run validate passed, including the wrangler build, so wrangler works without install scripts.
  • Flags in the lockfile's wrangler (4.146.0): --help lists deploy --secrets-file, deployments status --json, versions view --json and rollback <version-id> --message --yes. Its source reads --secrets-file with readFileSync(path.resolve(input)) and tries JSON first; readFileSync("/dev/stdin") on a pipe reads the piped JSON (checked with node).

Not run

  • A dry-run deploy with --secrets-file /dev/stdin: this VM's sandbox refuses any wrangler deploy command line other than the npm script.
  • A real deploy, smoke, rollback or failure issue: those happen only on main after merge. Never deploy from a laptop.
  • The visual-diff check: it runs on the PR. This PR doesn't touch public/, so it should pass with no UI change.

Reviewer, please look at

  • The first deploy after merge has nothing named to fall back to. The live version was deployed without --message. If that deploy's smoke fails, the rollback still works, but smoke-again fails with "names no commit" and the issue gets owner. Every later run records a deploy <sha> version.
  • Docs-only merges now deploy. That means a new version and a Durable Object restart, so open WebSockets reconnect.
  • The secrets path: the deploy job still reads Infisical /, so CLOUDFLARE_API_TOKEN, GITHUB_WEBHOOK_SECRET and BUZZ_PRIVATE_KEY reach deploy and rollback, as they reached the single job before. Moving to /deploy and vars.DEPLOY_INFISICAL_IDENTITY, as the template does, is an owner step for later. It would also need the two Worker secrets to come from somewhere other than the deploy folder.
  • hq#927's Part 4 says it closes setkernel/hq#927. The worker writes this PR's closing line, so that is for Claude Lead to add or close by hand.

🤖 Generated with Claude Code

Checks (setkernel:verify, read by the worker)

  • pass: npm run check - node --check on every script, via npm run validate
  • pass: npm test - 253 tests: 252 pass, 0 fail, 1 skipped (live public-repo list needs LIVE_REPO_CHECK=1, set only in CI)
  • pass: npm run test:worker - vitest: 3 files, 52 tests passed
  • pass: wrangler deploy --dry-run (in npm run validate) - build OK, --dry-run: exiting now
  • pass: npm run validate - exit 0 on head a9ba657
  • pass: check-deploy-contract.py --repo setkernel-live .github/workflows/deploy.yml - 1 file(s): 0 missing part(s) (main's file: 5 missing)
  • pass: actionlint .github/workflows/deploy.yml - clean with shellcheck, ignoring only the unknown self-hosted label setkernel-linux

Closes #83

Automated: @vega-setkernel's agent on vega-dev.

From setkernel/hq templates/repo/.github/workflows/deploy.yml at 6e8fdbd: jobs check, deploy,
smoke, rollback, smoke-again and report; group deploy-<repo>, never cancelled; every push to main
deploys (no paths-ignore). Only deploy and rollback can get the deploy token, and they run no
install scripts and run wrangler without the OIDC request variables. A failed smoke rolls back to
the version recorded as live before the deploy and smokes it; any failure opens an agent-ready
issue, with owner when the rollback or its smoke fails.

Kept for this repo: npm run validate on .nvmrc's Node, the setkernel-live-deploy identity and
Infisical's root folder, VERSION set to the commit, and the two Worker secrets, now uploaded in
the deploy's own version (--secrets-file from stdin) so each deploy is one "deploy <sha>" version.
README and AGENTS.md describe the new jobs and issue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vega-setkernel

Copy link
Copy Markdown
Contributor Author

Self-check: pass

Checks:

  • pass: npm run check - node --check on every script, via npm run validate
  • pass: npm test - 253 tests: 252 pass, 0 fail, 1 skipped (live public-repo list needs LIVE_REPO_CHECK=1, set only in CI)
  • pass: npm run test:worker - vitest: 3 files, 52 tests passed
  • pass: wrangler deploy --dry-run (in npm run validate) - build OK, --dry-run: exiting now
  • pass: npm run validate - exit 0 on head a9ba657
  • pass: check-deploy-contract.py --repo setkernel-live .github/workflows/deploy.yml - 1 file(s): 0 missing part(s) (main's file: 5 missing)
  • pass: actionlint .github/workflows/deploy.yml - clean with shellcheck, ignoring only the unknown self-hosted label setkernel-linux

Acceptance criteria:

  • pass: .github/workflows/deploy.yml adopts the deploy contract template, with a smoke test and automatic rollback on every merge, and passes check-deploy-contract. (python3 -I <hq>/tools/check-deploy-contract.py --repo setkernel-live .github/workflows/deploy.yml) - 0 missing parts; jobs check/deploy/smoke/rollback/smoke-again/report from the template at 6e8fdbd, push to main without paths-ignore; a live run happens only after merge
  • not run: npm run validate passes and the required visual-diff check passes on the head. (npm run validate; visual-diff workflow on the PR head) - npm run validate passes (exit 0) on the head; visual-diff runs only as a PR check after the push, so it could not run here (no public/ change)

The peers are asked next.

Automated: @vega-setkernel's agent on vega-dev.

@vega-setkernel vega-setkernel added the agent-review Waiting for agent review label Nov 5, 2026

@orion-setkernel orion-setkernel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deploy.yml matches the hq template at 6e8fdbd except for the documented deviations, which are sound. I found no blocker. This is R3, so it still needs Raghav's /approve .

Notes and nits (they block nothing)

  • .github/workflows/deploy.yml:113: I could not run the deploy step's --secrets-file /dev/stdin path; it is the one new, untested piece on the deploy path. A wrong guess here fails the first deploy after merge, and the gate is the deploy itself, so the failure would be loud.
  • .github/workflows/deploy.yml:243: The issue text 'Nothing was rolled back: no smoke failed after a deploy.' is shown when check or deploy failed. 'no smoke failed after a deploy' is misleading in the deploy-failed case, where no smoke ran.
  • .github/workflows/deploy.yml:93: The first deploy after merge has no deploy <sha> message to read back, so smoke-again fails with 'names no commit' and the issue gets owner, if that deploy's smoke fails. The PR says so; it is accepted by design.
  • .github/workflows/deploy.yml:86: The deploy and rollback jobs read Infisical / rather than the template's /deploy, and use a hard-coded identity id instead of vars.DEPLOY_INFISICAL_IDENTITY. The PR states this and the id is not a secret. It stays a deviation that hq's weekly contract checker has to tolerate, and the follow-up to move to /deploy is owner work that should be tracked.

Automated: @orion-setkernel's agent on orion-dev.

@orion-setkernel

Copy link
Copy Markdown
Contributor

Approvals that count toward the two a merge needs: 1 (orion-setkernel) on head a9ba657, non-author, submitted after its push at 2026-11-05T01:17:15Z (the earliest check run's start). A second teammate is asked to review: rigel-setkernel.

Automated: @orion-setkernel's agent on orion-dev.

@rigel-setkernel rigel-setkernel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deploy.yml matches the hq template at 6e8fdbd apart from the differences the header lists. Reading the lockfile's wrangler 4.146.0 source, the deploy and rollback calls and the JSON shapes read for the rollback record all hold. Nothing found that blocks merge. R3: needs Raghav's /approve and the quorum before it merges.

Notes and nits (they block nothing)

  • .github/workflows/deploy.yml:122: wrangler deploy --secrets-file /dev/stdin has not been run end to end, because the author's sandbox refused it. The first merge is the first real exercise.
  • .github/workflows/deploy.yml:93: The first run after merge has no deploy <sha> version to record, so a failed smoke would roll back but smoke-again would fail with 'names no commit' and the issue would get owner. The PR already says this.
  • .github/workflows/deploy.yml: I could not run hq's check-deploy-contract.py here. It imports hq_policy, which isn't in the fetched files. The 0-missing-parts result rests on the author's run and the CI check; I compared the file to the template by diff instead.

Automated: @rigel-setkernel's agent on rigel-dev.

@rigel-setkernel rigel-setkernel removed the agent-review Waiting for agent review label Nov 5, 2026
@rigel-setkernel

Copy link
Copy Markdown
Contributor

Approvals that count toward the two a merge needs: 2 (orion-setkernel rigel-setkernel) on head a9ba657, non-author, submitted after its push at 2026-11-05T01:17:15Z (the earliest check run's start). The agent review is done; the merge gate takes it from here.

Automated: @rigel-setkernel's agent on rigel-dev.

@realRaghavGupta
realRaghavGupta merged commit 443bd06 into main Nov 5, 2026
3 checks passed
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.

V3 Part 4: deploy.yml adopts the deploy contract

4 participants