Kortix release

From kortix-ai/suna · View interactive version

Kortix release is an AI agent skill from the GitHub repository kortix-ai/suna. How to cut a Kortix production release — the versioning philosophy (when patch vs minor vs major) and the exact flow: one Promote to Production dispatch takes the dev HEAD through staging to a release PR into prod, whose one release suite is the only gate; fix forward on dev until it is green, then

How to use this skill

Skill file

Kortix Release

How a clean, accurate production release happens. Three parts: what version

(the bump philosophy), how a candidate gets tested (one Promote dispatch takes

the dev HEAD through staging to a release PR; its one release suite is the

only gate), and how prod gets it (merge → deploy → verify). The release notes you write become the GitHub Release, which

the public /changelog/releases page (Release history) renders as written, and the

weekly /changelog page merges by section (New / Improved / Fixed) into the

week the release was published — so they must reflect what actually shipped,

nothing invented, nothing missed.

Pairs with kortix-voice (how the notes read) and kortix-rollback (the

reverse direction). The version source of truth is the root VERSION file;

vX.Y.Z tags are immutable and map 1:1 to a commit + image.

This file is the single source of truth for the promotion flow. AGENTS.md

(CLAUDE.md), .agents/skills/contributing/SKILL.md, and

.agents/skills/testing/SKILL.md state only their own slice — what CI runs on

a PR into dev versus the release PR — and point here for the rest.

0. Golden rule — one dispatch, one suite, one gate

The only normal way to change prod is one Promote to Production dispatch.

It takes the dev HEAD, merges it into staging itself (a PR that runs

nothing), waits until staging serves that SHA, and opens the release PR into

prod. That PR runs the release suite once: the contract lanes on the

release tree, the deployed smoke and the browser journeys against staging,

CI, CodeQL and the scanners. Its check full suite + quality gates requires

every one of them green, and it is the only check that blocks anything

(testing reset, 2026-10-16). Never git push …:prod, never open a manual PR

into prod, never cherry-pick onto prod.

Nothing else tests the release tree: no Tests run on a push to dev, no

check on the PR into staging. Staging is the deploy target the suite runs

against, not a test stage. The nightly Tests run on dev (contract lanes,

no browser) warns early: check it before you promote, and fix dev forward

when it is red, because the release suite fails on the same lanes.

dev is the dev trunk. It can move fast and can temporarily be broken.

Production promotion always reads from staging.

1. Versioning philosophy — what bump?

Semver MAJOR.MINOR.PATCH. Default to patch. When unsure, patch.

copy, docs, infra, polish. This is most releases. Ship often; keep them small.

new user-facing capability. Use sparingly, when a release is genuinely "a thing."

jump v0.x → 1.0 was). Rare.

If the change set is "fixes + a couple small features" → patch. Don't inflate.

2. The flow (do this every time)

Step 1 — `dev` takes verified merges; the nightly run warns

dev takes PRs with no required CI: the developer verifies the change by

using it (the testing skill). A push to dev runs no Tests lane. The

nightly run on dev (.github/workflows/tests.yml, 05:41 UTC) comments a red

result on the commit. Fix it forward on dev, or revert the culprit after 1 hour.

Step 2 — check the nightly run and cost migrations

gh run list --repo kortix-ai/CompanyOS --workflow tests.yml --branch dev --event schedule \
  --limit 1 --json conclusion,headSha --jq '.[0]'

A red night means fix dev first. Then cost every new migration (Step 5)

before you dispatch: Promote applies it to the staging database within minutes.

Then run the release suite's fast tripwires on the dev SHA you promote:

git fetch origin dev && git switch --detach origin/dev   # in your own worktree
pnpm install --frozen-lockfile && bash scripts/pre-promote-tripwires.sh

It takes about 2.5 min. It names each red check, and you fix each one on

dev before the dispatch. v0.15.11 needed 3 release-suite runs (about 1 h

each) for failures this script finds in minutes (the learnings ledger,

2026-11-14).

The script runs no DB suite and only a few package tests. When the last

nightly is red, or dev moved since it ran, also run the contract lanes on

the dev SHA you promote (about 15 min) and fix every red lane first:

gh workflow run tests.yml --repo kortix-ai/CompanyOS --ref dev

v0.16.5 found 6 reds this way that the script missed (the learnings ledger,

2026-11-24).

Step 3 — one dispatch: Promote to Production

Write the title and notes (Step 7 shows how), then:

gh workflow run promote.yml --repo kortix-ai/CompanyOS --ref dev \
  -f ref=dev -f title="<title>" -f notes="$(cat <<'EOF'
<markdown notes>
EOF
)" -f bump=patch

Promote then:

  1. Resolves ref (default dev) to a SHA and pushes it to

