Repository navigation
feat(mcp): resolve room-scoped servers during owned Claude SDK startup - #800
bandzalkin wants to merge 4 commits into
Conversation
99eb3c7 to
fb6c629
Compare
Inherited CodeQL diagnostic findingsThe rebased Claude branch inherits the actual fixing commits unchanged: bc0df019 removes wire-payload contents, 39c2d473 removes RPC method contents, and prerequisite ad176506 adds the prelaunch Windows secret-bearing stdio refusal. These are also the rebased equivalents on this branch; their hashes were not rewritten. RPC frame/queue diagnostics retain only event-kind and length metadata: queue drops identify server requests or notifications; parse/unknown-frame diagnostics retain their transport/type labels and length. No payload or method content is logged by these diagnostics. Forwarded error freezing is unchanged. Alerts 36–40 have fixed instances on both PR head refs, without dismissal. Alerts 41/42 were reported only on #797, are fixed there and have no #800 instance; their links below point to the corresponding #797 threads. All twelve bot threads are already resolved. This summary replaces further per-thread replies and is not an all-green CI claim. |
Source-Base: ad17650 Source-Head: e083173 Applied-Over: 8bb87d3 Conflict-Notes: None; exact feature delta, excluding CHANGELOG.md and FORK-CHANGES.md Upstream-PR: band-ai#800
Source-Base: ad17650 Source-Head: e083173 Applied-Over: 8bb87d3 Conflict-Notes: None; exact feature delta, excluding CHANGELOG.md and FORK-CHANGES.md Upstream-PR: band-ai#800
Source-Base: ad17650 Source-Head: e083173 Applied-Over: 80fe9e6 Conflict-Notes: band-ai#709 replaced Claude command queues and local retirement maps with RetainedRoom. Port resolver, private launch files, readiness and safe diagnostics into ClaudeRoomSession acquisition/release; keep upstream native no-resolver cancellation and callback contracts. Reuse SharedBandMCPBackend close custody and retained self-disposal instead of obsolete backend/deferred-cleanup fields; an optional stop reporting budget keeps whole-adapter teardown owned. Migrate tests into current one-class files and plain helpers; retain authoritative upstream workspace/backend/startup tests. Dropped duplicated enrollment and retryable-close machinery: mutation of upstream owned-work and failed-close mechanisms fails their probes, restored mechanisms pass. MCP readiness waits on the server set bound at resolution. Upstream-PR: band-ai#800
Source-Base: ad17650 Source-Head: e083173 Applied-Over: 5a2fc6f Conflict-Notes: band-ai#709 replaced Claude command queues and local retirement maps with RetainedRoom. Port resolver, private launch files, readiness and safe diagnostics into ClaudeRoomSession acquisition/release; keep upstream native no-resolver cancellation and callback contracts. Reuse SharedBandMCPBackend close custody and retained self-disposal instead of obsolete backend/deferred-cleanup fields; an optional stop reporting budget keeps whole-adapter teardown owned. Migrate tests into current one-class files and plain helpers; retain authoritative upstream workspace/backend/startup tests. Dropped duplicated enrollment and retryable-close machinery: mutation of upstream owned-work and failed-close mechanisms fails their probes, restored mechanisms pass. MCP readiness waits on the server set bound at resolution. Upstream-PR: band-ai#800
Source-Base: ad17650 Source-Head: e083173 Applied-Over: 5a2fc6f Conflict-Notes: band-ai#709 replaced Claude command queues and local retirement maps with RetainedRoom. Port resolver, private launch files, readiness and safe diagnostics into ClaudeRoomSession acquisition/release; keep upstream native no-resolver cancellation and callback contracts. Reuse SharedBandMCPBackend close custody and retained self-disposal instead of obsolete backend/deferred-cleanup fields; an optional stop reporting budget keeps whole-adapter teardown owned. Migrate tests into current one-class files and plain helpers; retain authoritative upstream workspace/backend/startup tests. Dropped duplicated enrollment and retryable-close machinery: mutation of upstream owned-work and failed-close mechanisms fails their probes, restored mechanisms pass. MCP readiness waits on the server set bound at resolution. Upstream-PR: band-ai#800
e083173 to
0ce45ad
Compare
|
Rebased onto current main ( |
0ce45ad to
d52cb24
Compare
|
Pushed |
Source-Base: e38e7ff Source-Head: d52cb24 Applied-Over: 22ac11d Upstream-PR: band-ai#800
Source-Base: e38e7ff Source-Head: d52cb24 Applied-Over: 22ac11d Upstream-PR: band-ai#800
Source-Base: e38e7ff Source-Head: d52cb24 Upstream-PR: band-ai#800
d52cb24 to
8ab244c
Compare
Source-Base: 1b61d7c Source-Head: 8ab244c Upstream-PR: band-ai#800
Port the reviewed cancellation correction from dd8f3af..942759f4. Delegate acquisition cancellation explicitly to the matching startup owner, preserve first abandonment/cleanup diagnostics, and cover public caller/cleanup orderings after uncancel. Keep Claude-owned retention changes in the stacked Claude PR.
8ab244c to
3fa56c2
Compare
Source-Base: 8794cd2 Source-Head: 3fa56c2 Upstream-PR: band-ai#800
SDK replay repair onto main
a96fb54d0c9e(2026-10-18)Restacked onto #797 at 8794cd2. New head: 3fa56c2. The Claude-only delta over #797 is unchanged under git range-diff. The prerequisite’s existing credential-URL finding remains open; this is not merge approval.
Verification on the combined six-PR candidate replay, not a standalone full-suite claim for this PR: macOS, Python 3.12.15; full pytest 9,191 passed, 746 skipped, 108 warnings; Ruff check/format and Pyrefly passed; root and echo-agent lock checks passed. Focused Codex teardown/privacy scope: 36 passed. Actual Codex CLI 0.163.0 initialized, answered model/list, exited with status 0 and left no owned process group. The complete pre-commit gate is delegated to the hosted replay, not claimed as locally executed.
Hosted replay #28 succeeded: all five pre-commit hooks passed; Linux Python 3.12 pytest reported 9,192 passed, 745 skipped, 107 warnings. The workflow published
band-agent-patches-latestat14ff3f96c13d08e57b00b547ec2e6ca168603cd0and tagstaged/2026-10-18-14ff3f96c13d. This does not clear the separate existing #797 credential-URL finding or approve PR merges.Published with explicit old-head leases; hosted replay: https://github.com/bandzalkin/band-sdk-python/actions/runs/39123911370 . Its result and each PR’s fresh CI matrix are separate evidence. No PR merge or band-agent dependency-pin update. Earlier head and verification notes below are historical.
Rebased onto main
d7ab3429cbdb(2026-10-15)Rebased onto current main (after #709, #804, #789/#775, #796 and #802) as its prerequisite's commit plus one commit; head
d52cb24e70018e6d3e478c380d7a70afe448ec59. Integrated into #709'sClaudeRoomSession; MCP readiness waits on the server set bound at resolution. After the first CI run, Codex close no longer fails with "process leader remained unreaped" when a forced kill's exit is reported late (seen on Windows 3.12): it waits for the reap, as callers are already bounded by the room owner's budget; regressiontest_forced_close_waits_for_an_exit_reported_late.CHANGELOG.mdedits are dropped: Release Please generates it.Verified at the new head (macOS, Python 3.13):
uv sync --all-packages --locked --extra dev, all pre-commit hooks, and the fullpytest -q: 8810 passed, 738 skipped. Verification notes further down refer to the previous head.Summary
Resolve room-scoped external MCP servers during owned Claude SDK startup, preserving reservation, backend, file and child-process custody through cancellation and teardown. Related: #709.
Changes
Stack and merge order
Prerequisite PR: #797 (Codex MCP startup and shared lifecycle).
Exact feature-only range:
e38e7ffb63dfd2daeeb415c9da3a6550d8ef9ed0..d52cb24e70018e6d3e478c380d7a70afe448ec59.Merge #797, then #800. This main-targeted PR includes its prerequisite until that merge; review the range above for the Claude-only change. OMP and Copilot lanes are independent.
The prerequisite omits RPC wire-payload and method contents from diagnostics, preserving forwarded error freezing. Codex refuses secret-bearing stdio MCP servers on Windows before launching any process (
unsupported-platform:secret-bearing stdio MCP servers require POSIX exec). Env-free Windows stdio, all HTTP servers and POSIX behavior are unchanged; a Windows owned supervisor is outside this delivery. These corrections belong to #797, not the Claude-only delta.On POSIX, the Claude private MCP directory/file are checked as
0700/0600. On Windows, their privacy relies on the user-profile/temp-directory ACLs, not POSIX modes;chmodonly toggles the read-only flag and stat bits do not prove ACL protection. Only the separate POSIX mode test is skipped on Windows, with that reason. All five cleanup-retention tests run on every OS and refuse the actualshutil.rmtreeboundary before deleting the file; they retain the file, ownership and successful-retry assertions.Shared OpenCode test-helper correction
The inherited #797 correction changes the shared OpenCode test helper
wait_forto check its readiness predicate before the deadline. The coverage failure waited forFakeClient.prompt_callsbefore permission injection; the previous helper could time out after a delayed poll without observing work already ready. A deterministic pre-fix probe reproduced that lost observation. This is a test-observer correction, not a product TurnTask/runtime change or a claim of historical main flakiness.The existing 1.0-second budget and 0.01-second interval are unchanged. False readiness at or beyond expiry still fails without another wait; four regressions cover true/false readiness at and beyond expiry. The exact failing CI wake delay was not measured, so the corrected-head coverage lane remains required proof.
Testing
Corrected head
e083173a3dcb0bd6f7a63be2599a6ad103c85ee0adds a test/doc-only portability correction to rebased headfb6c629d; its fourteen inherited Claude patches remain unchanged. No product code changed. The previous #800 matrix had six identical POSIX-assumption failures and a consequent fixture error in each Windows core lane, not runner flakiness; PowerShell passed in all three without relaxing its timeout.Fresh macOS Python 3.11.16/3.12.14/3.13.14 Claude SDK + inherited Codex/OpenCode scopes passed 541 (6 existing skips) / 547 / 547 cases, with 24 warnings each. All five static hooks passed after removing an obsolete unused test import. The final six mode/retention cases passed after restoring the cleanup mutation.
Mutation proof: making
McpConfigFile.releaseignore the injected deletion failure made all five retention tests fail (plus two consequent fixture errors); the original product branch was restored exactly. A standalone real-file smoke observed the safe cleanup error, retained file/directory, then their removal on retry.Feature-only source stable patch ID is
09c2c1b75556be3b87b20d4f6739a26303341bf1, excluding only changelog/fork metadata. The published-head composition proof must be refreshed after this correction is published. No security alert was dismissed or waived.Local proof is not the corrected #800 remote all-lane matrix, full coverage-floor gate, staged-package validation or native-provider/live-room acceptance. Complete corrected-head CI remains required before the review return; no fork step is authorized by this publication.