GeezerVison is showing github.com — test(mcpx): make the orphaned-session test name its own failure mode by dezren39 · Pull Request #336 · developing-today/code
Conversation
dezren39
commented
Oct 19, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Fixes the diagnosability half of #290 (the Nix-build flake itself does not reproduce locally — see below).
Problem
TestTerminateOrphanedSessionEndsTheUpstreamSession flaked in the Nix build gate with the orphaned session saw 0 DELETE(s) (PR #275's run 39121884524), and the test discarded the evidence that would identify the cause:
- the mock upstream counted only DELETEs for live sessions — a DELETE for a session the upstream had forgotten is answered 404 and counted as nothing, indistinguishable from no DELETE arriving at all;
- the test never captured the
upstream.session.orphaned events, which are exactly where TerminateOrphanedSession reports why a termination failed.
Fix (test-only)
sessionUpstream records every DELETE attempt and its session id (the daemon package's orphanUpstream mock already does this — the pool mock now matches it).
- The test captures terminated and orphaned events via a new
lifecycleCapture helper (the existing lifecycleEvents hook can hold only one kind), and its failure message reports attempts, session ids, and orphaned reasons.
The three failure modes now read differently:
- no DELETE arrived →
attempts=0 (+ orphaned reason if the dial errored);
- DELETE arrived for a forgotten session →
attempts=1, deleted=[sess-1], deletes=0, terminated still fires (404 is success by design in closeSession);
- DELETE errored → orphaned event carries the reason.
Verification
Refs #290
![Autofix with [code]smith](/api/image?u=https%3A%2F%2Fcamo.githubusercontent.com%2Fef26d88456de9cc93cf03b8611c53675c8af4fc8361b0049e62a133b46e853b6%2F68747470733a2f2f70722d636f6d6d656e74732d6173736574732e626c61636b736d6974682e73682f636f6465736d6974682f6175746f6669782d776974682d636f6465736d6974682d6461726b2e737667)
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by CodeRabbit
- Tests
- Expanded coverage for session cleanup when an upstream deletion attempt returns “not found.”
- Added checks for orphaned and terminated session lifecycle events, including verification of the reported session details.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…290)
TestTerminateOrphanedSessionEndsTheUpstreamSession flaked in the Nix
build with '0 DELETE(s)', and the test discarded everything that could
say why: the mock counted only DELETEs for live sessions (a DELETE for a
forgotten session is answered 404 and counted as nothing) and the test
never looked at the upstream.session.orphaned events that carry
TerminateOrphanedSession's failure reason.
- sessionUpstream now records every DELETE attempt and its session id,
like the daemon package's orphanUpstream already does.
- The test captures terminated and orphaned events together (new
lifecycleCapture helper; the existing helper's hook holds one kind)
and its failure message reports attempts, session ids and the
orphaned reasons.
The three failure modes now read differently: no DELETE arrived
(attempts=0), the DELETE named a session the upstream had forgotten
(attempts=1, terminated still fires — 404 is success by design), or the
DELETE errored (orphaned event with the reason). Verified with a
sabotage run (upstream forgets the session before termination).
Test-only change; full internal/pool suite green, -count=200 and -race
runs of the target test green locally (the flake itself is Nix-sandbox
only and does not reproduce in a dev environment).
Codex Review Summary
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
✅ Completed 2026-10-19T06:09:47.187100Z |
— |
PR opened |
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Oct 19, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
93aac0b1-2551-4641-9d5f-e8cce4f6f86d
📥 Commits
-
Reviewing files that changed from the base of the PR and between 7b081c3 and 9ecdeae.
📒 Files selected for processing: 1
-
pkgs/mcpx/internal/pool/upstream_session_test.go
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
📝 Walkthrough
-
The upstream session test mock now records DELETE attempts, including attempts that receive 404. The orphan-termination test captures termination and orphan lifecycle events and checks that exactly one termination event identifies remote and sess-1.
Changes: Upstream session termination tests
| Layer / File(s) |
Summary |
DELETE and lifecycle event assertions pkgs/mcpx/internal/pool/upstream_session_test.go |
The mock records attempted session IDs before checking whether a session is live. The test captures termination and orphan events, checks the expected termination event, and includes attempt and event details in failure messages. |
Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Other
Merge Risk: ⚪ Minimal · up to 9ecde
-
This change updates test observability and assertions without changing production behavior. No concrete merge-blocking risk remains.
Pre-merge checks: 4 · 1
-
Failed checks: 1 warning
| Check name |
Status |
Explanation |
Resolution |
| Docstring Coverage |
 |
Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 files. |
Write docstrings for the functions missing them to satisfy the coverage threshold. |
Passed checks: 4 passed
-
| Check name |
Status |
Explanation |
| Description Check |
 |
Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check |
 |
The title clearly describes the main change: improving the orphaned-session test so its failure mode is identifiable. |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
- Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
-
📝 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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Oct 19, 2026
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 23, 2026
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|