OBLYTECH Logo
OBLYTECH Logo

Auditability Rules for Agent Actions That Cannot Be Reversed

An agent action that cannot be reversed needs three things before it runs: a classification, a log that captures the before and after state, and a named approver who signed off on the exact change. Sort each action the agent can take into reversible and irreversible groups, then apply the strictest rules to the irreversible group.

Sorting agent actions into reversible and irreversible groups

An action is reversible when a later step can restore the affected records to their earlier state without leaving a trace that people or other systems have already acted on. Editing a text field back to its prior value usually meets that test. Hard deletes, record merges and messages sent to outside parties usually do not.

Ask three questions about each action. Can the prior value be recovered from data the system already holds? Has anything downstream consumed the change, such as a customer message, a generated document or a queued payment? Would a restore depend on rebuilding data that nobody captured? A yes to either of the last two places the action in the irreversible group.

Bulk changes need a separate check. A bulk update counts as reversible when the prior values were captured before the run started. Without that snapshot, treat the update as irreversible, because the current values reflect the result of the change and not what came before it.

Confirm each classification against your own org, because restore behavior depends on configuration, permissions and the release you run.

Building the classification register

Keep the register short enough for one reviewer to read in a sitting, and build it from the permissions the agent holds, not from its design document.

Record the following for each action, in one row:

  1. The object or integration affected, and the operation, such as update, insert, delete, send or merge.
  2. The group the action sits in, reversible or irreversible.
  3. The compensating step, if one exists, and the person who carries it out.
  4. The approval level required before the agent may run the action.
  5. The business owner who accepts the risk of the action.
  6. The date of the last review.

Review the register when the agent gains a permission, a new object enters its scope, an integration changes, or a platform release changes how an object behaves.

Assigning roles to each irreversible step

Name a person for each role on each row. For the irreversible group, the approver and the agent builder should be different people. The roles are these:

  • The agent builder writes the instructions and configures the permissions the agent receives.
  • The approver accepts or rejects a proposal for a given object or process.
  • The business owner accepts the risk of the action and signs off any restore.
  • The reviewer reconciles the log after each run.

Defining the log an irreversible action must leave behind

The log is the evidence of what happened, what changed and who allowed it. Capture the following for each irreversible step, writing prior values before the change and new values after it:

  • The trigger that started the run, such as a user, a schedule or an upstream event.
  • The agent identity and the version of its instructions in force at the time.
  • The input values the agent used to make its decision.
  • The identifier and object of each record affected.
  • The prior and new value of each field the step changes.
  • The approval reference that covers this exact change.
  • The outcome, including any error message and the record that produced it.
  • The start and end times of the step.

The prior value is the field teams tend to leave out. A record’s current value reflects what the record is now, so without the prior value a restore becomes a guess.

Keeping log entries out of the agent’s reach

Store log entries where the agent’s permissions cannot edit or delete them, so a faulty run cannot rewrite its own evidence. Give reviewers read access and limit write access to the logging process.

Setting access and retention for the log

The log copies record values, some of them sensitive, so apply to the log the access rules of each copied field. Check each protected field against field-level security checks for compliance reviewers. Set retention to match your records policy, and cover the window in which a restore or audit could still be needed.

Requiring approval before an irreversible step runs

Approval has to come before the step runs, and it has to cover the exact change. An approval given for “update the accounts” does not cover a run that updates a different set of accounts. Bind each approval to record identifiers, fields and values, so the run can be checked against it line by line.

A first-time setup follows this sequence:

  1. The agent prepares a proposal that lists each record, each field, the prior value and the proposed value.
  2. The proposal goes to the approver named on the register row for that object or process.
  3. The approver accepts or rejects the proposal, or accepts a narrower set of records and rejects the rest.
  4. The run executes the accepted records and values, and nothing else.
  5. Any difference between the accepted proposal and the live run halts the run and writes an exception to the log.

Approve in bounded batches, since a very large batch can hide errors that a smaller one would expose. Set the batch size from the register, and show the approver the total count before accepting. For help planning this work, see Salesforce implementation.

Setting stop conditions for the agent

Each irreversible step needs conditions under which the agent stops before writing anything. Three conditions cover the common cases:

  • The live run no longer matches the proposal, because a record, field or value changed after approval.
  • The log entry cannot be written before the change. If the prior values cannot be recorded, the change does not run.
  • The run cannot tell which records it has already changed, such as after a timeout with no response recorded.

The second condition is the one teams tend to skip. A change that succeeds with no record of its prior state cannot be reviewed or restored.

Testing irreversible agent actions before production

Test the full chain in a non-production copy that carries the same logging objects, permissions and approval steps as production. A copy without the log says nothing about whether the log works. Check the refresh steps before you start, and see sandbox refresh planning for timing questions.

Build test cases from the register, not from the happy path. Each irreversible step needs at least these cases:

  • A record outside the agent’s scope, which the run must skip and log.
  • A record with an empty required value, which must fail without a partial change.
  • A record the running user cannot edit, which must produce a permission error in the log.
  • A proposal edited after approval, which must halt the run.
  • A run that stops after some records are written, which must show exactly which records changed.

Batch size changes the risk. A run that hits a platform limit partway through can leave a partial change, so test at the batch size you plan to use, with the limits described in governor limits for admins in view.

A rule that rejects one record can stop an agent not built to handle rejections. Confirm the agent logs each rejection with the rule’s message and does not report the batch as complete. Integrations that write through the same rules need the same check; see validation rules without breaking integrations.

Reviewing release changes that affect the audit trail

Platform releases can change how objects, permissions and logs behave, so an audit design needs a retest after an upgrade. Read the release notes before each sandbox test, and mark any change that touches an object in your register. A fuller checklist is in release notes review before each sandbox test.

After a release, rerun the log tests and compare the output with the previous run, starting with field names and error wording.

Reconciling the log after each run

Review each run against its approval record. Confirm that the changed records match the accepted proposal, that each change has a prior value and a new value, and that each exception has an owner and a status.

Use this checklist for each review:

  1. Confirm the approval reference matches the run.
  2. Count the approved records and the logged records, and explain any difference.
  3. Open each error and confirm it has a recorded outcome.
  4. Record the reviewer’s name and the review date against the run.

A run that stopped partway needs a fuller reconciliation: list the records that changed, those that did not, and those it did not reach. The register row then decides between a prior-value restore and a compensating step.

Questions about irreversible agent actions and their logs

Can an audit log make an irreversible action reversible?

No. A log records what happened and gives a restore step the data it needs, but it does not undo the change. The prior values and compensating steps belong in the register before the run starts.

Does an approval step make the audit log unnecessary?

No. The approval records what a person allowed, and the log records what the agent wrote. Neither covers the gap the other leaves: the approval does not show the write, and the log does not show that anyone agreed to it.

Should an agent be allowed to delete records?

Treat deletion as irreversible. Allow it when an export of the affected records exists before the run, the approval lists the exact record set, and the log captures the deleted values. Many teams keep deletion out of agent scope and route those cases to a person.

Does a sandbox test prove that the production log will match?

No. A sandbox test shows that the design works on the copy’s data and configuration. Before full volume, run one small approved batch in production and reconcile its log line by line against the proposal. Problems found at that stage cost less to fix than problems found in a large run.