Improve hook routing handling - #21
Merged
Merged
Conversation
This allows sessions to having multiple routings, which is useful for scenarios like importing to multiple projects.
Managed-run flush accounting now survives a daemon restart or idle-exit by
recording each accepted {session_id, route} pair alongside the journal, since
the in-memory map alone was lost across daemon generations.
TraceHostServices::resolve_route now takes RouteRequirements{destination_required,
interactive_auth} so a host can tell hooks (never prompt) apart from
setup/run/import (safe to ask for login or list organizations/projects when no
default is resolved).
Adds a regression test for concurrent `bt trace import` of the same session to
different destinations, and corrects docs/protocol.md, which still described
one route per session.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
configure_event() was requiring a non-empty resolved org for every accepted event, not just for setup/run/import. That's stricter than before "Improve hook routing handling" (which introduced the check) and broke ordinary hook delivery in any environment where the auth provider doesn't default an org (e.g. the standalone bt-daemon binary's EnvironmentAuthProvider, used by the agent_integration e2e suite), causing every event to be rejected and no traces to be captured. Interactive org resolution is already enforced in the right place for setup/run/import: resolve_command_route()/require_resolved_org in trace_runtime.rs, gated by RouteRequirements. Also run cargo fmt, which CI checks and this branch's prior commit had drifted from. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Stephen Belanger (Qard)
requested review from
Abhijeet Prasad (AbhiPrasad) and
Andrew Kent (realark)
August 14, 2026 00:17
Abhijeet Prasad (AbhiPrasad)
approved these changes
Aug 14, 2026
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.
This allows sessions to having multiple routings, which is useful for scenarios like importing to multiple projects.