|
| 1 | +# Pool Invalidation + Session Survival — Manual Test Playbook |
| 2 | + |
| 3 | +**For:** verifying Phases 1–4 on `root-resolution` |
| 4 | +**Last Updated:** Aug 20, 2026 |
| 5 | +**Implements:** [`pool-invalidation-and-session-survival.md`](./pool-invalidation-and-session-survival.md) |
| 6 | +**Shipped:** `dcc2977` — config-save `reconnect_fresh`, stdio OAuth refuse, hold `X-Mcpmux-Workspace` until session id |
| 7 | +**Parent playbook:** [`backend-connection-resilience-test.md`](./backend-connection-resilience-test.md) (Cases A/B already PASS) |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## Results (Aug 20, 2026) |
| 12 | + |
| 13 | +Ran live against `127.0.0.1:45818` (`{"status":"ok","version":"0.5.0"}`). Binary `target/debug/mcpmux` contains the new strings (`held until mcp-session-id`, `stdio cannot reconnect via OAuth`, `reconnect_fresh after config update`). Process up since 11:36:44 local / recycle log `17:37:21Z`. Mux only via `user-mcpmux`. `set_workspace_root` not used. |
| 14 | + |
| 15 | +| Case | Result | |
| 16 | +| ---- | ------ | |
| 17 | +| E header pin | **PASS** — this repo `ready` (wakatime, HA, …). Session `60e5261f…` header `~/Desktop/Repos/Personal/mcp-mux` → pin `/Users/joe/Desktop/Repos/Personal/mcp-mux`. Log: `held until mcp-session-id exists` then `pinned explicit workspace root`. Not 6-way `bindable`. | |
| 18 | +| F stdio refuse / Case B regression | **PASS** — `wakatime` / `wakatime_wakatime_summaries`. Killed child pids 74227/74257 at 17:39:38Z. Second invoke succeeded. `trigger=transport_closed`, `reconnect_fresh completed ok=true` (1544ms). No `Unexpected STDIO`, no OAuth reconnect. Source grep of that string: 0. | |
| 19 | +| G config-save reconnect | **BLOCKED** — admin `:45819/api/v1/health` is 401, no CF probe headers in this shell. Did not sqlite-edit (no event). Did not mutate `wakatime` env. Needs Configure UI or a working admin token. | |
| 20 | +| H rebuild 404 | **PASS** (same-day recycle, no second rebuild) — new handler start at `17:37:21Z` (line 42 = this binary). `/health` 200 after. New session ids + Case E pin within 3s. 404s are expected-noise (not warned), so no 404 warn lines. Did not `pkill` / rebuild again (would 404 this chat). | |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +## Answer first |
| 25 | + |
| 26 | +Same rules as the parent playbook. **Do not** call `mcpmux_set_workspace_root` to "fix" a reconnect. **Do not** `pkill -f mcpmux`. **Do not** rebuild mid-case unless you are *in* Case H, and Case H goes last because it 404s this chat. |
| 27 | + |
| 28 | +| Action | Use for this test? | |
| 29 | +| --- | --- | |
| 30 | +| Same Cursor chat, same workspace (`/Users/joe/Desktop/Repos/Personal/mcp-mux`) | **Yes — required** | |
| 31 | +| Reload MCP before starting (only if `/mcp` is already 404) | Yes, once, then stop | |
| 32 | +| `set_workspace_root` as a reconnect | **No** | |
| 33 | +| `set_workspace_root` only if Case E shows 6-way `bindable` *and* the workspace header is empty | Last resort, note it as a confounder | |
| 34 | +| `pnpm dev:stop` / rebuild | **Case H only**, last | |
| 35 | +| `pkill -f mcpmux` | **No** | |
| 36 | + |
| 37 | +--- |
| 38 | + |
| 39 | +## Snapshot |
| 40 | + |
| 41 | +``` |
| 42 | +DB=~/Library/Application\ Support/com.mcpmux.desktop/mcpmux.db |
| 43 | +LOG=~/Library/Application\ Support/com.mcpmux.desktop/logs/mcpmux.$(date +%Y-%m-%d).log |
| 44 | +``` |
| 45 | + |
| 46 | +| Fact | Value | |
| 47 | +| ---- | ----- | |
| 48 | +| Space | `00000000-0000-0000-0000-000000000001` | |
| 49 | +| This root | `/Users/joe/Desktop/Repos/Personal/mcp-mux` | |
| 50 | +| Stdio for F | `wakatime` / `wakatime_wakatime_summaries` | |
| 51 | +| Config-save target for G | enabled stdio or HTTP that is `ready` — prefer a harmless `env_overrides` / `extra_headers` bump, revert after | |
| 52 | +| Pool stats | in-memory only | |
| 53 | + |
| 54 | +Health: `curl -sf http://127.0.0.1:45818/health` → `{"status":"ok",…}`. |
| 55 | + |
| 56 | +--- |
| 57 | + |
| 58 | +## Preconditions |
| 59 | + |
| 60 | +1. Debug gateway on `:45818`. This binary must include `dcc2977` (or later on `root-resolution`). If `tauri dev` has not rebuilt since that commit, Cases G/E will exercise the *old* evict-only / pin-skip code — mark INCONCLUSIVE and rebuild *before* starting, not mid-case. |
| 61 | +2. Mux only via `user-mcpmux`. |
| 62 | +3. `mcpmux_list_servers` is not all-`bindable`. If it is, Case E failed (or header is empty). Do not paper over it with `set_workspace_root` until E is scored. |
| 63 | +4. Grep guard for the deleted landmine (any time): |
| 64 | + |
| 65 | +```bash |
| 66 | +rg "Unexpected STDIO transport for OAuth reconnection" \ |
| 67 | + crates/mcpmux-gateway/src "$LOG" |
| 68 | +``` |
| 69 | + |
| 70 | +Must be **zero** hits in source. Historical log lines from before `dcc2977` do not fail this run. |
| 71 | + |
| 72 | +--- |
| 73 | + |
| 74 | +## Case E — header pin, no `set_workspace_root` (~2 min) |
| 75 | + |
| 76 | +**Goal:** a non-empty `X-Mcpmux-Workspace` makes this repo bound. A 6-folder `roots/list` is not a binding. |
| 77 | + |
| 78 | +1. `mcpmux_list_servers`. |
| 79 | +2. Grep the last minute of `$LOG`: |
| 80 | + |
| 81 | +```bash |
| 82 | +rg "SessionRoots|X-Mcpmux-Workspace|pinned explicit workspace|held until mcp-session-id|PendingRoots|multiple roots reported" "$LOG" | tail -n 80 |
| 83 | +``` |
| 84 | + |
| 85 | +**Pass:** at least one server is `ready` (or `bound` with a real block, not "unpinned roots"). Log shows a pin (`pinned explicit workspace root` or `held until mcp-session-id` then pin), not `multiple roots reported, no pinned header — PendingRoots`. |
| 86 | +**Fail:** every server `bindable` *and* the log shows a non-empty workspace header that was skipped (`pin skipped` / `present without mcp-session-id` without a later pin). |
| 87 | +**Inconclusive:** header is empty (`present but empty`) — Agents-window hole, out of scope. Note it. |
| 88 | + |
| 89 | +Do **not** call `set_workspace_root` before scoring. |
| 90 | + |
| 91 | +--- |
| 92 | + |
| 93 | +## Case F — stdio OAuth refuse + transport-closed still reconnects (~5 min) |
| 94 | + |
| 95 | +**Goal:** killing a stdio child still uses `reconnect_fresh`. It must not go through `reconnect_after_oauth` / HTTP. |
| 96 | + |
| 97 | +1. `mcpmux_search_tools({ "server_id": "wakatime", "mode": "browse", "limit": 5 })`. Need `server_readiness: ready`. |
| 98 | +2. Invoke `wakatime` / `wakatime_wakatime_summaries` with explicit `start`/`end` for today. Warm the instance. |
| 99 | +3. Note `date -u +%H:%M:%S`. |
| 100 | +4. Kill **only the child**: |
| 101 | + |
| 102 | +```bash |
| 103 | +pgrep -lf wakatime |
| 104 | +# kill <child-pid> |
| 105 | +# Do not kill target/debug/mcpmux. |
| 106 | +``` |
| 107 | + |
| 108 | +5. Same chat, same invoke. No `set_workspace_root`. |
| 109 | +6. Grep from step 3: |
| 110 | + |
| 111 | +```bash |
| 112 | +rg "backend call_tool failed|reconnect attempted after call_tool failure|reconnect_fresh completed|reconnect_after_oauth|stdio cannot reconnect via OAuth|Unexpected STDIO" "$LOG" |
| 113 | +``` |
| 114 | + |
| 115 | +**Pass:** invoke succeeds (or a normal tool error). Logs: `trigger=transport_closed`, `reconnect_fresh completed ok=true`. No `Unexpected STDIO`, no OAuth reconnect for this kill. |
| 116 | +**Fail:** raw `Transport closed` / `-32000` to the agent, or HTTP OAuth reconnect for stdio. |
| 117 | + |
| 118 | +--- |
| 119 | + |
| 120 | +## Case G — config save reconnects (~5 min) |
| 121 | + |
| 122 | +**Goal:** `ServerConfigUpdated` runs `reconnect_fresh` for an enabled server. Next invoke does not say "bound but not connected." Do **not** click Retry Connection. |
| 123 | + |
| 124 | +Harmless write (revert after): |
| 125 | + |
| 126 | +1. Snapshot the row (`extra_headers` / `env_overrides`) for the target server. |
| 127 | +2. `PUT` admin `save_server_inputs` (or Configure save in the UI) adding one dummy key, e.g. `MCPMUX_TEST_PIN=1` in `env_overrides`. Do not change command/url. |
| 128 | +3. Do **not** call retry/reconnect from the UI. |
| 129 | +4. Invoke a cheap tool on that server. |
| 130 | +5. Grep: |
| 131 | + |
| 132 | +```bash |
| 133 | +rg "ServerConfigHandler|reconnect_fresh after config update|re-resolve failed, evicting only" "$LOG" |
| 134 | +``` |
| 135 | + |
| 136 | +**Pass:** `[ServerConfigHandler] reconnect_fresh after config update` with `ok=true` (or `ok=false` if the server cannot spawn, but the stale instance is gone and the error is a connect failure, not "bound but not connected"). Invoke works if the server is healthy. |
| 137 | +**Fail:** invoke returns "bound but not connected" / `diagnose_server`, or the handler only logs evict with no `reconnect_fresh`. |
| 138 | +6. Revert the dummy key the same way. |
| 139 | + |
| 140 | +If admin write is unavailable (no token / desktop-only), use the Configure UI. If neither is possible, **BLOCKED** — do not sqlite-edit the row (no event). |
| 141 | + |
| 142 | +--- |
| 143 | + |
| 144 | +## Case H — rebuild 404, last (~5 min + MCP reload) |
| 145 | + |
| 146 | +**Goal:** process death → inbound 404 is expected. `/health` is the liveness check. Recovery is Reload MCP. Do not persist sessions. |
| 147 | + |
| 148 | +This **will** 404 the current Cursor MCP session. Run it last. |
| 149 | + |
| 150 | +1. `curl -sf http://127.0.0.1:45818/health` → ok. |
| 151 | +2. Trigger a Rust rebuild (`touch` a gateway `.rs` or wait for `tauri dev` to recycle). Do **not** `pkill -f mcpmux`. |
| 152 | +3. While the new process is up: `/health` is 200. A `POST /mcp` with the old `Mcp-Session-Id` is 404. Logs do not `warn` the 404 (`expected session noise`). |
| 153 | +4. Reload MCP **once**. |
| 154 | +5. Re-run Case E (list_servers). Expect bound, not 6-way `bindable`, without `set_workspace_root` if the header is a real path. |
| 155 | + |
| 156 | +**Pass:** health 200 throughout the new process; chats 404 until Reload MCP; after reload, Case E still passes. |
| 157 | +**Fail:** `/health` down and we treat 404 as "gateway dead"; or after reload + real header, everything is `bindable` (Case E fail). |
| 158 | +**Skip if:** you cannot afford to 404 this chat. Score from an earlier same-day rebuild in `$LOG` if the lines are unambiguous; otherwise SKIPPED. |
| 159 | + |
| 160 | +--- |
| 161 | + |
| 162 | +## Do not |
| 163 | + |
| 164 | +- `set_workspace_root` to recover a closed backend. |
| 165 | +- `pkill -f mcpmux`. |
| 166 | +- Rebuild except Case H. |
| 167 | +- Leave the Case G dummy env/header in place. |
| 168 | +- Widen the transport-closed matcher if F fails with a new string — log `trigger=` and stop. |
| 169 | + |
| 170 | +--- |
| 171 | + |
| 172 | +## Report back |
| 173 | + |
| 174 | +``` |
| 175 | +Case E header pin: PASS | FAIL | INCONCLUSIVE |
| 176 | + list_servers: ready/bound/all-bindable |
| 177 | + pin log: |
| 178 | + set_workspace_root used: no |
| 179 | +
|
| 180 | +Case F stdio refuse: PASS | FAIL | INCONCLUSIVE | SKIPPED |
| 181 | + server_id / tool: |
| 182 | + first invoke: |
| 183 | + child pid: |
| 184 | + second invoke: |
| 185 | + trigger=: |
| 186 | + reconnect_fresh ok=: |
| 187 | + Unexpected STDIO / OAuth: yes/no |
| 188 | +
|
| 189 | +Case G config save: PASS | FAIL | BLOCKED |
| 190 | + server_id: |
| 191 | + write path (admin/UI): |
| 192 | + handler log: |
| 193 | + invoke after save: |
| 194 | + reverted: yes/no |
| 195 | +
|
| 196 | +Case H rebuild 404: PASS | FAIL | SKIPPED |
| 197 | + health during/after: |
| 198 | + 404 observed: |
| 199 | + reload MCP: |
| 200 | + Case E after reload: |
| 201 | +``` |
0 commit comments