promote/dev-<sha10>. On a conflict with staging it builds the branch as

a merge whose tree equals the dev SHA's tree (git read-tree --reset -u).

  1. Opens the PR into staging and merges it as a merge commit (never squash).

That PR runs no check.

  1. Dispatches build-staging.yml for the merge SHA (a merge made with the

workflow token starts no push workflow), waits for Build and Deploy

Staging, then needs 8 consecutive /health reads where API, gateway and web

all serve the merge SHA.

  1. Creates or updates release/vX.Y.Z, opens the PR into prod, and approves

the held runs on it, so the release suite starts.

-f dry_run=true prints every decision (SHA, conflict, PR, version) and

changes nothing. -f ref=staging skips the dev leg: the hotfix path for a

commit already on staging.

A failed promote resumes. When the run fails after the staging merge

(build, deploy or the /health proof), fix the cause and re-run the run (or

dispatch again with the same ref). The plan step finds the merged

promote/dev-<sha10> PR; while its merge is still the staging tip it skips the

merge, skips the build when the three staging manifests already passed, and

always repeats the 8-read /health proof. When staging moved on after that

merge, use -f ref=staging. A re-promote cancels the gate run of the release

PR's older head itself.

Step 4 — the release suite is the gate; fix forward

Merge only when full suite + quality gates is green on the release PR's head

SHA. Never fix on the release or promotion branch, and never weaken a check

(the fix-forward traps are in

references/fix-forward-traps.md).

The candidate is frozen on staging. A red suite is fixed on the tree

that was promoted, not on a newer dev: every re-promote from dev pulls in

new merges, and on 2026-10-28 five cycles in a row each failed on new dev

