test: live cross-process provider session reuse e2e (Myra codepath) (by Wren) - #448
Merged
Merged
Conversation
…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
left a comment
Owner
Author
There was a problem hiding this comment.
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...HEADyarn test:live packages/cli/src/repl/session-reuse.live.test.ts(skipped as expected withoutINK_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-checkyarn workspace @inklabs/cli buildyarn 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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-interactiveprocesses (like two heartbeats) sharing one PCP session id, against a real server + real Claude:backend_sessionmarker matches that jsonl id;The first two are deterministic (independent of LLM phrasing); the recall is a substring check.
How it runs
INK_LIVE_RUN_CLAUDE=1 yarn test:live(costs Claude API).yarn test(via the existing**/*.live.test.tsexclude).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