Title: mcpx: TestTerminateOrphanedSessionEndsTheUpstreamSession flakes in the Nix build (0 DELETEs) and hides its own failure reason · Issue #290 · developing-today/code · GitHub
Open Graph Title: mcpx: TestTerminateOrphanedSessionEndsTheUpstreamSession flakes in the Nix build (0 DELETEs) and hides its own failure reason · Issue #290 · developing-today/code
X Title: mcpx: TestTerminateOrphanedSessionEndsTheUpstreamSession flakes in the Nix build (0 DELETEs) and hides its own failure reason · Issue #290 · developing-today/code
Description: Finding (from PR diff review of #267) TestTerminateOrphanedSessionEndsTheUpstreamSession — added by PR #267 in pkgs/mcpx/internal/pool/upstream_session_test.go — has failed intermittently in the Nix build gate, on a PR that did not touch...
Open Graph Description: Finding (from PR diff review of #267) TestTerminateOrphanedSessionEndsTheUpstreamSession — added by PR #267 in pkgs/mcpx/internal/pool/upstream_session_test.go — has failed intermittently in the Ni...
X Description: Finding (from PR diff review of #267) TestTerminateOrphanedSessionEndsTheUpstreamSession — added by PR #267 in pkgs/mcpx/internal/pool/upstream_session_test.go — has failed intermittently in the Ni...
Opengraph URL: https://github.com/developing-today/code/issues/290
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"mcpx: TestTerminateOrphanedSessionEndsTheUpstreamSession flakes in the Nix build (0 DELETEs) and hides its own failure reason","articleBody":"## Finding (from PR diff review of #267)\n\n`TestTerminateOrphanedSessionEndsTheUpstreamSession` — added by PR #267 in `pkgs/mcpx/internal/pool/upstream_session_test.go` — has failed intermittently in the Nix build gate, on a PR that did not touch it.\n\n## Evidence\n\n- PR #275 (head `a72a2fa79`) CI run 39121884524, job `build`: the mcpx Nix derivation failed with:\n `--- FAIL: TestTerminateOrphanedSessionEndsTheUpstreamSession (0.00s)` / `upstream_session_test.go:185: the orphaned session saw 0 DELETE(s), want exactly 1` / `FAIL github.com/dezren39/mcpx/internal/pool 18.974s`.\n- The same run's host `go test` step passed all 3370 tests, and PR #267's own build, plus the builds for PRs #277 and #279 (which contain the same test), were green — so this is intermittent and environment/load-specific (Nix sandbox), not a deterministic break.\n- Verified on current main (`60f7a634`): the test still exists unchanged at `pkgs/mcpx/internal/pool/upstream_session_test.go:170`. Locally it passes 100/100 (`go test ./internal/pool/ -run TestTerminateOrphanedSessionEndsTheUpstreamSession -count=100`) and 20/20 with its sibling test, so the failure does not reproduce in a plain dev environment.\n- Diagnosability gap in the test itself: when the count check at line ~185 fails, the test never surfaces *why* termination failed. `pool.TerminateOrphanedSession` carefully reports failures via the `upstream.session.orphaned` lifecycle event (with server, session and reason), but the test only captures `upstream.session.terminated` events and checks the DELETE count first — the one piece of evidence that would identify the cause is discarded.\n\n## Why it matters\n\nThe Nix build is a merge gate for every mcpx change. A test that flakes there makes unrelated PRs (like #275) show a red build, which trains everyone to merge past red builds — and the standing rule of merging past unrelated infra failures then also lets real regressions through. The sibling daemon-level test from the same PR (`TestTakeoverTerminatesARemovedServersUpstreamSession` in `internal/daemon/registry_handoff_test.go`) exercises the same termination path and likely shares the failure mode.\n\n## Acceptance criteria\n\n- [ ] The failure mode is identified (e.g. capture and print the `upstream.session.orphaned` event/reason when the DELETE count is wrong; run the pool tests under the Nix build repeatedly to reproduce).\n- [ ] The test (and its daemon-level sibling, if it shares the mode) is deterministic under the Nix build sandbox — repeated `nix build` / check runs of the mcpx package pass without this failure.\n- [ ] If the root cause is in the termination path itself (not only the test), the fix lands in `TerminateOrphanedSession`/`TerminateHTTPSession` and the test pins it.\n- [ ] On failure, the test output states why termination failed (the orphaned reason), not only the DELETE count.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-18T14:26:38Z","url":"https://github.com/developing-today/code/issues/290"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4d99e60a-a49d-a61a-ba26-4fbca3451582 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A18A:83BF7:4DA5E9:64CEBA:6B061D9C |
| html-safe-nonce | 2a11503fd26ad7fb9ee01086c571e0bab8ca17561d16abae1652294e255c73c7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMThBOjgzQkY3OjREQTVFOTo2NENFQkE6NkIwNjFEOUMiLCJ2aXNpdG9yX2lkIjoiNTcxNjg2NDQ3MDc5ODk2NjE3MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 404b783148f5aab5eb2b3ef30d698803eae91cafa7cedfefd623a7e9de0a5161 |
| hovercard-subject-tag | issue:5910530637 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/290/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c7ad644ddcd9759d85b6576164cf6e7062abeeff4269fc817240334a8e85cedc/developing-today/code/issues/290 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c7ad644ddcd9759d85b6576164cf6e7062abeeff4269fc817240334a8e85cedc/developing-today/code/issues/290 |
| og:image:alt | Finding (from PR diff review of #267) TestTerminateOrphanedSessionEndsTheUpstreamSession — added by PR #267 in pkgs/mcpx/internal/pool/upstream_session_test.go — has failed intermittently in the Ni... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9a7c5824b75ea2ec5e3de73a483229c7bb9f32a774ffd401f010dd9bacf1483d |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b25c3080e84402f75431d8dc7a96b2635219cec7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width