Skip to content

chore: update coding-agent plugins, and resolve trace orgs interactively - #314

Merged
Stephen Belanger (Qard) merged 3 commits into
mainfrom
chore/update-coding-agent-plugins
Aug 14, 2026
Merged

chore: update coding-agent plugins, and resolve trace orgs interactively#314
Stephen Belanger (Qard) merged 3 commits into
mainfrom
chore/update-coding-agent-plugins

Conversation

@Qard

@Qard Stephen Belanger (Qard) commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Bumps the bt-daemon dependency on braintrust-coding-agent-plugins to 1ca65d4 (latest main), picking up:

Adapting to those changes surfaced two problems worth fixing rather than absorbing. One was fixed upstream in plugins#22, which has landed and is included in this pin; the other is fixed here.

1. resolve_route takes RouteRequirements

TraceHostServices::resolve_route now takes a struct instead of a destination_required bool. Its new interactive_auth field is false for hooks, so bt suppresses every prompt for the rest of the process when it is unset — a missing profile or org can no longer block an agent's turn on a prompt.

base.no_input = true in resolve_auth did not already do this: bt gates prompts on a process global, which crate::auth::resolve_auth consults later in the same run, so that assignment was inert.

2. Orgs now resolve interactively instead of hard-failing

Reproduced against the built binary before the fix:

$ HOME=$tmp BRAINTRUST_API_KEY=test-api-key bt trace setup codex --project test-project
error: organization choice required for tracing; pass --org <NAME> or select an organization during setup

require_resolved_org rejects a route with no org, but bt never offered a way to choose one — and the advice to "select an organization during setup" is circular when setup is the command that just failed. Projects already resolve interactively through ui::select_project; orgs now do the same via switch::select_org_for_switch, which auto-selects when the credential has exactly one org and prompts otherwise. This is what upstream's interactive_auth was added to allow — hooks leave it false and keep tolerating an unresolved org, since the daemon accepts their events without one.

Org resolution runs before the project picker, so the projects offered belong to the org the traces will actually land in.

Where a default org actually comes from. Only three sources:

  1. --org / BRAINTRUST_ORG_NAME
  2. the config file bt init and bt switch write (config/mod.rs, init.rs:78)
  3. an org-bound API key profile — org_constraint() requires auth_kind == ApiKey && org_bound == Some(true)

commit_oauth_profile stores org_name: None, org_bound: Some(false), so an OAuth profile carries no org at all. This was never an API-key-only gap: anyone who authenticated without running bt init hit it, OAuth included.

Non-interactively it now reports organization choice required in non-interactive mode; pass --org <NAME> or set BRAINTRUST_ORG_NAME, mirroring the existing project message.

3. Test changes

Credentials. Setup, managed run, and import now resolve a credential and require a resolved org before writing a route. The affected tests previously ran with no auth at all; they now go through bt_trace_command(), which supplies a synthetic key and org. The two that pass an explicit --profile also seed a synthetic auth store and secret so they resolve offline.

Import help. Bulk import made session ids variadic, so the assertions moved from <SESSION_ID> to [SESSION_ID]... and now also cover --all.

Added.

  • trace_commands_require_an_org_when_the_credential_resolves_none — bare API key, no org, --no-input, across setup and run
  • trace_setup_adopts_the_configured_org_without_prompting — the config-file org is adopted silently; --no-input makes any attempted prompt a failure rather than a hang

The interactive org prompt itself is not covered — that needs a TTY and a live org list, which would mean faking resolve_org_options behind a seam.

The three trace run tests still assert .success(). Their fake agents emit no hook events, which is precisely the case plugins#22 fixed, so they double as end-to-end confirmation that the fail-open fix works through bt.

Testing

cargo build, cargo clippy --all-targets (no new warnings), cargo fmt --check, and cargo test all pass — 810 tests, including all 41 CLI tests.

🤖 Generated with Claude Code