drift (Marko: "pin it to whatever got promoted to staging & fix it on staging

until it's green"). Per fix:

  1. Merge the fix into dev through a PR, as usual, so dev keeps it.
  2. Cherry-pick that commit onto staging through a PR:

git switch -c stage-fix/<slug> origin/staging && git cherry-pick <dev sha>.

Then regenerate the generated files on that branch and commit any change:

bash .agents/skills/learnings/scripts/index.sh and

node packages/ui/scripts/gen-i18n-catalog.mjs. dev's copy can list an

entry or a key from a commit that staging lacks (the learnings ledger,

2026-11-02). Push, gh pr create --base staging, gh pr merge <n> --merge.

The push to staging starts Build Staging and Deploy Staging.

  1. When /health on the three staging surfaces serves the new staging SHA,

dispatch promote.yml -f ref=staging (no dev leg). It updates the

release branch, and the suite runs once on the new tree.

The next normal Promote from dev merges cleanly: dev already holds every

fix that staging got.

Step 5 — cost every new migration against prod, before merging

For every migration file new in the diff versus what's already applied to prod

(select name from kortix_migrations.pgmigrations order by id desc limit 5; on

the real prod database), run it read-only against prod first:

PGOPTIONS='-c default_transaction_read_only=on -c statement_timeout=15000' \
  psql "$PROD_DATABASE_URL" -c "explain (analyze, buffers) <the migration's statement, read-only form>"

Get exact row counts, table size, and lock profile for the target table before

judging a migration safe. Pre-build any large CREATE INDEX CONCURRENTLY out of

band on prod, with the migration's exact statement, so the real deploy step

is a no-op (CREATE INDEX CONCURRENTLY IF NOT EXISTS on an index that already

exists does nothing). If the deploy step still hits 55P03 (lock timeout),

retry by rerunning the migration job — never by raising lock_timeout in a

plain migration (the learnings ledger, "Retry a hot-table ADD COLUMN that

hit its 2 s lock_timeout; never raise the timeout", 2026-09-25). Full costing

method: §4 "Gotchas" below and packages/db/MIGRATIONS.md.

Step 6 — staging deploy

Promote dispatches Build Staging Artifacts, which starts Deploy Staging:

it applies pending migrations to the staging database and rolls staging.

Promote waits for the proof itself; to check by hand:

curl -fsS https://staging-api.kortix.com/v1/health | jq '{environment,version,commit}'
curl -fsS https://gateway-staging.kortix.com/health/live | jq '{version,commit}'

The gateway's /health answers only {status} to an anonymous caller

(apps/llm-gateway/src/health.test.ts); /health/live carries the version.

The staging web sits behind Vercel Authentication: an anonymous read of

staging.kortix.com/api/health gets 302. Promote reads it with the Vercel

bypass from AWS Secrets Manager. All three must report the exact SHA you

promoted. Deploy Staging runs list the dev SHA as their head: match the

deployed SHA by /health, not by the run's headSha. A staging runtime check that

points at dev.kortix.com / dev-api.kortix.com is a broken staging setup, not

a passing gate.

Step 7 — open the release PR

Derive the title and notes from the full commit log since the last release —

not from memory:

git fetch origin --tags --quiet
PREV="$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' --sort=-v:refname | head -1)"
git log "$PREV..origin/dev" --no-merges --pretty='- %s (%h)'

(e.g. "Warm pool, billing fixes, and a faster session boot").

user-facing changes first, internal/infra commits folded into plain outcomes.

Follow kortix-voice: plain language, no hype, "open source" never a

license name. Every notable commit in the log maps to a line in the notes;

nothing invented, nothing dropped — the notes are the public /changelog.

Then run:

Dispatch Promote with them (Step 3).

`promote.yml` **creates the `release/vX.Y.Z` PR into `prod` once**, then on every
later dispatch **updates the branch in place** (pushes the new content, keeps
the same PR). **It does not rewrite an already-open release PR's title or
body** — if the version, title, or notes need to change after the PR exists,
edit them by hand with `gh pr edit`. GitHub holds the bot-opened PR's
`tests-release.yml` run (`action_required`); `promote.yml` then approves it.
Only that pull request run's `full suite + quality gates` counts for the `prod`
ruleset. A dispatched run on the same SHA does not (v0.13.57: green dispatched
gate, PR still `BLOCKED`), so never dispatch a second gate. If the Promote
summary warns that approval failed, approve it yourself:
`gh api -X POST repos/kortix-ai/CompanyOS/actions/runs/<run id>/approve`.

### Step 8 — release gate triage

`tests-release.yml`'s `full suite + quality gates` job is the only *required*
check in the repository (on the PR into `prod`). Until 2026-10-06 staging's API
ran in `us-west-2` and its database in `eu-west-2`, so the owner decision of
2026-09-29 classified a `503 request_deadline` (55 s) or a flow timeout on the
release gate as **environmental**. Since 2026-10-06 both run in `eu-west-2`, so
that cross-region reason no longer holds: confirm with the owner before you
classify a timeout as environmental. Every other failure is fixed on
`dev` and re-promoted with one new dispatch (Step 3). A failed gate run reruns its failed jobs once by
itself (`rerun-failed-once.yml`) and names them on the release PR. A job that
fails twice is real. A job that passes on the rerun is a flake: fix it or
delete it (the **testing** skill) in the same release cycle; nothing is quarantined. A shard that
never gets past its own bootstrap gives no signal: it is rerun like any other.

### Step 9 — prod

Merge the release PR once `full suite + quality gates` is green on its head
SHA **and** one team member approved it. Since 2026-10-23 the `prod` ruleset
(20587235) requires 1 approving review with `require_last_push_approval`: an
approval counts only for the last push, so a re-promote that updates the
release branch needs a new approval. Under the SOC 2 Change Management Policy
the person who releases may approve the release PR themselves: one click, and
that approval authorizes the release (decision of 2026-10-23). Approve as soon
as the gate goes green. Never bypass the review. The one exception is an
emergency rollback or fix: an admin bypass then needs an after-the-fact
approval comment by a second person within 2 business days (compliance rule
CM-3).

gh pr merge <release-pr> --repo kortix-ai/CompanyOS --merge


Never add `--admin` to merge over a red or missing gate unless the owner
approves that exact release in the conversation. Over v0.13.45 to v0.13.56, 9 of
12 releases merged that way, and a gate that is bypassed by habit stops
catching anything.

Confirm a `Deploy Prod` run exists for that merge SHA and succeeds, then verify
every surface on the new version:

curl -fsS https://api.kortix.com/v1/health | jq '{environment,version,commit}'

curl -fsS https://gateway.kortix.com/health/live | jq '{version,commit}'

curl -fsS https://kortix.com/api/health | jq '{version,commit}'

npm view @kortix/sdk version

npm view @kortix/agent-tunnel version

npm view @kortix/llm-catalog version

gh release view "vX.Y.Z" --repo kortix-ai/CompanyOS --json name,body,assets --jq '{name,assetCount:(.assets|length)}' # 24 assets

for i in api gateway frontend; do for t in X.Y.Z prod; do curl -fsS "https://hub.docker.com/v2/repositories/kortix/kortix-$i/tags/$t" | jq -r --arg t "$i:$t" '"\($t) \(.digest)"'; done; done # :prod digest = :X.Y.Z digest


The API and the gateway report the promoted staging SHA: deploy-prod retags
the staging images. The web reports the prod merge SHA. Both are correct.

Then check Better Stack for an API error, 5xx, or frontend-exception spike in
the minutes after the rollout.

`Deploy Prod` starts two mobile workflows on the deployed commit. `Mobile OTA`
publishes the JS bundle. `Mobile Store` builds and submits a new app version
when `apps/mobile/app.json` carries one: Android to the Play production track,
iOS to App Review with release after approval. Both must end green. A
`Mobile Store` warning asks for a version bump or a person in App Store
Connect (runbook: `apps/mobile/BUILD_GUIDE.md`). Both also run when
`Deploy Prod` failed only in its Kortix Capture or desktop installer builds
(`deploy-prod-gate.yml`); any other failed job stops them, and you then
dispatch them by hand once prod is live.

### Step 10 — self-host `:stable`

`:stable` moves **only** on the user's explicit, per-release consent — never
implied by "we released" or "prod is healthy." Run `promote-self-host-stable.yml`
by hand when that consent is given. It refuses a version with no published GitHub
Release `vX.Y.Z`: deploy-prod creates the Release only after prod served that
version, so `:stable` never names a version whose prod roll failed. `:latest`
and `:prod` move in deploy-prod's `promote-prod-channel` job, after
`verify-live-version`; `:X.Y.Z` exists from the retag on, because ECS rolls it.

### Step 11 — rollback

If a shipped version needs to come back: the **kortix-rollback** skill, not this
one. It is the inverse of Steps 7–9 (`rollback-prod.yml`, zero rebuild, the
frontend "clobber" trap, the DB-drift safety check).

## 3. Fix-forward traps

The failures that most often block Step 4 have known fixes. Read
[references/fix-forward-traps.md](references/fix-forward-traps.md) before
debugging one from scratch: out-of-order migration timestamps, stale
`mock.module` stubs after a refactor, source-anchor tests after a file move,
unintentional i18n catalog reordering, a stale `learnings/MEMORY.md`, and a
CodeQL alert in old code that a large diff surfaced for the first time — fix a
real finding on `dev`; dismiss a *proven* false positive on GitHub with a
written, evidence-backed justification, never silently.

## 4. Gotchas (hard-won)

- **deploy-prod concurrency = `cancel-in-progress: false`.** A slow desktop build or a
  zombie queued run blocks the next deploy — cancel it first. `rollback-prod.yml` uses
  the same group, so a rollback waits for a running deploy, and a waiting run of
  either one replaces the other's waiting run.
- **Any deploy-prod run undoes a rollback.** It re-rolls every ECS service to
  `prod:VERSION`. Do not dispatch it (for example with `rebuild_desktop`) while prod is
  rolled back, unless you mean to roll forward.
- **A release rebuilds the desktop app only when the desktop changed.** `desktop-plan`
  compares the desktop fingerprint with the latest release's `DESKTOP-FINGERPRINT`; when
  it is equal, `attach-desktop` copies that release's installers and `latest*.yml`, and
  installed apps get no update prompt. Force a build after rotating a signing certificate:
  `gh workflow run deploy-prod.yml --ref prod -f rebuild_desktop=true`
  (`apps/desktop-electron/README.md`, "A release ships a desktop update only when the
  desktop changed").
- **deploy-prod retags; it does not rebuild.** The staging build for the exact
  promoted commit must already be green:
  `gh run list --repo kortix-ai/CompanyOS --workflow build-staging.yml --branch staging --limit 3 --json status,conclusion,headSha`.
- **`/changelog` and `/changelog/releases` show every published `vX.Y.Z` release** and read
  GitHub Release bodies — so a thin/auto-generated body shows up as a thin entry. The weekly
  page reads only the bullets under `### New`, `### Improved` and `### Fixed`; a body without
  those headings shows as its title alone. Write real notes (Step 7).
- **VERSION is the source of truth**; the version field in `/v1/health` is stamped by
  deploy-prod's task-def, not baked into the image.
- **A promotion PR is not a normal PR.** Do not squash it, do not push new
  commits onto it to "fix" a failure — fix on `dev` and open a fresh promotion
  (Step 4). Squashing or force-pushing it breaks the SHA trail the migration
  cost pass and the release notes were verified against.
- **Private channels have their own rollout.** `KORTIX_PRIVATE_CHANNELS_ENABLED`
  stays unset until its checklist is done, and after it is on, no rollback goes
  below that release while a private channel exists. The checklist is
  [references/private-channels-rollout.md](references/private-channels-rollout.md).

## 5. Undo a bad / premature release

If a release was cut by mistake (and not yet truly published — i.e. no ECS roll / no
real Release), remove it cleanly. `dev` is protected from force-push, so revert there.

git push origin :refs/tags/vX.Y.Z # delete the tag

git push -f origin <prev-release-sha>:refs/heads/prod # reset prod to the prior release

git revert --no-edit <version-bump-commit> # put dev VERSION back; then push

gh release delete vX.Y.Z --repo kortix-ai/CompanyOS # only if a Release was actually cut

cancel any deploy-prod the prod reset triggered

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.