Embed the coding-agent tracing daemon - #287
Conversation
|
Latest downloadable build artifacts for this PR commit
Available artifact names
|
9f346b6 to
3298cdf
Compare
This worked, but i had no idea which org, project, etc. it wrote to. With other commands, if this is ambiguous, we show you a selector where you pick it. Also, instead of just accepting a "project", we should accept the same destination format as |
def3be2 to
8199199
Compare
Signed-off-by: Stephen Belanger <stephen.belanger@braintrustdata.com>
d757666 to
196128c
Compare
|
Should respect the |
This is kinda user-facing yet exposes the hidden subcommands. Not an issue for me but maybe that goes against what you wanted. |
|
|
|
Cedric / ViaDézo1er (@viadezo1er) Do you think any of those are necessary for the initial release? Those all sound like reasonable follow-up tasks to me. 🤔 As for the hidden subcommands being visible there, I think that's a Clap bug. I'll see if that can get fixed upstream. |
Add OpenCode and Pi setup support with independent persistent routing and isolated managed runs. Pin the daemon dependency to plugin-monorepo main at aa66906c2cbf04f7582ae08dce6efffe61e3bdf4. Signed-off-by: Stephen Belanger <stephen.belanger@braintrustdata.com>
f41e7b8 to
8c7b795
Compare
|
let's get the |
Dependencies
Depends on merged braintrustdata/braintrust-coding-agent-plugins#1, pinned at its squash-merge commit
bebff4e0349fd9d2ee4a8ce1eeeafafee91ac74b.That daemon PR in turn depends on braintrustdata/braintrust-sdk-rust#86, pinned at commit
d33e806bf6ab9548d37355f6a5098a971ef150aa.The plugin source cutover is intentionally deferred to stacked braintrustdata/braintrust-coding-agent-plugins#3, which must land only after this daemon is available in a released
btCLI.Summary
This embeds the shared coding-agent tracing daemon in
btunder thebt tracecommand family.bt trace setupandbt trace importare the user-facing commands. Thedaemon,hook,status, andstopsubcommands remain directly callable by plugins and operators who know their names, but are hidden from public help and usage output as implementation details.bt trace import codex <session-id>andbt trace import claude <session-id>locate and snapshot native session transcripts in the agents' standard data directories, resolve the currentbtprofile and project, and send the reconstructed historical trace through the production Braintrust sink. The source is explicit because session IDs alone do not identify their producer. Codex snapshots are streamed once, native turn IDs and compaction history replacements are retained, and large imports drain in small bounded operation batches to avoid losing later turns to bounded delivery queues without serializing a network flush for every boundary. Claude imports preserve native turn ownership when physical record order is not timestamp-monotonic and propagate Claude API-error markers into turn and LLM errors. Daemon restart recovery remains an internal WAL operation; it may idempotently resubmit rows under stable backend row IDs, but cannot create duplicate logical spans.The foreground daemon initializes structured logging at INFO by default, or DEBUG with
--verbose, and emits safe request lifecycle fields such as JSON-RPC method, request ID, event type, source, and session ID. Payloads and credentials are not logged.bt trace setup codexandbt trace setup claudeuse the coding agents' own plugin managers to add the official Braintrust marketplaces and install the currently published tracing plugins. Setup also creates the shared tracing settings when needed, enables tracing, and accepts--projectfor routing. It performs a non-destructive merge: every other setting, including legacy authentication and backend fields needed by currently published plugins, is preserved unchanged.The
bthost resolves its normal profile, OAuth, keychain, or API-key credentials for each hook invocation and transcript import, passing the resulting token, backend URLs, organization, and project to the credential-passive daemon library. Hook errors remain fail-open so tracing cannot break a Codex or Claude Code turn.The daemon is consumed from the exact Git commit of its migration PR rather than through a local path dependency. The integration is rebased on current
btmain and preserves the newer top-levelupdatecommand and command routing introduced there.CLI regression tests verify that
setupandimportare advertised bybt trace --help, while the four hidden operational commands remain directly callable. They also cover the required import source and session ID, rejection of the removed replay spelling, hook options, graceful and idempotent stop, Codex and Claude plugin-manager invocations, default and explicit project selection, and preservation of existing settings. The supersededbt daemonandbt agentspaths remain rejected.Validation
cargo fmt --checkcargo test --test clibraintrust.plugin.codexspan-origin metadata.Project selection and managed runs
bt trace run codex|claudewith invocation-local hooks and routing--projectwith actionable guidance in non-interactive modeCovers SDK-128 and SDK-129.