buzz-acp: add a TeamContextProvider registry seam for team_instructions - #6866
Open
jmreijnen-parkbee wants to merge 4 commits into
Open
buzz-acp: add a TeamContextProvider registry seam for team_instructions#6866jmreijnen-parkbee wants to merge 4 commits into
jmreijnen-parkbee wants to merge 4 commits into
Conversation
added 4 commits
August 26, 2026 13:26
Introduces a small ordered TeamContextProvider trait + build_team_instructions fold (object-safe via Pin<Box<dyn Future>>, mirroring buzz_workflow::ActionSink, no async-trait dependency) so future sources of standing agent context can register instead of editing tokio_main's startup call site directly. builtin_team_context_providers() starts empty: unlike the fork this RFC (block#3351) was drafted against, current upstream has no existing fetch-and-fold at this call site to convert into a provider — team_instructions is a direct config.team_instructions.clone() pass-through. With an empty registry the new fold is the identity on base (config.team_instructions is already trimmed and empty-filtered at parse time), so this is behavior-preserving relative to today's upstream call site while adding the extension point block#3351 proposes. Signed-off-by: Joost Reijnen <jreijnen@parkbee.com>
Signed-off-by: Joost Reijnen <jreijnen@parkbee.com>
Signed-off-by: Joost Reijnen <jreijnen@parkbee.com>
Signed-off-by: Joost Reijnen <jreijnen@parkbee.com>
jmreijnen-parkbee
force-pushed
the
upstream-pr/acp-context-providers-seam-c
branch
from
August 26, 2026 11:27
cbe7ddd to
5ce0934
Compare
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.
Implements #3351. Third and smallest of a trio of registry-seam proposals.
#3167 (relay kind registry) and #3280 (desktop channel-feature registry)
are being submitted separately.
Problem
Every source that wants to contribute to an agent's standing
team_instructionscontext (workspace house rules, per-team norms,channel-scoped policy, agent memory, future capability-carried context)
has to be hand-wired into the same spot in
buzz-acp's startup path. That'sa central chokepoint that gets harder to extend as the agent surface grows,
the same pattern #3167 and #3280 address on the relay and desktop client.
Note on scope versus the RFC text. #3351 was written against a fork
that had already added a workspace "Agent Guidelines" fetch at this call
site. That fetch doesn't exist in
block/buzzupstream. At the currentcall site in
tokio_main,team_instructionsis justconfig.team_instructions.clone(), a plain pass-through with nothing togeneralize. So this PR ships the seam itself with an empty built-in
provider list, rather than porting a provider that has no upstream
counterpart. The registry, trait, and fold function are what the RFC
proposes. Only "the existing Agent Guidelines fetch becomes one registered
provider" is deferred, since there's nothing upstream yet to convert.
Wiring a first real provider (workspace house rules, for example) is
natural follow-up work once this seam lands.
How
crates/buzz-acp/src/team_context.rs:TeamContextProvidertrait:name()plusprovide(ctx) -> Option<String>, object-safe viaPin<Box<dyn Future<...> + Send>>, the same patternbuzz_workflow::ActionSinkalready uses, so noasync-traitdependency.TeamContextCtx: carriesrelay_urlandkeys, the inputs arelay-backed provider needs.
builtin_team_context_providers(): the ordered list run at startup.Empty today, see the note above.
build_team_instructions(providers, ctx, base): runs providers inorder, drops
None/blank contributions, joins the rest ahead ofbasewith a blank line between sections. With an empty provider list this is
the identity on
base.crates/buzz-acp/src/lib.rs: thetokio_mainstartup call site nowbuilds
team_instructionsviateam_context::build_team_instructions(...)instead ofconfig.team_instructions.clone().Behavior-preserving.
config.team_instructionsis already trimmed andempty-filtered at config-parse time, so
build_team_instructions's owntrim/empty-filter on
baseis a no-op there. With the empty provider list,the new call site produces the same output as the old
config.team_instructions.clone()for every input it can receive today.Review focus
Guidelines fetch that doesn't exist in this repo. Should the issue text
itself be corrected to match, so future readers aren't confused by a
motivation section describing code that isn't there?
empty_providers_is_identity_on_base) an acceptable way to merge thisahead of any real provider, or would you rather see it land together
with a first provider so the non-empty path is exercised in production
immediately?
Testing
At commit
af6c2f0dc(the last code commit on this branch; later commitsonly touch this description):
cargo test -p buzz-acp: 805 passed, 0 failed, existing suite untouched.team_context.rs:empty_providers_is_identity_on_base: with today's empty registry, thefold reproduces
baseexactly (orNonefor blank/absent input). Thisis the property that makes the change behavior-preserving.
builtin_providers_start_empty.providers_fold_in_order_ahead_of_base: ordering, blank-line joins,None/whitespace-only contributions dropped, using a network-free stubprovider.
all_empty_yields_none.cargo clippy -p buzz-acp --all-targets -- -D warnings: clean.cargo fmt -p buzz-acp -- --check: clean.unwrap()orunsafein production code.Follow-ups (not in this PR)
workspace house-rules or guidelines fetch, to exercise the non-empty
registry path in production.
submitted separately.
Duplicate check
Only hit: this PR's own RFC, #3351. No duplicate issues or PRs found.