Topic 3 of 5 · 4 min read
Fast rollback to a known-good version
Goal: Plan a rollback for a bad prompt change and list what must be cleaned up beyond switching the version.
Make rollback one configuration change that takes seconds, and plan for the damage a bad version already did, because switching back does not undo it. The quickest fix in an incident is the one you rehearsed.
Check yourself · 1 of 3
What makes a rollback of a prompt change fast?
Why it matters
When a new prompt starts producing broken JSON or rude replies, every minute is more affected users. If rolling back means a code change, a review, a build and a deploy, that is half an hour of harm. If it means moving a pointer from version 5 to version 4, it is a minute.
How to do it
- Select the version by configuration. The app reads "active version for support-reply" from a flag, a config store or a prompt registry label, not from a constant in code. This is a release toggle.
- Keep the previous version ready. Do not delete it, and keep its model snapshot available. If the old version used a model that has since been retired, rollback no longer works.
- Know the trigger. Decide in advance which alerts mean "roll back first, investigate later": format errors, safety hits, a spike in thumbs-down, cost per request.
- Rehearse it. Do the switch in staging and in production at a quiet time, and measure how long it takes.
- Write the clean-up list. Rollback restores future behaviour only.
What a rollback cannot undo
- Cached answers. If responses are cached by prompt hash or by question, the bad version's answers keep being served. Purge entries tagged with the bad version, or include the version in the cache key.
- Data an agent already wrote. Tickets closed, emails sent, records updated, files changed. List them from the traces by version, then repair or notify.
- Downstream copies. Summaries stored in a CRM, embeddings built from bad output, analytics that counted bad answers.
- User trust. Users who saw wrong answers may need a message.
Before and after
Weak plan: "Revert the commit and redeploy."
Better plan: "Set active version of support-reply to 4 in the config store (about 1 minute). Purge cache keys tagged v5. Query traces for v5 tool calls that wrote to the CRM and list them for review. Post a status note."
What goes wrong
- Rollback needs a deploy. The slow path costs the most users.
- The old version no longer works. Its model was retired or a tool schema changed.
- Only the pointer moves. Bad cached replies and bad writes stay in place.
Examples
A rollback runbook entry
Trigger: format-valid rate < 97% for 10 min, or any safety alert
1. Set active_version[support-reply] = 4 (config store, ~1 min)
2. Purge cache keys with prompt_version=5
3. Query traces: prompt_version=5 AND tool=crm.update_ticket
-> export ids, review and repair by hand
4. Post a status note; open an incident ticket
Old version needs model snapshot X: confirmed available until its retirement date.
The rollback that did not work
A team keeps the old prompt but it called a model snapshot the provider retired last week. Switching back returns errors. The fix is to check, at release time, that the previous version's model is still served and to note its retirement date in the rollback plan.
Key points
- Choose the active prompt and model version through configuration so rollback takes seconds, not a deploy.
- Keep the previous version and its model snapshot available until the new one has proven itself.
- Decide in advance which alerts trigger a rollback, and rehearse the switch.
- Include the version in cache keys, or purge entries tagged with the bad version.
- List side effects of the bad version, such as agent writes and sent emails, from traces and repair them separately.
Common mistakes
- Making rollback depend on a full redeploy.
- Deleting the previous version, or letting its model be retired, before the new one is proven.
- Forgetting caches, so bad answers keep being served after the switch.
- Treating the pointer switch as the end of the incident and skipping the review of what the agent already changed.
Check yourself · 2 of 3
After rolling back a bad prompt, users still receive its bad answers for the same questions. What is the likely cause?
Check yourself · 3 of 3
An agent with a bad prompt version updated 40 CRM records before rollback. What should the plan include?
Practice items, not counted towards your mastery.
Start here
- Prompt management (Langfuse docs) (opens in a new tab)DocsFree
How a prompt-management tool versions prompts, labels releases and links each version to traces.
- Model deprecations (Claude docs) (opens in a new tab)DocsFree
The real retirement schedule format: status, deprecation date, retirement date and the suggested replacement.
- Deprecations (OpenAI API) (opens in a new tab)DocsFree
OpenAI's list of shutdown dates with recommended replacements, to plan a migration from.
More for this topic
- Feature Toggles (martinfowler.com) (opens in a new tab)ArticleFree
Release toggles let you switch behaviour by configuration, which is the mechanism behind fast prompt rollback.