Skip to content

feat: resolve room-scoped MCP servers per connection - #896

Merged
AlexanderZ-Band merged 9 commits into
mainfrom
feat/acp-room-scoped-mcp-servers-INT-1889
Oct 22, 2026
Merged

AlexanderZ-Band merged 9 commits into
mainfrom
feat/acp-room-scoped-mcp-servers-INT-1889

Conversation

@bandzalkin

@bandzalkin bandzalkin commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Why

ACP rooms need workspace-specific external MCP servers, resolved on the connection that will use them. Shared setup must stay owned through caller cancellation and cleanup.

What

Add optional resolve_mcp_servers(workspace) to the ACP client adapter and its Copilot/Cursor constructors. Validate native descriptors against negotiated transports, preserve Band routing, and reuse one copied snapshot for restore/fresh-session fallback. Join shared setup through RetainedRoom.wait_owned, observe abandoned errors once without exposing exception contents, and retain process custody until child exit and stdout EOF are confirmed.

Scope

ACP resolver, session setup, process cleanup, documentation and regressions under INT-1889. Uses the shared Python retention contract merged in #911 (INT-1905), inherited from main; this PR contains no generic retention changes. TypeScript parity and planning guidance remain separate follow-ups INT-1906 and INT-1907. No idle-retention enablement or resolver rollout to other Python adapters.

Also repairs a pre-existing resync test's synchronization and async activity fixture exposed during CI validation; generic runtime behavior is unchanged.

@linear-code

linear-code Bot commented Oct 21, 2026

Copy link
Copy Markdown

INT-1889

bandzalkin added a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 21, 2026
bandzalkin added a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 21, 2026
github-actions Bot pushed a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 21, 2026
github-actions Bot pushed a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 21, 2026
github-actions Bot pushed a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 21, 2026
@bandzalkin
bandzalkin marked this pull request as ready for review October 22, 2026 01:55
github-actions Bot pushed a commit to bandzalkin/band-sdk-python that referenced this pull request Oct 22, 2026
@bandzalkin bandzalkin changed the title feat(acp): resolve room-scoped MCP servers per connection feat: resolve room-scoped MCP servers per connection Oct 22, 2026

@AlexanderZ-Band AlexanderZ-Band left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two lifecycle defects reproduced at the ACP setup boundary. The review also notes one documentation formatting nit.

Comment thread src/band/integrations/acp/client_adapter.py Outdated
Comment thread src/band/integrations/acp/client_adapter.py
Comment thread docs/acp.md Outdated
@AlexanderZ-Band

Copy link
Copy Markdown
Collaborator

Proposed next steps: split the shared lifecycle change into a separate core PR and keep this PR open for ACP MCP resolution.

  1. Core PR: agree on the smallest cleanup ownership contract, then implement and test it independently. Protect a caller because it is actively waiting for owned child work, rather than assuming task creation establishes that dependency. Cover awaited work, detached work, cancellation, and unrelated sibling tasks, and check the existing Codex and Claude SDK lifecycle flows.
  2. Update this PR: move its src/band/core/retention/room.py changes and corresponding core regression coverage into the core PR, base this PR on that work, and use the agreed ownership mechanism for ACP session setup. Keep MCP resolution, descriptor validation, and shared initializer management in ACP. Also fix the open abandoned-setup exception finding so a late resolver failure is consumed or reported before the initializer is discarded.
  3. Review and merge the core PR first, then complete this PR against the merged core behavior. Keep feat: resolve room-scoped MCP servers per connection #896 open to preserve its review history and keep its final scope focused on ACP.

The core design still needs to be settled before coding. This split does not add MCP resolver features to other adapters.

@AlexanderZ-Band
AlexanderZ-Band marked this pull request as draft October 22, 2026 12:45
@AlexanderZ-Band
AlexanderZ-Band force-pushed the feat/acp-room-scoped-mcp-servers-INT-1889 branch from 3b1354f to 421c586 Compare October 22, 2026 12:45
@AlexanderZ-Band
AlexanderZ-Band changed the base branch from main to feat/fixpython-track-active-waits-during-retained-room-INT-1905 October 22, 2026 12:45
@AlexanderZ-Band
AlexanderZ-Band added this pull request to stack #912 October 22, 2026 12:45
@AlexanderZ-Band
AlexanderZ-Band marked this pull request as ready for review October 22, 2026 12:49
Base automatically changed from feat/fixpython-track-active-waits-during-retained-room-INT-1905 to main October 22, 2026 14:15
bandzalkin and others added 5 commits October 22, 2026 14:15
Copilot and Cursor through the ACP client adapter need the room's current
MCP server set when a connection starts; a process-wide snapshot cannot
follow refreshed credentials or per-room servers. An optional async
resolver runs inside the shared, room-owned session initializer, freezing
the external server snapshot per setup while keeping Band's reserved
endpoint and the agent's advertised transport capabilities. Setup callers
share one owned initializer; cancellation and failed close keep custody
of the native runtime until cleanup settles, and an accepted caller is
never cancelled by its own child's cleanup request.
@AlexanderZ-Band
AlexanderZ-Band force-pushed the feat/acp-room-scoped-mcp-servers-INT-1889 branch from 46f8144 to a2af1c4 Compare October 22, 2026 14:15

@AlexanderZ-Band AlexanderZ-Band left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One verified process-closure regression at the reviewed head.

Comment thread src/band/integrations/acp/client_runtime.py
@AlexanderZ-Band
AlexanderZ-Band marked this pull request as draft October 22, 2026 14:51

@AlexanderZ-Band AlexanderZ-Band left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nonblocking duplication nit. The buffered-stdout teardown regression is already recorded in its existing thread and is not duplicated here.

Comment thread src/band/integrations/acp/client_adapter.py Outdated
@AlexanderZ-Band

Copy link
Copy Markdown
Collaborator

The requested ownership split is fulfilled at a2af1c4a: shared active-wait cleanup ownership merged separately in #911 (INT-1905), and #896 inherits it from main at b671f899 without generic retention changes. Both ACP setup waits use wait_owned; the ACP-specific observer retrieves terminal errors and reports abandoned failures without exception contents.

The PR description matches the resulting ACP scope. INT-1906 and INT-1907 remain independent TypeScript follow-ups. Verification in this review: 25 focused ownership/setup/error tests passed, and the buffered-stdout reproduction was independently confirmed against the exact base. That inline finding remains open; this is not a readiness or merge approval.

@AlexanderZ-Band

Copy link
Copy Markdown
Collaborator

The earlier ownership-split request is complete: #911 merged into main, and #896 inherits its completion-only RetainedRoom.wait_owned contract without generic retention changes in its own diff. Both live and abandoned setup waits use that contract, with result consumption only on the live path. The remaining review findings are fixed and resolved in published head 193665fc42ab2002d4600a7cb5b9dfab22cde6d1; validation evidence is recorded in INT-1889.

@AlexanderZ-Band
AlexanderZ-Band marked this pull request as ready for review October 22, 2026 15:21
@AlexanderZ-Band
AlexanderZ-Band removed this pull request from stack #912 October 22, 2026 16:04
@AlexanderZ-Band
AlexanderZ-Band added this pull request to the merge queue Oct 22, 2026
Merged via the queue into main with commit 7211907 Oct 22, 2026
36 checks passed
@AlexanderZ-Band
AlexanderZ-Band deleted the feat/acp-room-scoped-mcp-servers-INT-1889 branch October 22, 2026 16:30
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