Bump the `bt-daemon` dependency from 5fbfb5e to 2bb3baf, picking up
"Improve hook routing handling" (#21) and "Support bulk transcript
imports" (#13).

Three upstream behavior changes reach `bt`:

- `TraceHostServices::resolve_route` now takes a `RouteRequirements`
  struct instead of a `destination_required` bool. Its new
  `interactive_auth` field is false for hooks, so `bt` suppresses every
  prompt for the rest of the process when it is unset — a missing
  profile or org can no longer block an agent's turn on a prompt.
- Setup, managed run, and import now resolve a credential and require a
  resolved org before writing a route, so the tests covering them supply
  a synthetic credential rather than relying on ambient auth.
- A managed run that produces no accepted trace events is now an error.
  The fake agents in the run tests emit no hook events, so those tests
  assert the new failure; the invocation settings and config-isolation
  assertions they exist for are all written before that check.

`bt trace import` also gained variadic session ids and `--all`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Latest downloadable build artifacts for this PR commit d21c4f49cbe5:

Available artifact names
  • artifacts-build-global
  • artifacts-build-local-x86_64-apple-darwin
  • artifacts-build-local-aarch64-pc-windows-msvc
  • artifacts-build-local-x86_64-pc-windows-msvc
  • artifacts-build-local-x86_64-unknown-linux-musl
  • artifacts-build-local-x86_64-unknown-linux-gnu
  • artifacts-build-local-aarch64-apple-darwin
  • artifacts-build-local-aarch64-unknown-linux-gnu
  • artifacts-plan-dist-manifest
  • cargo-dist-cache

Tracing requires a resolved org — `require_resolved_org` in the plugin
runtime rejects a route without one — but `bt` never offered a way to
choose it, so `bt trace setup`/`run`/`import` hard-failed with
"organization choice required for tracing" and advice to "select an
organization during setup" even when setup was the command that failed.

Projects already resolve interactively via `ui::select_project`. Orgs now
resolve the same way, reusing `switch::select_org_for_switch`, which
auto-selects when the credential has exactly one org and prompts
otherwise. This is what upstream's `RouteRequirements::interactive_auth`
was added to allow: hooks leave it false and keep tolerating an
unresolved org, since the daemon accepts their events without one.

The gap is wider than API keys. A default org comes from `--org`, the
config file `bt init`/`bt switch` writes, or an org-bound API key
profile; `commit_oauth_profile` stores `org_name: None`, so an OAuth
profile carries no org either. Anyone who authenticated without running
`bt init` hit this.

Non-interactively it now reports "organization choice required in
non-interactive mode; pass --org <NAME> or set BRAINTRUST_ORG_NAME",
mirroring the project message. Org resolution also runs before the
project picker so the projects offered belong to the org the traces will
land in.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Qard

Copy link
Copy Markdown
Contributor Author

Added org resolution (22fd15e), and split the managed-run fail-open fix out to braintrustdata/braintrust-coding-agent-plugins#22.

Orgs now prompt instead of failing

Reproduced against the built binary before the fix:

$ HOME=$tmp BRAINTRUST_API_KEY=test-api-key bt trace setup codex --project test-project
error: organization choice required for tracing; pass --org <NAME> or select an organization during setup

require_resolved_org rejects a route with no org, but bt never offered a way to choose one — and the advice to "select an organization during setup" is circular when setup is what just failed. Projects already resolve interactively through ui::select_project; orgs now do the same via switch::select_org_for_switch, which auto-selects when the credential has exactly one org and prompts otherwise. This is what upstream's RouteRequirements::interactive_auth was added to allow — hooks leave it false and keep tolerating an unresolved org, since the daemon accepts their events without one.

Org resolution also runs before the project picker, so the projects offered belong to the org the traces will actually land in.

Where a default org actually comes from

Worth recording, because it's narrower than it looks — only three sources:

  1. --org / BRAINTRUST_ORG_NAME
  2. the config file bt init and bt switch write (config/mod.rs, init.rs:78)
  3. an org-bound API key profile — org_constraint() requires auth_kind == ApiKey && org_bound == Some(true)

commit_oauth_profile stores org_name: None, org_bound: Some(false), so an OAuth profile carries no org at all. This isn't only an API-key gap: anyone who authenticated without running bt init hit it, OAuth included.

Non-interactively it now reports organization choice required in non-interactive mode; pass --org <NAME> or set BRAINTRUST_ORG_NAME, mirroring the existing project message.

Tests

Two added:

  • trace_commands_require_an_org_when_the_credential_resolves_none — bare API key, no org, --no-input, across setup and run
  • trace_setup_adopts_the_configured_org_without_prompting — the config-file org is adopted silently; --no-input makes any attempted prompt a failure rather than a hang

810 tests pass, clippy clean, fmt clean.

@Qard Stephen Belanger (Qard) changed the title chore: update coding-agent plugins to latest main chore: update coding-agent plugins, and resolve trace orgs interactively Aug 14, 2026
Moves the `bt-daemon` pin from 2bb3baf to 1ca65d4, which adds "keep
managed runs fail-open when nothing was traced" (#22).

A managed run that flushes zero accepted sessions no longer discards the
wrapped agent's exit status, so the three `trace run` tests go back to
asserting success. Their fake agents emit no hook events, which is
exactly the case that used to turn a successful agent into a failed
`bt trace run`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Qard
Stephen Belanger (Qard) merged commit 5ef7691 into main Aug 14, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants