Skip to content

Release Manager

The Release Manager is a Cloudflare Worker that automates the PR-to-production pipeline. It evaluates QA results, requests Slack approval, squash-merges PRs, monitors deployments, and handles rollbacks on failure.

It runs as a standalone worker at apps/agents/release/ — separate from the main Nucleus app worker.

Every PR tracked by the release manager moves through these states:

StateMeaning
openPR just opened or re-evaluated
qa-pendingWaiting for UX and Tech QA agents to post comments
blocked-p1P1 issues found — merge blocked until fixed
awaiting-approvalQA passed — waiting for human /release merge command
approvedHuman approved — merge will happen on next tick
deployingSquash-merged, monitoring CI deploy workflow
deployedDeploy succeeded, health check passed
merge-failedGitHub merge API returned an error
deploy-failedCI workflow failed or health check failed
user-blockedManually blocked via /release block command
  1. Check any in-flight deployments (KV-based, non-blocking)
  2. Fetch all open PRs targeting main
  3. For each PR, evaluate QA agent comments and advance state
  4. If approved, squash-merge and start deploy monitoring

The worker reads structured comments from the UX and Tech QA agents:

  • Both agents must have posted for QA to be considered complete
  • P1 findings block the merge and create fix task issues
  • P2/P3 findings are logged but non-blocking

After merge, the worker writes a deploy monitor state to KV and checks it on subsequent cron ticks (no long-running polling loops). It:

  1. Finds the GitHub Actions workflow run for the merge SHA
  2. Polls workflow status across ticks until complete
  3. Hits the health endpoint to verify the deploy is live
  4. On failure, creates a revert PR and a P1 issue
CommandDescription
/release statusShow the current release queue (default)
/release merge <pr> [skip-qa]Approve and merge a PR (optionally skip QA gate)
/release block <pr> [reason]Block a PR from merging
/release unblock <pr>Unblock a previously blocked PR
/release rollbackInstructions for manual rollback
/release helpShow the command reference

When a PR requires approval, the worker posts a Slack message with Approve and Reject buttons. Approving advances the PR to approved state.

  • PR ready for merge (QA passed)
  • PR blocked by P1 issues (with fix task links)
  • Merge in progress
  • Deploy success (with closed issue list)
  • Deploy failure (with revert status)
  • Merge conflict (manual resolution required)
  • GitHub webhook: Verified via X-Hub-Signature-256 HMAC-SHA256
  • Slack actions/commands: Verified via x-slack-signature HMAC-SHA256
  • Agent API (/api/release, /api/status): Requires X-Agent-Token header matching AGENT_SECRET
  • Health endpoint: Public (no auth needed)
SecretPurpose
GITHUB_TOKENGitHub API access (repo scope)
GITHUB_WEBHOOK_SECRETGitHub webhook signature verification
AGENT_SECRETAgent-to-agent API auth token
SLACK_BOT_TOKENSlack Bot User OAuth token
SLACK_SIGNING_SECRETSlack request signature verification
VarValue
GITHUB_OWNERdotdev-brendon
GITHUB_REPOnucleus
SLACK_RELEASES_CHANNELSlack channel ID for notifications
  • RELEASE_STATE — Stores PR state machine records (release:pr:{number}), approval state (release:approval:{number}), and deploy monitor state (deploy:monitor:{number})
FilePurpose
src/index.tsHono routes, scheduled handler, state machine
src/types.tsType definitions (Env, PRRecord, etc.)
src/merge.tsGitHub merge, revert, label, and issue operations
src/deploy-monitor.tsNon-blocking deploy monitoring via KV
src/qa-evaluator.tsParse QA agent comments, compute readiness
src/approval.tsSlack approval flow, block/unblock
src/slack.tsSlack signature verification, Block Kit builders
src/github-client.tsShared GitHub REST API helpers