feat: emit a structured JSONL audit log for tool calls - #2473
Merged
Conversation
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.
lulululu-debug
force-pushed
the
feat/audit-log
branch
from
August 3, 2026 00:43
bcb254a to
a00cbd5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.