An invoice agent sends the wrong invoice, updates the CRM, and crashes before it records which actions committed. The team rolls back the code. The customer still has the invoice. The CRM still shows the wrong state.
Code rollback recovered one layer. It did not recover the business operation.
A rollback plan inventories every side effect, separates reversible from irreversible actions, freezes new work, keeps the evidence, restores controlled state, reconciles in-flight actions, and proves recovery in a drill. Logs, version control, and tests are what make reversal possible.
Rollback begins before write access
Do not design recovery after the first production incident.
The pre-production agent test plan identifies every system the workflow can change. For each effect, name the old state, proposed state, action ID, read-back method, reversal method, owner, and time limit.
Some effects can be restored. A file can be replaced from a known version. A CRM field can be set back. A deployment can return to a prior revision.
Other effects cannot be made unseen. An email cannot be unsent from the recipient's mailbox. A disclosed secret cannot be made secret again. A customer may act on a wrong invoice before the correction arrives.
Those effects get recovery and reconciliation. Do not call that rollback. Anything that cannot be undone belongs behind a person's decision before it runs, not in a cleanup plan after.
Prove the recovery material exists
Before access, verify the prior configuration, backup, action ledger, credential owner, and test environment. Name exact paths and versions.
Open the backup. Restore one fixture record. Run the prior version in the test environment. Confirm the operator can reach the read-back interface.
Run the question on paper while nothing is wrong: if this system went dark tonight, what would you still hold tomorrow? If the answer is the files, the logins, and a backup you have opened, only a service stopped. If not, the system stopped with it.
A plan that points to an absent backup or an unknown account owner is blocked. Record that result before the workflow gets production credentials.
Inventory every side effect
List direct and downstream effects:
- file writes and deletions;
- database changes;
- CRM changes;
- messages and publications;
- bookings;
- payments and refunds;
- credentials and permissions;
- deployments and schedules;
- queue acknowledgments;
- generated reports another process uses.
Mark each effect reversible, compensatable, or irreversible.
Reversible means the prior state can be restored and verified. Compensatable means another action can address the outcome, such as a correction notice or a reversing entry. Irreversible means the original effect remains after mitigation.
One rollback promise does not cover all three.
Freeze new work and preserve evidence
Containment comes first.
Pause the executor or revoke its narrow capability. Stop schedulers from claiming new items. Keep the queue, action ledger, receipts, logs, configuration version, and external object IDs.
In my own setup, when a person says they fixed a record by hand, every automated touch on that record stops at once. The one allowed move is pausing the automation at the scheduler or in code.
Do not delete failed runs to clean the dashboard. You need that evidence to know which effects committed.
NIST's AI Risk Management Framework includes documented roles, incident identification, monitoring, and safe decommissioning or phase-out processes. It is voluntary guidance. The operating point: incident response and ownership exist across the system lifecycle. NIST AI RMF Core
Name who can freeze the workflow when the primary owner is unavailable.
Roll back each controlled layer
Treat these layers separately:
Configuration. Restore approved prompts, manifests, policies, tool definitions, and feature flags.
Code and deployment. Return to a known version and verify the running version.
Data. Restore changed records from version history, backup, or a compensating transaction.
Credentials. Revoke or rotate credentials when exposure or authority drift is part of the incident.
Schedules and queues. Stop new claims, keep in-flight work, and choose whether items resume, cancel, or need review.
External effects. Query providers, record committed objects, and reconcile each one.
Kubernetes supports rolling a Deployment back to an earlier revision. Its documentation also notes that the rollback covers the Deployment's Pod template, not every external system the workload may have changed. Kubernetes: Rolling back a Deployment
An infrastructure rollback does not retract messages or reverse business records.
Reconcile in-flight and unknown-state actions
An action is uncertain when the executor sent the request but did not receive or record a conclusive result.
Use the intent ID, idempotency key, provider object ID, recipient, amount, or approved artifact hash to query the destination.
If the object exists, mark it committed and choose the approved compensation. If it does not exist and the provider supports safe idempotent retry, the owner may authorize recovery. If the state cannot be determined, stop and escalate.
AWS's guidance on idempotent APIs covers the timeout-after-commit problem. A unique caller-provided request identifier helps a service recognize repeated intent and avoid additional side effects. AWS Builders' Library: Making retries safe with idempotent APIs
Never resend, recharge, rebook, or reapply a change because the local receipt is absent. Any action near money is built idempotent from the start.
Name the rollback owner and communication path
The plan identifies:
- incident lead;
- system operator;
- business-record owner;
- customer or partner communication owner;
- credential owner;
- approver for compensating actions;
- escalation contact;
- resume authority.
One person may hold several roles. Keep the decisions separate.
The agent may prepare an incident summary or a correction draft. It does not decide that a customer must be contacted or that a refund is authorized. Autonomy keeps the work moving. Accountability stays with a person.
Link the plan to the client handoff and ownership map. A buyer cannot run a rollback if every credential and recovery command stays with the builder.
Inspect rollback-plan.md
Make the plan concrete.
# Rollback plan: invoice-agent
version:: 2026.08.19.1
incident_lead:: system_owner
freeze_command:: runbooks/invoice-agent-freeze.sh
resume_authority:: billing_owner
max_recovery_time:: 30 minutes (synthetic target; owner must set for the real job)
evidence_paths:: receipts/invoice/**, logs/invoice/**, action-ledger/invoice.db
| effect | class | read-back | recovery | owner | approval |
|---|---|---|---|---|---|
| prompt and manifest | reversible | current version endpoint | deploy prior accepted version | system owner | system owner |
| CRM invoice status | reversible | query record ID | restore prior field from ledger | record owner | record owner |
| sent invoice email | compensatable | provider message ID | prepare correction, do not resend blindly | account owner | account owner |
| exposed credential | irreversible exposure | access log | revoke, rotate, inspect use | credential owner | credential owner |
## Resume gates
- new work remains frozen
- every uncertain action is classified
- reversible records match expected state
- compensating actions are separately approved
- measured recovery time is within the owner-approved maximum
- prior fixture suite passes
- monitor and receipt path are live
- billing owner records the resume decisionThe plan names actions. It does not hide recovery behind "contact support" or "restore backup."
Validate before resuming
Recovery is incomplete until the system and the business state are checked.
Validate:
- The approved configuration version is running.
- Credentials match the ownership map.
- The queue holds no duplicate or lost intent.
- Reversible records match their expected prior state.
- Each external object is committed, absent, or uncertain.
- Compensating actions have separate approvals.
- Normal, blocked, failed, and duplicate fixtures pass.
- Receipts and monitoring work.
- The owner records a resume or remain-stopped decision.
The build acceptance list treats failed rollback and ownership tests as critical stops.
Run a timed recovery drill
Use a sandbox or recorder.
The drill changes one reversible record and commits one irreversible test message to a controlled destination.
Then:
- Trigger the incident flag.
- Freeze new work.
- Capture evidence and action IDs.
- Restore the changed record.
- Query the message recorder.
- Mark the message committed.
- Prepare the correction path without sending another message.
- Restore the approved configuration.
- Run the fixture suite.
- Record elapsed time and compare it with
max_recovery_time. - Record blockers and the resume decision. Exceeding the target blocks resumption until the owner resolves it.
Pass means another authorized operator can follow the runbook. A demonstration led by the builder is not enough.
Approval and stopping boundary for AI agent rollback plan requirements
The drill agent may use fixtures, freeze a test executor, restore test records, query a recorder, and write evidence. It stops before production freezes, credential rotation, customer communication, refunds, deletions, deployments, or live-data restoration without the named owner.
In a real incident, the workflow stays stopped while any external effect is uncertain or a critical acceptance test fails. Time pressure does not authorize a blind retry.
A passed rollback drill does not authorize production access. Activation and each compensating external action stay separate approval gates.
