feat: add session-scoped ACP MCP support with Bub instance tools - #69
Draft
lodyai[bot] wants to merge 4 commits into
Draft
lodyai[bot] wants to merge 4 commits into
lodyai[bot] wants to merge 4 commits into
Conversation
Signed-off-by: Frost Ming <me@frostming.com>
frostming
force-pushed
the
fix/bub-instance-tools
branch
from
September 18, 2026 12:58
8c7a5b1 to
05321a2
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.
ACP previously ignored the
mcpServerssupplied by clients. Bub's new instance-tool API also snapshotsREGISTRYwhen constructing anAgent, so late MCP discovery and ACP's temporary global replacements could miss existing agents or affect newly created ones.This change connects client-supplied MCP servers for each ACP session and binds all dynamic tools to the actual runtime Agent. It implements the ACP session MCP contract on Bub's instance-tool API.
bub-mcp>=0.3.0dependency. Preserve arguments, environment variables, headers, and the session working directory.REGISTRY; static@toolregistration remains supported.session/loadandsession/resume; an omitted or empty list clears it. Wait for discovery and active prompts before replacing existing connections. Failed setup closes newly opened clients and preserves previous connections.close()to terminate keep-alive stdio transports. Keep MCP configuration in memory only.MCPChannel.connect(), preserve original tool bindings across repeated overrides, and close partially connected clients when discovery is cancelled.bub-mcpto 0.3.0 and lock Bub toe4578a44354c773447cef854892742af9eb7cc13(feat: support embedding Agent with instance tools, skills, and storage bub#311).Validation:
uv run --locked pytest packages -q: 601 passed, 3 skipped.BUB_RUN_ISOLATED_ABLATION=1 uv run --locked pytest packages/bub-agent-plugins/tests/test_isolated_ablation.py -q: 1 passed (one of the above skips).git diff --checkpassed.Regression coverage includes real stdio MCP execution and PID-verified child termination, model-visible session isolation, late discovery, configured/session tool collisions, reload/clear behavior, failed setup, cancellation, HTTP resource sharing, and cleanup before shutdown completion. Resolving Bub's default agent still uses
BuiltinImpl._get_agent()because upstream does not expose a public default-agent getter.The ACP MCP ablation report records seven groups with three isolated repetitions each, using real stdio servers and a deterministic model schema probe. The full implementation passed 12/12 calls and 18/18 isolation observations, with zero retained children. Global-registration and shared-Agent variants reproduced availability/isolation failures. The old
__aexit__()cleanup retained all 9 children despite reporting zero connected clients;close()fixes that failure. Raw observations, the pre-fix diagnostic, and a reproduction command are checked in. This is an integration ablation, not a model quality benchmark.