Skip to content

feat: emit a structured JSONL audit log for tool calls - #2473

Merged
hsluoyz merged 1 commit into
the-open-agent:masterfrom
lulululu-debug:feat/audit-log
Aug 3, 2026
Merged

feat: emit a structured JSONL audit log for tool calls#2473
hsluoyz merged 1 commit into
the-open-agent:masterfrom
lulululu-debug:feat/audit-log

Conversation

@lulululu-debug

Copy link
Copy Markdown
Contributor

Summary

Adds an append-only JSONL audit log for tool calls, so an external tool can tail OpenAgent's tool activity read-only, without touching the database. Today the only record of a tool call lives in SQLite and in free-form stdout logs; neither is safe or practical for an external auditor to consume.

Write an append-only JSONL activity log - one self-contained event per
line - next to the binary (overridable with OPENAGENT_AUDIT_DIR), so an
external tool can tail OpenAgent's tool activity read-only, without
touching the database.

- One audit event per tool call, covering every exit path of callMcpTool:
  a malformed-argument call and a call to an unregistered builtin/MCP tool
  are recorded too (outcome "not_found"), since those are exactly the calls
  an audit log must not miss. A deferred Record guarantees a single event
  regardless of how the call returns.
- One file per session: the chat/session id is threaded through
  ToolSession into every event, so sessions never interleave. The admin
  one-shot tool path has no session and uses a shared fallback file.
- Writes are non-blocking: events are handed to a background writer, so a
  slow or stalled audit directory (e.g. a network mount) can never slow or
  fail the tool call it records. Events are dropped rather than allowed to
  block if the writer falls behind.
@hsluoyz
hsluoyz merged commit 0e37953 into the-open-agent:master Aug 3, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants