Repository navigation
Fix #70: Add opt-in SQLite event log (runs, events, tool calls) mirroring --json output - #77
Merged
Merged
Conversation
vicgupta
force-pushed
the
amf/issue-70
branch
from
October 25, 2026 03:53
b18a8ab to
bcd69c5
Compare
Owner
Author
|
Rebased onto main by the hourly merge job (head now bcd69c5), which now includes #75 (format errors) and #76 (durable checkpoints, plan tool). Rebase notes: all conflicts were additive (flag/config/docs/event-table rows, the |
This was referenced Oct 25, 2026
Merged
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 opt-in local SQLite event log that records the same events as
--json, so runs can be queried afterwards.OnEventnow fans out to sinks (internal/eventlog): the JSONL writer and an optional SQLite sink get identical events.--jsonoutput is byte-for-byte the same as before, except a newprovider.retryevent when a model request is retried.--log-db,--log-db=path, or configlog_db.enabled/path/level/max_days/max_runs/max_payload_bytes. Default path is<cwd>/.tinyagent/tinyagent.db. Off by default; nothing is created unless enabled.modernc.org/sqlite, so no cgo. WAL mode, 10s busy timeout, one connection, all queries parameterized, embedded migrations tracked inschema_migrations.runs,events(run_id, seq, step, ts, type, JSON payload),tool_calls(args, result summary, duration, is_error).level: metadatastores no bodies: text, arguments, and output become*_len, and the task is stored only as a sha256 hash plus its length.level: fullstores bodies after redaction (*_KEY/_TOKEN/_SECRET/_PASSWORDenv values, MCP/hook env secrets, common token shapes). Payloads are capped at 64 KiB by default.Decisions
--cwd. The file is created 0600 and its dir 0700. The README suggests adding.tinyagent/to.gitignore.tinyagent logssubcommand yet. The README shows how to query withsqlite3.--log-db=path, because Go'sflagpackage can't take an optional value after a space.--jsonkeeps its shape. Per-run tokens and cost go inruns.tool_calls.exit_codeis reserved and currently NULL.Testing
.tinyagent), the default path being created, config path relative to--cwd, and the retry observer.gofmt -l,go vet ./...,go test ./...all pass. The eventlog tests also pass with-race -count=5.CGO_ENABLED=0builds succeed for linux/darwin/windows × amd64/arm64.Binary size
linux/amd64,
-trimpath -ldflags="-s -w": 9,506,976 → 13,738,144 bytes (+4,231,168, about +4.0 MiB / +44.5%). Other targets: 12.8–13.8 MB.Closes #70