GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — mcpx: DELETE a removed server's upstream session on takeover (#260) by dezren39 · Pull Request #267 · developing-today/code

Conversation

@dezren39

@dezren39 dezren39 commented Oct 18, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Problem

Fixes #260. On daemon takeover (mcpx upgrade / mcpx daemon --takeover), the upstream streamable-HTTP session of a server removed from the configuration was orphaned: no pool adopted it, no transport was ever built for it, and no session-termination DELETE was sent — the session was left to expire upstream, silently. pkgs/mcpx/TODO.md recorded this as known-not-done. This is the same defect fixed in dezren39/darwin-nix#390 by PR #391; this repo's pkgs/mcpx copy did not have that fix (pre-fix files verified byte-identical to the nix pre-fix versions).

Solution (port of dezren39/nix PR #391)

  • Handoff carries the endpoint: mcpclient.HTTPHandoff gains URL + Headers (populated at Detach; travels only over the takeover unix socket), and pool.PoolHandoff gains Server.
  • Registry.Adopt records the HTTP sessions of pools with no match as orphan sessions (no upstream contact at adopt time).
  • Adoption.Attach (post-commit only) ends each orphan session with exactly one DELETE via pool.TerminateOrphanedSession → mcpclient.TerminateHTTPSession (404 counts as already ended). Abort contacts nothing, so the predecessor keeps its session.
  • Failures are no longer silent: upstream.session.orphaned (server + session + reason) vs upstream.session.terminated lifecycle events. HTTPTransport.Close keeps best-effort semantics; the DELETE error surfaces only through the new termination path.
  • TODO.md line recording the gap removed.

Verification

  • New daemon regression tests: TestTakeoverTerminatesARemovedServersUpstreamSession (exactly one DELETE with sess-1 after commit) and TestAbortedTakeoverLeavesARemovedServersSessionAlone (no DELETE, predecessor keeps serving).
  • Ablation: with the fix stashed, the takeover test fails — upstream saw 0 DELETEs. With the fix, it passes.
  • New pool tests: TestTerminateOrphanedSessionEndsTheUpstreamSession, TestTerminateOrphanedSessionReportsAnUnreachableEndpoint.
  • go test ./internal/pool/ ./internal/daemon/ ./internal/mcpclient/ — all green. go build ./... clean, go vet clean, changed files gofmt-clean.

Summary by CodeRabbit

  • Bug Fixes
    • Upstream sessions for servers removed during a takeover are now terminated after the takeover completes, rather than being left to expire on their own.
    • If a takeover is aborted, the predecessor keeps its session active.
    • If an orphaned session cannot be terminated, the system records the failure; successful termination is also recorded.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Muse Sweep
mcpx: DELETE a removed server's upstream session on takeover (#260)
9febf3c
A takeover handed an HTTP session on with Abandon, expecting the successor to own it — but a server removed from the configuration (or changed enough to be a different pool) had no pool to adopt it, so the session was silently left to expire upstream.

The handoff now carries the session's endpoint and headers (over the takeover unix socket only), and PoolHandoff names its server. A successor records the HTTP sessions no pool adopted and, in Attach — after the handoff has committed — ends each one with mcpclient.TerminateHTTPSession (exactly one DELETE with the session id). On abort nothing is contacted, so the predecessor keeps the session. A session that cannot be terminated is reported as upstream.session.orphaned with the server and session id instead of being dropped silently; a successful end is upstream.session.terminated.

Ports dezren39/nix PR #391 (fix for dezren39/darwin-nix#390) to this repo's pkgs/mcpx copy, whose pre-fix files were byte-identical. TODO.md line recording this gap is removed.
@dezren39
dezren39 requested a review from a team as a code owner October 18, 2026 10:01
@github-actions github-actions Bot assigned dezren39 Oct 18, 2026
@coderabbitai

coderabbitai Bot commented Oct 18, 2026

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f998a948-f941-4ac4-b33d-db92cb2ba95b
📥 Commits

Reviewing files that changed from the base of the PR and between f646156 and 9febf3c.

📒 Files selected for processing: 6
  • pkgs/mcpx/TODO.md
  • pkgs/mcpx/internal/daemon/registry_handoff.go
  • pkgs/mcpx/internal/daemon/registry_handoff_test.go
  • pkgs/mcpx/internal/mcpclient/http.go
  • pkgs/mcpx/internal/pool/handoff.go
  • pkgs/mcpx/internal/pool/upstream_session_test.go
+--------------------------------------------------------------------------------+
| Please don't use comments to explain what code should be doing. Make it do it. |
+--------------------------------------------------------------------------------+
  \
   \     /)/)
        ( '')
        /  |
      o(___)
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dezren39
dezren39 merged commit 0adeeca into main Oct 18, 2026
14 of 16 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@dezren39
dezren39 deleted the sweep/260-orphan-http-session branch October 18, 2026 10:05
This was referenced Oct 18, 2026
mcpx: TestTerminateOrphanedSessionEndsTheUpstreamSession flakes in the Nix build (0 DELETEs) and hides its own failure reason #290
Closed
mcpx: orphan-session DELETEs from #267 run synchronously on the takeover path, delaying daemon start up to 5s per removed server #291
Closed
This was referenced Oct 28, 2026
mcpx: the privileged plugin surface -- runtime hooks, variables, internal commands, detachment #1873
Closed
mcpx: a promise and a behaviour that disagree — every declared surface needs a guard that walks it (tracker) #1893
Closed
@dezren39 dezren39 mentioned this pull request Nov 5, 2026
id: research/design: fork a Rust KDL stack for ID — universal + multiple annotations, upstream archaeology, fork-base selection (extends #5688) #5753
Open
@dezren39 dezren39 mentioned this pull request Nov 21, 2026
Closure audit: every closed issue/PR verified; unmerged branches + unpushed worktrees inventoried #7079
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@dezren39 dezren39

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

mcpx: takeover orphans a removed server's upstream HTTP session — never DELETEd, left to expire upstream

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@dezren39
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.