Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ and daemon detachment have explicit exceptions; do not reuse them for background
work. Clippy and Oxlint enforce use of these helpers in CI.

User-facing environment variables must use the `BRAINTRUST_` prefix (for
example `BRAINTRUST_DAEMON_SOCKET`), matching `bt` and the Braintrust SDKs. Do
not add new `BT_*` names. Read them through `bt-daemon/src/env.rs`;
example `BRAINTRUST_DAEMON_SOCKET`), matching `bt` and the Braintrust SDKs.
Variables that tune the trace daemon itself use the `BT_TRACE_` prefix (for
example `BT_TRACE_LOG_MAX_MB`) and are listed in `DAEMON_TUNING_ENV_VARS`. Do
not add other `BT_*` names. Read every variable through `bt-daemon/src/env.rs`;
`DEPRECATED_BT_ENV_VARS` there only keeps old names working.
`BT_TRACE_MANAGED_RUN_ID` and `BT_TRACE_INVOCATION_SETTINGS` remain the
internal protocol between `bt trace run` and its child processes.
Expand Down
72 changes: 72 additions & 0 deletions bt-daemon/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion bt-daemon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ thiserror = "2"
tempfile = "3"
tokio = { version = "1", features = ["rt-multi-thread", "macros", "net", "io-util", "sync", "time", "process", "signal", "fs"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
uuid = { version = "1", features = ["v4", "v5"] }
rusqlite = { version = "0.37", features = ["bundled"] }
file-rotate = "0.8"

[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.61", features = ["Win32_Foundation", "Win32_Security", "Win32_Security_Authorization", "Win32_System_Threading"] }
Expand Down
8 changes: 8 additions & 0 deletions bt-daemon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,14 @@ echo '{"session_id":"s1","hook_event_name":"Stop"}' | ./bt-daemon/target
```

The first `hook` spawns the daemon detached; it idles out after 5 minutes.
The daemon logs newline-delimited JSON to `daemon.log` in the data directory
at `debug`, and plain text to standard error at `warn` (`debug` with
`--verbose`). A spawned daemon's standard error is `serve.log`, so that file
holds only warnings and anything printed before logging starts.
`BT_TRACE_LOG_LEVEL` and `BT_TRACE_STDERR_LEVEL` override either filter in
`RUST_LOG` syntax. Each file is renamed to `<name>.1`, replacing the previous
generation, once it would pass 10 MiB (`BT_TRACE_LOG_MAX_MB`), so the two
together hold the latest log in order.

`import <codex|claude|antigravity|muse> <session-id>` has a different purpose from restart
recovery. It locates the native transcript in the selected agent's standard
Expand Down
6 changes: 1 addition & 5 deletions bt-daemon/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,7 @@ fn spawn_daemon(host: &HostInfo, socket: &Path, data_dir_arg: Option<&Path>) ->
.map(Path::to_path_buf)
.unwrap_or_else(|| crate::paths::data_dir(None));
let _ = crate::paths::ensure_private_dir(&data_dir);
let log = std::fs::OpenOptions::new()
.create(true)
.append(true)
.open(data_dir.join("serve.log"))
.ok();
let log = crate::daemon_log::open_serve_log(&data_dir).ok();

#[cfg(windows)]
{
Expand Down
Loading
Loading