Why does report show a different run after changing directories?
The input selector is separate from the event and token aggregation. Released report_db_or_local checks the --localchoice, then the explicit database path, then latest_session_db(). That last function scans only the current working directory. A change of directory, a copied database with a newer modification time, or a missing matching filename can change the underlying source without changing the report command.
This analysis is pinned to AgentSight v1.0.35 at product commit c1574366122a90c451bca6a84713e28813ab95e2. It reconstructs the Rust dispatch and its regression tests; it is not a new runtime benchmark or a production incident. The native session discovery article explains provider history import. This article instead answers the narrower decision: which input a report invocation reads.
Report input decision matrix
| Condition | Selected evidence | Consequence |
|---|---|---|
report --db run.db | run.db | Explicit path; unreadable or missing DB raises an error rather than falling back |
report token --db run.db | run.db | The token subcommand accepts its own DB path |
report --db A.db token --db B.db | B.db | For token/audit/prompts/export/serve, subcommand --db wins |
report --local token --db run.db | Agent-native history | The parent --local flag wins over the explicit path |
report, with agentsight-*.db in CWD | Newest filesystem-modified matching DB | Modification time, not filename timestamp or SQLite session start |
report, no agentsight-*.db in CWD | Recent agent-native history | Emits a warning; imports up to 25 native sessions |
report list | Matching DB filenames in CWD | Lists files, not native sessions or all saved captures on disk |
AGENTSIGHT_DB_PATH=run.db agentsight report | Normal report search | The environment variable is wired into record/bind, not report |
The nested-path precedence comes from own.as_ref().or(db.as_ref()) in the token, audit, prompts, export, and serve branches. The summary subcommand has its own DB and local values, so avoid mixing contradictory parent/subcommand flags. For a repeatable report, specify one database path on the command you use.
Latest means filesystem mtime, not session time
sorted_session_dbs includes names beginning agentsight- with extension .db, then sorts descending by metadata().modified(). It does not parse a timestamp from the name, inspect the SQLite session start timestamp, or recurse through other directories. A restored capture can therefore outrank a chronologically newer run after its file modification time changes. Equal or unreadable timestamps should not be treated as a guaranteed chronological tie-break.
| Test condition | Expected outcome from the code |
|---|---|
| One named candidate in CWD | Selected even if a newer recording exists in another directory |
| A copied old DB gets a new modification time | That copy can become the latest selected DB |
| Only run.db exists, not agentsight-*.db | No default match: native fallback instead |
| --db missing.db | SQLite load fails; regression test confirms no blank DB is created |
| --local with a valid --db for token | Native history chosen; explicit DB bypassed |
| Recorder wrote outside CWD via environment variable | Report needs an explicit --db to select that file |
The AGENTSIGHT_DB_PATH configuration asymmetry
The helper configured_db_path() takes an explicit CLI value first, then AGENTSIGHT_DB_PATH. The recorder and bind call this helper. In contrast, report dispatch invokes report_db_or_local directly. In this release, setting the environment variable for recording does not mean an unqualified report will read that same file. This is a real code-level configuration asymmetry, but not proof of data loss.
# Inspect matching databases in the current directory
agentsight report list
# Use the actual recording path instead of the implicit selection
agentsight report summary --db ./agentsight-20261115-090000.db
agentsight report token --db ./agentsight-20261115-090000.db --json
# Intentionally choose native agent transcripts
agentsight report --local token --jsonThe path above is illustrative rather than a generated artifact or a measured run. Use the actual filename produced by your recorder, and do not upload raw session databases publicly: they may contain prompts, responses, paths, headers or network targets.
What happens when no matching DB exists?
The CLI prints a warning that no agentsight-*.dbwas found in the current directory. The view loader then sets its source to agent-native and calls import_recentwith a limit of 25. Agent-native transcripts can contain model and tool information, but are not equivalent to independent system-level process, file, and TLS capture from a saved record.
An explicit nonexistent SQLite filename follows a different path: the loader returns an error. Its regression test verifies that it does not silently create a blank DB. An empty process list or different token total should therefore trigger a provenance check before an assertion about sensor loss or capture quality.
Reproducible diagnostic checklist
- Record the working directory, complete invocation, and any parent or nested
--db/--localflags. - Run
agentsight report listand inspect matching filenames; use filesystem tools to compare modification times when there is more than one. - Run a comparison using an explicit known SQLite path. Do not infer the selected run from the amount of activity alone.
- Check whether recording used
AGENTSIGHT_DB_PATHto store the DB elsewhere. - Only after selecting the intended source investigate incomplete event capture, SQLite persistence, or native transcript limitations.
This decision matrix is an implementation-derived test plan, not evidence that each scenario was run in a test environment. It does not guarantee full telemetry in either evidence mode. Keep selected-source provenance with any report used for performance, compliance or debugging comparisons.
Primary sources
- Report CLI parsing and precedence
- Current-directory DB discovery and mtime sort
- Native import and missing-DB regression test
- Default recorder database location
- Report fallback warning
- AgentSight v1.0.35 release
For supported CLI setup and options, follow the canonical AgentSight documentation. For data exported after selection, read the JSON snapshot field audit.