Compensate
Structured rollback via logged inverses in LIFO order
Mechanism
Execute inverse actions to undo partial coordination across the System after BREAK. On receiving BREAK, agent retrieves compensation_log (built during forward execution—each action logged its inverse). Execute inverses in REVERSE chronological order (LIFO). For each inverse: attempt execution, if fail retry (inverses must be idempotent), if still fail log and continue or escalate. Report COMPENSATE_RESULT: {completed: [steps undone], failed: [steps that couldn't undo], clean: bool, downstream_confirmed: bool}. Multi-agent coordination: each agent compensates their own scope. BREAK propagates with upstream_agents hint for cross-agent dependencies—downstream agents compensate first, confirm, then upstream proceeds. Compensation cannot introduce NEW coordinated work (only cleanup and notification). Triggered by Break, it reads the TimeWarpLog in reverse to execute the idempotent inverse of each prior action.
Invariants
- Every forward action logs its inverse as it executes; an action with no logged inverse is not compensable.
- Inverses execute in reverse chronological order.
- Inverses are idempotent, so a retried compensation does not compound.
- Reports per-inverse outcome, including which inverses failed.
Preconditions
- Compensation mechanism available
- Detected failure/loss
Postconditions
- A status report exists naming which inverses succeeded and which did not
Failure modes
- Inverse wasn't logged (can't compensate what wasn't tracked).
- Inverse isn't truly idempotent (retry corrupts state).
- External state changed between action and compensation (assumption invalid).
- Compensation creates new failure (cascading compensation).
- Time-sensitive compensation (too late to undo, window passed).
- Compensation log lost or corrupted.
- Downstream agent doesn't confirm (blocks upstream compensation).
Caution
Compensation must not erase the audit trail of what was rolled back — log both the forward action and the compensation.
Where this came from
—
Builds on
- System references
- Break references
- TimeWarpLog references
Used by
- AtomicBid composes_with
- EjectionSeat references
- FrameError references
- Gardener references
- OptimisticSolver composes_with
- Retry references
- Rollout composes_with
Related
Identity
- Ref:
Compensate#4b87 - Hash: sema:Compensate#mh:SHA-256:4b87623f38564fcc95b87d2cbf5df2f5ff41ef27e617ccafd76c7b7896b144e7
- Library: bootstrap 0.11.0, root a6a3d1ff0f98
- License: Not stated; check the repository