Repository navigation
Inside Production rollback
A red production regression rolls production back, before anything is fixed. Until now prod went through the same gate as local and preview, and that gate's loop is run → fix → run: up to two sessions, minutes each, against a live broken production. The label said production was broken and nothing did anything about it.
So prod does not use the gate. It runs the suite itself, and on red the order is
reversed: vercel rollback first, to the deployment this feature displaced, then
the database as far as it honestly goes, then a check, then the record — and only
then does the cycle return to step 4, where the fixing session now runs against a
production that works.
Which deployment to go back to is recorded before the ship, not worked out
after. Afterwards the question is ambiguous and the answer would be a row's
position in a list; before, it is exactly whatever is serving production at that
moment. If the record is missing the rollback says so and names
vercel ls --environment production rather than guessing. It also says what else
leaves production with us — main takes several merges a day, so a rollback
routinely carries somebody else's work back out, and that is a thing to be told
before rather than discovered after.
The schema is the half that cannot be made exact, and it is not pretended
otherwise. Migrations are forward-only, a product may have no point-in-time recovery,
and the way back is a commented -- down: block: comments, not a mechanism —
nothing runs them, somebody reads them. Many migrations have no block at all.
sclaude/lib/ship/down_blocks.py reads those blocks and sorts them into four
verdicts, and the two interesting ones are what the file exists for:
| verdict | what it means |
|---|---|
runnable |
statements that can be executed as they stand |
destructive |
runnable, and it deletes rows somebody will miss |
prose |
it looks like SQL and is a note to a human |
absent |
no block at all — the loudest of the four |
prose is the one that matters. A real block read drop view if exists public.v;, then — inside a comment — "...recreate from the previous schema
snapshot...", then two grant lines. Strip the
comments and what is left parses, runs, and leaves production without the view.
An ellipsis where statements should be, a function body in $$ this reader
cannot split, an English sentence among the statements: any of them refuses the
whole block. The classifier is a heuristic over prose and is written to fail
towards refusing.
The table names every migration, absent included — a migration skipped in
silence is how a schema reaches a state nobody can describe. Only the fully
runnable set is offered, all of it or none, with the SQL shown first and the
default N: the code half's default is yes because a deploy is undone by
deploying again, and this half's is no because a delete from is undone by
nothing. Each reversed migration takes its row out of
supabase_migrations.schema_migrations with it — supabase db push put it
there, and a row left behind makes every future db:promote refuse. The
environment goes back to wherever the tree was whatever happens, including
halfway through a failure: a tree left pointing at production is a machine
whose next npm run dev talks to it.
Where the blocks cannot be run the schema stays ahead of the code, and that is said in those words. One case overrides the "no question asked" rule: a migration that took something away whose block is prose or absent. Then the previous build would meet a schema it was never written for, and the rollback asks first.
The check afterwards is a stage of its own, and deliberately not a green
light. It runs the same suite against the same host, asking whether the release
we went back to is serving properly — never whether the feature is good. That
separation is structural rather than a convention: regression.prod.status goes
on describing the feature, so the gate's short-circuit cannot be tripped by it,
regression_clear_mark leaves prod-regression-red alone, and
regression_red_label mints nothing for it. Those three needed no editing when
the stage was added — each already ignores a stage it does not know — and all
three are pinned by tests, because widening any one would quietly turn
"production works again" into "the feature works".
The incident goes on the feature's own issue, as a comment. Not a new Bug
issue: state.json holds one issue, read in nine places, and the labels and
the status section go on the whole chain of parents that number walks — a second
issue has no parents, so the epic above would never learn production broke, and
the fix would be split across two Closes #N targets. A new comment each time
rather than an edit, unlike the rolling summary beside it: a rollback is an event
with a time, and a feature rolled back twice has two of them.
The comment says what failed, which deployment is serving now, what became of each migration, whether the check passed — and that main still holds the commit that broke this, so the next production deploy ships it again unless the fix lands first.
The fixing session is told all of it. It gets the log of the run that caused
the rollback, which is not the one at the usual path: the check after the
rollback is a regression_run, which points .sclaude/local/feature/regression.log at
its own file, so by then that name describes the previous release passing —
plausible enough that nobody would question it. The failing run's file is
recorded first and the prompt points there; only production's fixing prompt
reads that record, which nothing clears. It is also told that the local suite is the check that
matters (production is not serving this branch, so a run against it says nothing
about the fix), that the fix goes the whole way round again — local suite, merge,
preview and its suite, then production — and to close the incident with a second
comment once production is green on the feature again.
By hand the same thing is sclaude rollback <name>, and it stands in the action
list once the feature has actually reached production. From done, with
production's suite red, it puts the cycle back on the review too
(regression_rewind), as the automatic one does: left on done, the next pass
asked to ship the same main again, and a "no" led to the clean-up of the tree
the fix was to be made in. With the suite green it sends nothing back and names
sclaude return; in development it leaves the round as it is.
A production that carries the feature with its last regression not green holds
the cycle (prod_red_hold, at the top of remind_prod): a rollback that
failed or was refused, a red with another release on top, a run that could not
start (regression.prod.unrunnable), a red run by hand. It once went by as
"unchanged, skipping" to the issue closed as shipped, the epilogue and the
clean-up. The hold ships, closes and rolls back nothing — what serves production
now, and whose it is, is not known to the pass — and names the way out that
fits: sclaude regression <name> prod, which runs production's suite (only of
a production that carries the feature) and on green clears the red and lifts
the hold — so does it when the project has no production suite
(prodRegression: none, or no list in a config that reads;
project_prod_suite_declined); the rollback, offered only where it is the person's to choose; or
sclaude return <name>, the fix forward from the review where a rollback
cannot happen, sent back as production's red sends it (regression_rewind), so
the review is handed the failure. A red production GitHub cannot attribute
(prod_carries_feature answers 2 when gh does not) stops the pass the same
way, and return with it, until GitHub answers: neither ships past it nor
takes it for a QA hand-back. Only a broken environment is recorded as one
that could not run: a project with no production suite or address has nothing
to hold on, and is not held after its ship; a red held from before the
suite was given up is lifted by sclaude regression <name> prod. The process map draws the hold where the cycle
first reaches it, off Production tests passed? beside the rollback, though every
later pass checks it first; the menu names it steps done, production held, and a
production regression still running steps done, production regression running (both
read through position). Sessions cannot do it:
VERCEL_READS in the hook is an allowlist and rollback is not in it, so it was
already refused — rollback status was added beside the other reads, because a
session looking at a red production has a reason to ask whether one is in flight.
Generated from docs/sclaude.md; edit it there, then rebuild with wiki/build.py.
SClaude is open source under MIT · Repository · Landing page · Contact
Why
How it works
- The cycle
- Big features in parts
- Limits in code
- Fewer tokens
- Feedback loops
- Metrics and the replay
- For a team
- Working from the phone
- Stack and costs
- Privacy
Guide
- Getting started
- Setting up
- Using sclaude
- The config, key by key
- When something goes wrong
- Glossary
- Gates and rules
- Team setup
- Privacy in full
- The tools
- Decks and the map
- Contributing
Inside
Links