Skip to content

test: live cross-process provider session reuse e2e (Myra codepath) (by Wren) - #448

Merged
conoremclaughlin merged 1 commit into
mainfrom
wren/test/session-reuse-live-e2e
Jul 30, 2026
Merged

test: live cross-process provider session reuse e2e (Myra codepath) (by Wren)#448
conoremclaughlin merged 1 commit into
mainfrom
wren/test/session-reuse-live-e2e

Conversation

@conoremclaughlin

Copy link
Copy Markdown
Owner

Why

Stage 2 (#446) had strong unit coverage but its integration/live tiers were validated manually (shell runs against real Claude). This codifies the highest-value manual proof — the cross-process/Myra codepath — into a committed test, closing that gap.

What it asserts

Two SEPARATE ink chat --non-interactive processes (like two heartbeats) sharing one PCP session id, against a real server + real Claude:

  • exactly ONE native jsonl created across both invocations — process 2 resumes, it does not fragment into a new file (this is the exact opacity the feature fixes);
  • the ink transcript's backend_session marker matches that jsonl id;
  • the resumed session recalls a codeword planted in process 1, though process 2 sent only the delta (cross-process continuity).

The first two are deterministic (independent of LLM phrasing); the recall is a substring check.

How it runs

  • Opt-in: INK_LIVE_RUN_CLAUDE=1 yarn test:live (costs Claude API).
  • Gated on server reachability; excluded from the default yarn test (via the existing **/*.live.test.ts exclude).
  • realpath's the fixture cwd so it matches how Claude keys its project dir on macOS.
  • Verified locally: 1 passed (~12s).

Coverage honesty

Covers 2B (cross-process). 2A (across-turn interactive) and the envelope-shape-drift reseed stay unit-covered — the interactive multi-turn path resists automation (readline doesn't consume piped stdin past the first line). Open to ideas if you know a clean way to drive interactive multi-turn.

🤖 Generated with Claude Code

…by Wren)

Codifies the manual validation from Stage 2 (#446) into a committed live test:
two SEPARATE `ink chat --non-interactive` processes (like two Myra heartbeats)
sharing one PCP session id must resume the SAME native Claude session.

Asserts, against a real server + real Claude backend:
- exactly ONE native jsonl is created across both invocations (deterministic —
  process 2 resumes, it does not fragment into a new file; this is the exact
  regression the feature fixes);
- the ink transcript's backend_session marker matches that jsonl id;
- the resumed session recalls a codeword planted in process 1 though process 2
  only sent the delta (cross-process continuity).

The mechanism assertions are deterministic (don't depend on LLM phrasing); the
recall check is a substring. Opt-in via INK_LIVE_RUN_CLAUDE + `yarn test:live`;
gated on server reachability; excluded from the default suite. realpath's the
fixture cwd so it matches how Claude keys its project dir on macOS.

Covers 2B (cross-process). 2A across-turn + envelope-shape-drift reseed stay
unit-covered — the interactive multi-turn path resists automation (readline
doesn't consume piped stdin past the first line).

Co-Authored-By: Wren <noreply@anthropic.com>

@conoremclaughlin conoremclaughlin left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — no findings.

I checked the new live test against the Stage 2 cross-process path: it reattaches by PCP session id, recovers the backend_session marker from the transcript, asserts the native Claude jsonl doesn’t fragment on the second process, and verifies the codeword continuity as a higher-level smoke signal. The macOS realpath handling for Claude’s project-dir keying looks right.

Validation run locally:

  • git diff --check origin/main...HEAD
  • yarn test:live packages/cli/src/repl/session-reuse.live.test.ts (skipped as expected without INK_LIVE_RUN_CLAUDE/CLAUDE_LIVE_READY)
  • yarn workspace @inklabs/cli vitest run src/commands/chat.session-reuse.test.ts src/commands/claude.test.ts src/backends/adapters.test.ts (122 passed)
  • yarn workspace @inklabs/cli type-check
  • yarn workspace @inklabs/cli build
  • yarn workspace @inklabs/cli test (974 passed, 4 skipped)

I did not run the costly live Claude path in this review because the live opt-in env was not set.

@conoremclaughlin
conoremclaughlin merged commit 199756e into main Jul 30, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant