Claude Code. Any Model. The most powerful AI coding agent now speaks every language.
test(session): follow the channel-to-session module rename
Jack Rudenko70beafb8d971
diff --git a/.github/workflows/test.yml b/.github/workflows/test.ymlindex d4b5ead5..db2daa93 100644--- a/.github/workflows/test.yml+++ b/.github/workflows/test.yml@@ -94,7 +94,7 @@ jobs:run: bun run lint# CLAUDISH_SKIP_LIVE_E2E is REQUIRED here, and not just an optimisation.- # channel/e2e-channel.test.ts probes for a usable Claude Code at MODULE+ # mcp-session/e2e-sessions.test.ts probes for a usable Claude Code at MODULE# LOAD by spawning `claude --version` and awaiting only its `exit` event.# A runner has no `claude` binary, so spawn emits `error` instead, the# promise never settles, and the whole suite hangs until the job isdiff --git a/ai-docs/architecture/mcp-sessions.md b/ai-docs/architecture/mcp-sessions.mdindex 6cc694d4..116ce7e2 100644--- a/ai-docs/architecture/mcp-sessions.md+++ b/ai-docs/architecture/mcp-sessions.md@@ -332,7 +332,7 @@ answers the session's current 160×50 screen `{seq, cols, rows, cursor, lines, fat about 1 Hz. Their errors are a JSON `ContractError`. `team` gains the same verbs as modes(`list`, `status`, `capture`, `cancel`).-The tool list is pinned by an EXACT frozen array in `mcp-session/e2e-channel.test.ts`, so+The tool list is pinned by an EXACT frozen array in `mcp-session/e2e-sessions.test.ts`, soadding or removing a tool without updating that test fails CI. That is deliberate:it is a wire contract, and an accidental change to the tool surface should be loud.@@ -503,12 +503,12 @@ not checked". `testing.md` has the rules.on-disk records the monitor reads. These were written blind from the 10.4.0 specification; thepane port changed only the adapters and the fake, and every replaced assertion cites its RB/Dnumber.-- `channel-wire-format.test.ts` — the capability declaration: no `experimental` for any tool mode.+- `session-wire-format.test.ts` — the capability declaration: no `experimental` for any tool mode.- `../mcp-contract.e2e.test.ts` — the mod contract v1 through a real MCP server over JSON-RPC;`../mcp-shutdown.e2e.test.ts` — stdin EOF, SIGTERM and SIGKILL of a server holding a live sessionand a live team run.-**The tool list is pinned per group, and adding a tool must break a pin.** `e2e-channel.test.ts` freezes the full 14-name list, the session-only 7 and the low-level 3, deliberately: that list is a wire contract and an accidental change to it should be loud. `get_diagnostics` and `capture_session` each broke both pins on the way in, which is the guard working.+**The tool list is pinned per group, and adding a tool must break a pin.** `e2e-sessions.test.ts` freezes the full 14-name list, the session-only 7 and the low-level 3, deliberately: that list is a wire contract and an accidental change to it should be loud. `get_diagnostics` and `capture_session` each broke both pins on the way in, which is the guard working.E2E tests use `--strict-mcp-config --bare --dangerously-skip-permissions` for isolation. SessionManager tests point child spawns at the tree under test via `CLAUDISH_BIN` (`spawn-claudish.ts`), never at the installed binary.diff --git a/ai-docs/architecture/testing.md b/ai-docs/architecture/testing.mdindex b05cd2c5..d0c43092 100644--- a/ai-docs/architecture/testing.md+++ b/ai-docs/architecture/testing.md@@ -66,7 +66,7 @@ hosted catalog changed its answer.## A gate must not also gate its own diagnostic-`e2e-channel.test.ts` Group 2 spawns a real `claude -p`, so it needs a working credential.+`e2e-sessions.test.ts` Group 2 spawns a real `claude -p`, so it needs a working credential.It gates on a genuine probe — one tiny headless prompt, treating a login/credential error as"not usable" — which is the right design. But the probe itself lived inside`if (!SKIP_LIVE_E2E) { … }`.@@ -75,7 +75,7 @@ So running with `CLAUDISH_SKIP_LIVE_E2E=1` — which is the normal, recommendedsuite — meant the probe never executed, `claudeUsable` stayed `false`, and Group 2 reported:```-[e2e-channel] Group 2 SKIPPED — `claude -p` is unavailable or not authenticated+[e2e-sessions] Group 2 SKIPPED — `claude -p` is unavailable or not authenticated```**That message is a claim about the environment that the environment was never asked.** It isdiff --git a/ai-docs/reports/channel-transport-design-20260822.md b/ai-docs/reports/channel-transport-design-20260822.mdindex fb79a1b4..e5fd8cd6 100644--- a/ai-docs/reports/channel-transport-design-20260822.md+++ b/ai-docs/reports/channel-transport-design-20260822.md@@ -393,7 +393,7 @@ sessions only.| `SessionInfo` | Additive. `turnsCompleted`/`tokensUsed` finally get real values; add `costUsd`, `toolCallCount`, `terminalReason`, `claudeSessionId`. Existing consumers unaffected. || `get_output` | **Breaking if done naively.** Today it returns raw stdout. Fix: `output` keeps returning **prose** — `AnswerBuffer` (all assistant text, concatenated, exactly `team-stream-capture`'s contract), which is *strictly better* than today's final-message-only text. Add `format: "text" \| "events"` (default `"text"`) and an `events` array behind the opt-in. Callers see more content in the same field, never JSON they did not ask for. || `list_sessions` | Unchanged shape. |-| channel notifications | Unchanged wire format. The 7-value `event` enum is preserved; every value becomes *reachable* for the first time. `channel-wire-format.test.ts` stays green. |+| channel notifications | Unchanged wire format. The 7-value `event` enum is preserved; every value becomes *reachable* for the first time. `session-wire-format.test.ts` stays green. || `EVENT_TO_TASK_STATUS` | Unchanged. Add `["timeout","failed"]` for completeness once `"timeout"` can actually be emitted (§6.1). |---diff --git a/ai-docs/reports/channel-transport-implementation-20260822.md b/ai-docs/reports/channel-transport-implementation-20260822.mdindex 122835a0..b7bf72b0 100644--- a/ai-docs/reports/channel-transport-implementation-20260822.md+++ b/ai-docs/reports/channel-transport-implementation-20260822.md@@ -249,7 +249,7 @@ I wrote no tests, per instruction. Current state, `CLAUDISH_SKIP_LIVE_E2E=1`:- The 12th, `team-timeout-repro.test.ts › REPRO: process that completes just before timeout`,**passes in isolation** (8/8) and fails only in the contended full run — the documented`project_test_contention_false_failures` flake.-- `channel-wire-format.test.ts` (6) and `scrollback-buffer.test.ts` (11) both pass: **the+- `session-wire-format.test.ts` (6) and `scrollback-buffer.test.ts` (11) both pass: **thechannel wire contract is intact.**- `team-stats`, `team-stream-capture`, `stats-buffer`, `session/`, `process-tree`,`status-line-context`: 123/123 pass.@@ -696,7 +696,7 @@ the two expectations — G1 and G2 are no longer the same fact.## 3. TWO MORE tests fail, and they are supposed to`ai-docs/architecture/mcp-channel.md` states the rule: *"The roster is pinned by an EXACT-frozen array in `channel/e2e-channel.test.ts`, so adding or removing a tool without updating+frozen array in `mcp-session/e2e-sessions.test.ts`, so adding or removing a tool without updatingthat test fails CI. That is deliberate: it is a wire contract."* `get_diagnostics` is a newtool, so both pins fire. This is the guard working, not collateral damage — but it is asecond and third test change the task did not anticipate, and it is not mine to make.@@ -706,13 +706,13 @@ second and third test change the task did not anticipate, and it is not mine to"create_session",+ "get_diagnostics","get_output",- at …/packages/cli/src/channel/e2e-channel.test.ts:87:19+ at …/packages/cli/src/mcp-session/e2e-sessions.test.ts:87:19(fail) Group 1b: MCP Protocol — channel-only tools > lists only the 5 channel tools when CLAUDISH_MCP_TOOLS=channel"create_session",+ "get_diagnostics","get_output",- at …/packages/cli/src/channel/e2e-channel.test.ts:262:19+ at …/packages/cli/src/mcp-session/e2e-sessions.test.ts:262:19```The second one's TITLE also needs changing — there are six channel tools now, not five.diff --git a/ai-docs/reports/channel-transport-mutation-proof-20260822.md b/ai-docs/reports/channel-transport-mutation-proof-20260822.mdindex f1f42139..1d5072f7 100644--- a/ai-docs/reports/channel-transport-mutation-proof-20260822.md+++ b/ai-docs/reports/channel-transport-mutation-proof-20260822.md@@ -52,10 +52,10 @@ packages/cli/src/channel/session-manager.test.ts:packages/cli/src/channel/scrollback-buffer.test.ts:11 pass-packages/cli/src/channel/e2e-channel.test.ts:+packages/cli/src/mcp-session/e2e-sessions.test.ts:[e2e-channel] Group 2 SKIPPED — `claude -p` is unavailable or not authenticated (needs ANTHROPIC_API_KEY or a headless-usable claude.ai login).-packages/cli/src/channel/channel-wire-format.test.ts:+packages/cli/src/mcp-session/session-wire-format.test.ts:8 passpackages/cli/src/channel/stream-json-reducer.test.ts:diff --git a/ai-docs/reports/mcp-magmux-panes/phase7-live-validation.md b/ai-docs/reports/mcp-magmux-panes/phase7-live-validation.mdindex 2045657d..3d979619 100644--- a/ai-docs/reports/mcp-magmux-panes/phase7-live-validation.md+++ b/ai-docs/reports/mcp-magmux-panes/phase7-live-validation.md@@ -277,7 +277,7 @@ the host, received 5 `notifications/claude/channel` frames: a4a1994e `running`/`The `running` frame also carries the new optional `meta.activity: "thinking"`.-`bun test <repo>/packages/cli/src/channel/channel-wire-format.test.ts` → `9 pass, 0 fail, 66 expect() calls [18.78s]`.+`bun test <repo>/packages/cli/src/mcp-session/session-wire-format.test.ts` → `9 pass, 0 fail, 66 expect() calls [18.78s]`.## Extrasdiff --git a/ai-docs/reports/mcp-magmux-panes/session-record/architecture.md b/ai-docs/reports/mcp-magmux-panes/session-record/architecture.mdindex 020912b2..1f98fb41 100644--- a/ai-docs/reports/mcp-magmux-panes/session-record/architecture.md+++ b/ai-docs/reports/mcp-magmux-panes/session-record/architecture.md@@ -1876,7 +1876,7 @@ and the per-test hermetic env (§12.1), keeping its assertions:| Consumer | Action ||---|---|-| `channel/channel-wire-format.test.ts` (FR10) | repoint; every frame assertion kept; `awaiting_permission` case added |+| `mcp-session/session-wire-format.test.ts` (FR10) | repoint; every frame assertion kept; `awaiting_permission` case added || `team-cancel.test.ts`, `team-heartbeat-survival.test.ts`, `team-liveness-exited-slot.test.ts`, `team-multibyte-answer.test.ts` | repoint; rewritten per §12.4 || `channel/session-create-options.test.ts` | repoint; `keepUnrecognizedJson` case deleted || `mcp-e2e/runner.ts` | repoint its child to `CLAUDISH_BIN=<fake>`; the runner sets the hermetic env (10.4.0's `userHomeFrom` sessions path kept) |@@ -1980,7 +1980,7 @@ behaviour; it is recorded in `ROADMAP.md` with this trigger, and R15 verifies th`pane/pane-session.integration.test.ts`, `pane/pane-registry.test.ts`, `team-orchestrator.test.ts`,`team-cancel.test.ts`, `team-heartbeat-survival.test.ts`, `team-liveness-exited-slot.test.ts`,`team-multibyte-answer.test.ts`, `team-mcp-shape-contract.e2e.test.ts`, `team-cli-signal.test.ts`,- `channel/session-manager.test.ts`, `channel/channel-wire-format.test.ts`,+ `channel/session-manager.test.ts`, `mcp-session/session-wire-format.test.ts`,`channel/session-create-options.test.ts`, `mcp-contract.e2e.test.ts`, r2's`pane/pane-child-real-claudish.integration.test.ts`, and **[r-base]** the ported session-records suites(`channel/host-pid.contract.test.ts`, `channel/session-state-records.contract.test.ts`,@@ -2138,9 +2138,9 @@ reaches the status-line path (F3); `CLAUDE_CODE_CHILD_SESSION` stripped (F4); a| `team-result-card.test.ts`, `team-status-payload.test.ts` | CANCELLED, new reasons, `blocked` listing, `run` row, `contract_version`/`capabilities`, derived `*_by_slot` maps; note ordering kept || `channel/session-manager.test.ts` | Lifecycle on panes. G1/G2 timeout stays timeout in memory, meta and wire, **sending while RUNNING (queued)**. G4 uses the new flag check. G7: promptless → send while STARTING (queued) → answer. D1–D5 disk recovery with the new artifact set. G3 and the 585 mapping kept. || `channel/session-create-options.test.ts` | `sessionId`, `sessionDir`, `tokenFile` reach the child (`env_probe`) |-| `channel/channel-wire-format.test.ts` | Every assertion kept (FR10); fake swapped; `awaiting_permission` added; **[r-base]** the SEP-1686 table loses 10.4.0's `finishing` row, keeps its `timeout: failed` row |+| `mcp-session/session-wire-format.test.ts` | Every assertion kept (FR10); fake swapped; `awaiting_permission` added; **[r-base]** the SEP-1686 table loses 10.4.0's `finishing` row, keeps its `timeout: failed` row || `channel/session-manager.test.ts` (10.4.0 edits) **[r-base]** | 10.4.0's expectations are restated for panes: a one-shot session's events are `["running", "completed"]` (no `finishing`; STARTING is the initial state, not a transition); a promptless session is `waiting_for_input` once boot is ready (STARTING before), not at creation |-| `channel/e2e-channel.test.ts` | Pinned lists become **14** tools and **7** channel tools (`capture_session`); low-level stays 4 |+| `mcp-session/e2e-sessions.test.ts` | Pinned lists become **14** tools and **7** channel tools (`capture_session`); low-level stays 4 || `mcp-preflight-not-a-precondition.test.ts` | Re-run (it greps tool descriptions) || `process-tree.test.ts` | Kept |@@ -2207,7 +2207,7 @@ the built entry. Each takes a `ps` + listing (`ls /tmp/claudish-mux-$(id -u)/ /t| R9 | Transcript saving off | grep every capture for "Transcript saving is off": absent; transcript at the derived path | V6 || R10 | Channel parity | prompt → COMPLETED + `get_output`; promptless + `send_input` **sent while STARTING** → answer; `cancel_session`; `list_sessions` rows with B fields and CA-12 keys | V7 || R11 | `list` visibility | `team list` while running and after settle: `ACTIVE` → `SETTLED`, `finished_at`, `outcome`, CA-12 keys | V8 |-| R12 | Channel frames | `channel-wire-format.test.ts` green + one traced live frame (`CLAUDISH_CHANNEL_TRACE_FILE`) | V9 |+| R12 | Channel frames | `session-wire-format.test.ts` green + one traced live frame (`CLAUDISH_CHANNEL_TRACE_FILE`) | V9 || R13 | Concurrent `~/.claude.json` writes | 5-slot run with the 300 ms boot stagger (r2 mitigation, X-L8); `jq . ~/.claude.json` before and after | extra || R14 | `run` latency | 3 slots: expected 12–20 s; fail the design check above 60 s | extra || R15 | First-run dialog on a fresh config | `create_session` with `CLAUDE_CONFIG_DIR=<empty>` → FAILED `first_run_dialog`/`boot_blocked` with the text; no model call | extra |diff --git a/ai-docs/reports/mcp-magmux-panes/session-record/implementation-log.md b/ai-docs/reports/mcp-magmux-panes/session-record/implementation-log.mdindex 37ad5116..6f063602 100644--- a/ai-docs/reports/mcp-magmux-panes/session-record/implementation-log.md+++ b/ai-docs/reports/mcp-magmux-panes/session-record/implementation-log.md@@ -70,7 +70,7 @@ Raw logs: `impl1/final-{lint,typecheck,test}.log`.`EVENT_TO_TASK_STATUS` is now built from a `Record<ChannelEventType, TaskStatus>`, so a missing key is acompile error. `ReducerEvent` and `stream-json-reducer.ts` were narrowed from `ChannelEventType` to`SessionStatus` (print mode never emits `awaiting_permission`), which keeps the reducer untouched in- behaviour and makes its Phase 5 deletion local. `channel-wire-format.test.ts`'s `expectedMapping`+ behaviour and makes its Phase 5 deletion local. `session-wire-format.test.ts`'s `expectedMapping`was NOT given an `awaiting_permission` row (Phase 5 rewrites that file, §12.4).4. **F3:** the resolver is `resolveTokenFilePath(port, env)` in `session/session-stats.ts` (renamed from its`tokenFilePath`; the old name is gone). Default path uses the `$HOME`-first rule (`userHomeFrom`).@@ -682,7 +682,7 @@ Remaining, each legitimate:- `stream-json` in `cli.ts`, `index.ts`, `claude-runner.ts`, `types.ts`, `tui/runtime/*`: claudish'sown user-facing `-p` single-shot mode and its stdout contract.-- `stream-json` in `madbench/*`, `channel/e2e-channel.test.ts`, `channel/test-helpers/client-diagnostic.ts`:+- `stream-json` in `madbench/*`, `mcp-session/e2e-sessions.test.ts`, `channel/test-helpers/client-diagnostic.ts`:those drive their OWN `claude -p` client (madbench eval; the e2e/diagnostic harness), not a session child.- `--input-format stream-json` in `pane/child-flags.test.ts`, `channel/session-manager.test.ts`:asserts the flag is REFUSED.diff --git a/ai-docs/reports/mcp-progress-keepalive/architecture.md b/ai-docs/reports/mcp-progress-keepalive/architecture.mdindex 2df93727..3966a72b 100644--- a/ai-docs/reports/mcp-progress-keepalive/architecture.md+++ b/ai-docs/reports/mcp-progress-keepalive/architecture.md@@ -282,7 +282,7 @@ its keepalive could not arm. (Claude Code 2.1.231 does send it, value `2`, everyNothing about `notifyChannel` (line 1342), the `ChannelNotifier` type (line 423), the`SessionManager` bridge (line 1309), or the wire format pinned by-`channel-wire-format.test.ts` changes. The two mechanisms are complementary and were+`session-wire-format.test.ts` changes. The two mechanisms are complementary and weremeasured to be:| | visible to agent / human | resets idle timer |@@ -386,7 +386,7 @@ function; intervals are 20 ms so the file runs in well under a second.### B. `packages/cli/src/mcp/mcp-progress-wire.test.ts` — dispatch-level over real stdioSpawns `bun run packages/cli/src/index.ts --mcp` and speaks raw newline-framed JSON-RPC-to it, exactly like `channel/channel-wire-format.test.ts` (and reusing+to it, exactly like `mcp-session/session-wire-format.test.ts` (and reusing`mcp-e2e/jsonrpc-client.ts`'s framing where convenient). **No API key required**: theexisting `fake-claudish` PATH shim satisfies `team`, because `team-orchestrator.ts:599`spawns through `resolveClaudishSpawn()` just like `SessionManager` does. Child env sets@@ -410,7 +410,7 @@ spawns through `resolveClaudishSpawn()` just like `SessionManager` does. Child e### C. Regression guard on what must not change-`bun test packages/cli/src/channel/channel-wire-format.test.ts` must stay green+`bun test packages/cli/src/mcp-session/session-wire-format.test.ts` must stay greenuntouched — it pins the channel contract, and §4's whole claim is that channel behaviouris unchanged.diff --git a/packages/cli/src/claude-runner-token-file.test.ts b/packages/cli/src/claude-runner-token-file.test.tsindex def6b71f..60ec5334 100644--- a/packages/cli/src/claude-runner-token-file.test.ts+++ b/packages/cli/src/claude-runner-token-file.test.ts@@ -1,5 +1,5 @@/**- * F3: a parent that hands a child `CLAUDISH_TOKEN_FILE` (team, the channel, a pane)+ * F3: a parent that hands a child `CLAUDISH_TOKEN_FILE` (team, the session, a pane)* names the file the child's proxy writes. `createTempSettingsFile` used to ignore it* and point the status line at `~/.claudish/tokens-<port>.json`, then publish THAT* path as `CLAUDISH_TOKEN_FILE` to Claude Code, so the status line read a file nobody@@ -63,7 +63,7 @@ describe("resolveTokenFilePath", () => {const env = { HOME: home, CLAUDISH_TOKEN_FILE: parent, CLAUDISH_PUBLISHED_TOKEN_FILE: parent };expect(assignedTokenFile(env)).toBeNull();expect(resolveTokenFilePath(4000, env)).toBe(join(home, ".claudish", "tokens-4000.json"));- // a team slot / channel session sets a path of its own, which still wins+ // a team slot / session sets a path of its own, which still winsexpect(resolveTokenFilePath(4000, { ...env, CLAUDISH_TOKEN_FILE: "/run/stats/slot.json" })).toBe("/run/stats/slot.json");diff --git a/packages/cli/src/handlers/default-provider-e2e.test.ts b/packages/cli/src/handlers/default-provider-e2e.test.tsindex 4436fd75..6443f427 100644--- a/packages/cli/src/handlers/default-provider-e2e.test.ts+++ b/packages/cli/src/handlers/default-provider-e2e.test.ts@@ -421,7 +421,7 @@ describe("Hermetic proxy defaultProvider routing", () => {// the chain to a per-token provider. The suite's own failure count then tracked quota// balance rather than code, which is what makes it unusable as a regression baseline.//-// The flag is the same one `channel/e2e-channel.test.ts` already honours and that+// The flag is the same one `mcp-session/e2e-sessions.test.ts` already honours and that// `.github/workflows/test.yml` sets for CI. It is ANDed with the credential check, not// a replacement for it: "do not spend" and "cannot run" both have to be false before a// live call is made.diff --git a/packages/cli/src/mcp-session/e2e-channel.test.ts b/packages/cli/src/mcp-session/e2e-sessions.test.tssimilarity index 99%rename from packages/cli/src/mcp-session/e2e-channel.test.tsrename to packages/cli/src/mcp-session/e2e-sessions.test.tsindex 1452595f..72a17262 100644--- a/packages/cli/src/mcp-session/e2e-channel.test.ts+++ b/packages/cli/src/mcp-session/e2e-sessions.test.ts@@ -509,7 +509,7 @@ if (!SKIP_LIVE_E2E) {if (!claudeUsable) {console.warn(- "[e2e-channel] Group 2 SKIPPED — `claude -p` is unavailable or not authenticated " ++ "[e2e-sessions] Group 2 SKIPPED — `claude -p` is unavailable or not authenticated " +"(needs ANTHROPIC_API_KEY or a headless-usable claude.ai login).");}diff --git a/packages/cli/src/mcp-session/host-pid.contract.test.ts b/packages/cli/src/mcp-session/host-pid.contract.test.tsindex 39673bec..024ffdb8 100644--- a/packages/cli/src/mcp-session/host-pid.contract.test.ts+++ b/packages/cli/src/mcp-session/host-pid.contract.test.ts@@ -1,4 +1,4 @@-// packages/cli/src/channel/host-pid.contract.test.ts+// packages/cli/src/mcp-session/host-pid.contract.test.ts/*** Black-box contract tests for `hostPid`, `launcherPid` and `mcpPid` in spawn.json, against* real entry points (design §3.5 "hostPid, computed once at startup"; §8.1 tests 9a, 9b).diff --git a/packages/cli/src/mcp-session/parent-session.contract.test.ts b/packages/cli/src/mcp-session/parent-session.contract.test.tsindex 5b26bce4..865a010a 100644--- a/packages/cli/src/mcp-session/parent-session.contract.test.ts+++ b/packages/cli/src/mcp-session/parent-session.contract.test.ts@@ -1,6 +1,6 @@-// packages/cli/src/channel/parent-session.contract.test.ts+// packages/cli/src/mcp-session/parent-session.contract.test.ts/**- * Contract tests for channel/parent-session.ts: `hostPid`, and the `parentClaudeSessionId` a+ * Contract tests for mcp-session/parent-session.ts: `hostPid`, and the `parentClaudeSessionId` a* call records.** The parent contract, as measured on Claude Code 2.1.290: the host session recorddiff --git a/packages/cli/src/mcp-session/session-manager.test.ts b/packages/cli/src/mcp-session/session-manager.test.tsindex d5a58f40..346ad72b 100644--- a/packages/cli/src/mcp-session/session-manager.test.ts+++ b/packages/cli/src/mcp-session/session-manager.test.ts@@ -1,5 +1,5 @@/**- * Unit and process-level regression tests for the channel's interactive pane transport+ * Unit and process-level regression tests for the session's interactive pane transport* (architecture §7, §12.4).** Process-level tests drive `SessionManager` directly: every session is the fake@@ -40,8 +40,8 @@ import { projectsDir, transcriptPathFor } from "../session/session-discovery.js"import { readWaitLines } from "../test-helpers/contract-records.js";import {SessionManager,- channelEventFor,normaliseTimeoutSeconds,+ sessionEventFor,sessionRowOf,toMetaRecord,} from "./session-manager.js";@@ -110,8 +110,8 @@ function sampleInfo(over: Partial<SessionInfo> = {}): SessionInfo {// ─── pure ────────────────────────────────────────────────────────────────────-describe("exported channel seams (pure)", () => {- test("channelEventFor maps every SlotState (§3.4)", () => {+describe("exported session seams (pure)", () => {+ test("sessionEventFor maps every SlotState (§3.4)", () => {const cases: Array<[SlotState, string | null, string, string | null]> = [["STARTING", null, "starting", null],["RUNNING", "thinking", "running", null],@@ -129,8 +129,8 @@ describe("exported channel seams (pure)", () => {["TIMEOUT", null, "timeout", null],];for (const [state, activity, event, tool] of cases) {- expect(channelEventFor({ state, activity }), `${state}/${activity}`).toEqual({- event: event as ReturnType<typeof channelEventFor>["event"],+ expect(sessionEventFor({ state, activity }), `${state}/${activity}`).toEqual({+ event: event as ReturnType<typeof sessionEventFor>["event"],tool,});}diff --git a/packages/cli/src/mcp-session/session-records.contract.test.ts b/packages/cli/src/mcp-session/session-records.contract.test.tsindex fef757d9..3e277576 100644--- a/packages/cli/src/mcp-session/session-records.contract.test.ts+++ b/packages/cli/src/mcp-session/session-records.contract.test.ts@@ -1,4 +1,4 @@-// packages/cli/src/channel/session-records.contract.test.ts+// packages/cli/src/mcp-session/session-records.contract.test.ts/*** The record half that the 10.4.0 suites assume and pane sessions must now produce* (architecture §12.3, §20.1): `meta.json` keeps every 10.4.0 key with its 10.4.0 type,@@ -297,7 +297,7 @@ describe.skipIf(!MAGMUX_AVAILABLE)("live records", () => {);test(- "RB3 a question in a channel session opens one wait; send_input declines it and closes it to running",+ "RB3 a question in a session opens one wait; send_input declines it and closes it to running",async () => {const id = await created({ model: "fake-ask_user_send", prompt: "ask me something" });const blocked = await waitRow(id, (r) => r.state === "AWAITING_INPUT", "the question");diff --git a/packages/cli/src/mcp-session/session-state-records.contract.test.ts b/packages/cli/src/mcp-session/session-state-records.contract.test.tsindex cbcb5845..64f0fb46 100644--- a/packages/cli/src/mcp-session/session-state-records.contract.test.ts+++ b/packages/cli/src/mcp-session/session-state-records.contract.test.ts@@ -1,4 +1,4 @@-// packages/cli/src/channel/session-state-records.contract.test.ts+// packages/cli/src/mcp-session/session-state-records.contract.test.ts/*** Black-box contract tests for the state model as it reaches disk: the wait log* `waits.jsonl` (design §3.2, §3.3 "waits.jsonl"; §8.1 tests 1-4).@@ -13,7 +13,7 @@** The records on disk are the primary evidence: `waits.jsonl` gains an `open` line on every* transition into a wait, so its absence proves a session never waited.- * INFERRED: get_diagnostics reports the live channel event in an `event` field (adapter+ * INFERRED: get_diagnostics reports the live session event in an `event` field (adapter* `sessionStatus` in contract-mcp.ts, RB7).*/import { afterEach, beforeEach, describe, expect, test } from "bun:test";diff --git a/packages/cli/src/mcp-session/channel-wire-format.test.ts b/packages/cli/src/mcp-session/session-wire-format.test.tssimilarity index 100%rename from packages/cli/src/mcp-session/channel-wire-format.test.tsrename to packages/cli/src/mcp-session/session-wire-format.test.tsdiff --git a/packages/cli/src/mcp-session/spawn-record.contract.test.ts b/packages/cli/src/mcp-session/spawn-record.contract.test.tsindex 8f43ed41..eddd2bf8 100644--- a/packages/cli/src/mcp-session/spawn-record.contract.test.ts+++ b/packages/cli/src/mcp-session/spawn-record.contract.test.ts@@ -1,4 +1,4 @@-// packages/cli/src/channel/spawn-record.contract.test.ts+// packages/cli/src/mcp-session/spawn-record.contract.test.ts/*** Black-box contract tests for the start-time record `spawn.json` and its parent* conversation, end to end through a real claudish MCP server over stdiodiff --git a/packages/cli/src/mcp-session/team-run-record.contract.test.ts b/packages/cli/src/mcp-session/team-run-record.contract.test.tsindex 73d52c63..d6abef8c 100644--- a/packages/cli/src/mcp-session/team-run-record.contract.test.ts+++ b/packages/cli/src/mcp-session/team-run-record.contract.test.ts@@ -1,4 +1,4 @@-// packages/cli/src/channel/team-run-record.contract.test.ts+// packages/cli/src/mcp-session/team-run-record.contract.test.ts/*** Black-box contract tests for the team-run record and its exactly-once end* (design §3.3 "Team record", `finishTeamRun`; §8.1 tests 15, 17b; amendment 4).diff --git a/packages/cli/src/mcp-shutdown.e2e.test.ts b/packages/cli/src/mcp-shutdown.e2e.test.tsindex aef4ed7d..3937bc5a 100644--- a/packages/cli/src/mcp-shutdown.e2e.test.ts+++ b/packages/cli/src/mcp-shutdown.e2e.test.ts@@ -1,7 +1,7 @@/*** MCP server shutdown leaves nothing behind (architecture D15 layer 3, §20.3 item 8).*- * A real claudish MCP server over stdio holds a live channel session and a live team run,+ * A real claudish MCP server over stdio holds a live session and a live team run,* both panes of the pane fake (`@@HANG@@`: the prompt is accepted and never answered) in* real headless magmux under the test's own CLAUDISH_PANE_ROOT. Then:*@@ -62,7 +62,7 @@ interface Live {monitorRecord: string;}-/** A RUNNING channel session and an ACTIVE two-slot team run, both hanging. */+/** A RUNNING session and an ACTIVE two-slot team run, both hanging. */async function startWork(): Promise<Live> {const created = await server.callTool("create_session", {model: "contract-fake-model",diff --git a/packages/cli/src/pane/test-helpers/fake-interactive-child.ts b/packages/cli/src/pane/test-helpers/fake-interactive-child.tsindex 793578d3..20fb2f7e 100755--- a/packages/cli/src/pane/test-helpers/fake-interactive-child.ts+++ b/packages/cli/src/pane/test-helpers/fake-interactive-child.ts@@ -34,7 +34,7 @@ import { spawn } from "node:child_process";import { createHash, randomUUID } from "node:crypto";import { appendFileSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";import { dirname, join } from "node:path";-import { projectDirNameFor } from "../../channel/home-dir.js";+import { projectDirNameFor } from "../../mcp-session/home-dir.js";/* ───────────────────────────── argv and env ───────────────────────────── */diff --git a/packages/cli/src/pane/test-helpers/hermetic-env.ts b/packages/cli/src/pane/test-helpers/hermetic-env.tsindex cda84fde..d28c2874 100644--- a/packages/cli/src/pane/test-helpers/hermetic-env.ts+++ b/packages/cli/src/pane/test-helpers/hermetic-env.ts@@ -25,8 +25,8 @@ import {} from "node:fs";import { homedir, tmpdir } from "node:os";import { join } from "node:path";-import { projectDirNameFor } from "../../channel/home-dir.js";import { findMagmuxBinaryOrNull } from "../../launcher/magmux-binary.js";+import { projectDirNameFor } from "../../mcp-session/home-dir.js";import { readProcessTable } from "../process-identity.js";export const FAKE_CHILD = join(import.meta.dir, "fake-interactive-child.ts");diff --git a/packages/cli/src/session/session-discovery.test.ts b/packages/cli/src/session/session-discovery.test.tsindex 4863834a..ea889c3f 100644--- a/packages/cli/src/session/session-discovery.test.ts+++ b/packages/cli/src/session/session-discovery.test.ts@@ -2,7 +2,7 @@ import { afterAll, describe, expect, test } from "bun:test";import { mkdirSync, mkdtempSync, rmSync, utimesSync, writeFileSync } from "node:fs";import { tmpdir } from "node:os";import { join } from "node:path";-import { projectDirNameFor } from "../channel/home-dir.js";+import { projectDirNameFor } from "../mcp-session/home-dir.js";import {ACTIVE_WINDOW_MS,type SessionRow,diff --git a/packages/cli/src/team-run-settles-once.test.ts b/packages/cli/src/team-run-settles-once.test.tsindex 18b5f2d1..c0ee7173 100644--- a/packages/cli/src/team-run-settles-once.test.ts+++ b/packages/cli/src/team-run-settles-once.test.ts@@ -34,7 +34,7 @@ import {import { tmpdir } from "node:os";import { join } from "node:path";-import { SessionManager } from "./channel/session-manager.js";+import { SessionManager } from "./mcp-session/session-manager.js";import { waitNoOrphans } from "./pane/test-helpers/hermetic-env.js";import { type TeamStatus, setupSession, startModels } from "./team-orchestrator.js";import {diff --git a/packages/cli/src/test-helpers/contract-adapters.ts b/packages/cli/src/test-helpers/contract-adapters.tsindex 91c34af9..c7dca604 100644--- a/packages/cli/src/test-helpers/contract-adapters.ts+++ b/packages/cli/src/test-helpers/contract-adapters.ts@@ -13,7 +13,7 @@* Every test asserts the SPEC; only these functions bend to the implementation. If a contract* test fails with "ADAPTER:", fix this file, not the test.*/-import * as sessionManagerModule from "../channel/session-manager.js";+import * as sessionManagerModule from "../mcp-session/session-manager.js";import type { SlotState } from "../pane/index.js";import * as orchestrator from "../team-orchestrator.js";