Skip to main content
Every state transition and every autonomous mutating tool call lands in the workspace audit log via AuditService.logEvent(). Mutating actions also capture a before-state snapshot for 7 days, after which the snapshot is purged (the audit entry stays forever).

What is audit-logged

New AuditAction values added by the agents feature: All entries appear in the existing Recent Activity UI alongside human actions, filterable by actor.type=agent.

The 7-day undo window

Mutating tool calls populate agent_undo_snapshot.before_state_json before dispatch via a Snapshottable interface implemented per affected service. The snapshot includes everything needed to restore: the entity’s full state at the time of the change, with a currentAfter field captured at undo time for drift detection.

What’s undoable

Using the Undo Center

/workspace/agent-undo (UI) or GET /api/v1/workspaces/{wid}/agent-undo (API). The table sorts by expires_at asc so soonest-to-expire is on top.
1

Pick an action

Click a row to see the before / after diff modal.
2

Click Undo

The runtime captures the current state, compares it to the snapshot, and applies the before-state.
3

Drift detection

If a human changed the same entity since the agent acted, the modal shows “Manual change detected — review before undoing” with a three-way diff. You can proceed anyway or cancel.
Undo center

Drift-conflict modal

When current ≠ after, the runtime returns MERGE_CONFLICT (HTTP 409) from the undo endpoint. The UI surfaces:
  • Snapshot’s before state
  • Snapshot’s recorded after state
  • Current actual state
  • A two-button choice: Proceed anyway (apply before-state, drop intermediate change) or Cancel.
Choosing Proceed anyway logs an AGENT_UNDO_APPLIED audit entry with the mergeConflict=true flag.

Authorization

Snapshot retention

AgentUndoSnapshotPurger runs daily and drops snapshots where expires_at < now(). The corresponding audit entries remain — only the snapshot payload is purged.

API

Response codes for POST .../undo:
  • 200 — applied cleanly.
  • 409MERGE_CONFLICT (use ?force=true to override).
  • 410 — snapshot expired (>7 days old).
  • 404 — snapshot not found / already undone.