Skip to content

fix(wsl-mover): a moved project's chat opens and answers here; a fenced terminal names its host - #34880

Merged
nwparker merged 2 commits into
mainfrom
nwparker/wsl-moved-chat-send-e2e
Oct 28, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/wsl-moved-chat-send-e2e

Conversation

@nwparker

@nwparker nwparker commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​182 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​182
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​42 $\color{#cf222e}{\Huge{\mathbf{−}}}$​9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​33

ELI5

After a project moves to its WSL host, its existing chats stay on this computer. Until now, no test proved they still work. This PR adds that end-to-end test: open the moved project's chat, send a message, and a reply comes back from the agent on this computer, with no host involved.

Writing the test found a real crash. Opening a moved project's chat from its sidebar entry took down the whole terminal workbench ("Orca hit a recoverable UI error"). That's fixed here.

The PR also fixes a misleading message. A new terminal in a project the host now owns was refused with "This project is moving… try again when the move finishes". That move had already finished. The message now names the host and the way back.

What Changed

  • New e2e (wsl-move-moved-project-chat-send.spec.ts):

    1. It creates a real Claude chat in a project, using the repo's structured Claude stub. Only the stub's directory is on PATH, so no real Claude can answer.
    2. It seeds a committed WSL move of that project and relaunches.
    3. It opens the chat from the "Moved to Ubuntu host" entry, types a message and sends it.
    4. It asserts that "Stub reply." arrives, that the stub launched again after the move (this computer ran the agent), and that no runtime environment exists, so nothing went to a host.

    It's POSIX-only, like the other stub-based chat specs.

  • Crash fix (NativeChatPromptEditor): opening the chat switches workspace and asks the composer for focus in the same tick. The focus request reached the prompt editor before tiptap had mounted its view, and tiptap's view throws then: "The editor view is not available".

    • The editor handle's focus and contains now go through mountedEditorView, which returns null before mount or after destroy.
    • Focus waits for the next reveal instead of throwing. This affects any activation that switches workspace and focuses a chat at once, not only moved projects.
  • Fenced-terminal message (WslMoveProjectFencedError, spawn-cwd.ts): when the project's move has already committed, the PTY spawn refusal now says: "This project now runs on its WSL host, so its terminals open there. Use it on this computer again to open one here."

    • The error code is unchanged (wsl_move_in_progress).
    • A move still in progress keeps the old message.
    • This is the path a chat agent's request for a terminal in that project would take.

Why

  • The test: it closes a flag-on checklist unknown, whether a moved project's chats still work.
  • Crash fix: it guards the editor handle instead of delaying the activation, because any caller can request focus. The handle is the one place that knows whether the view exists.
  • Message: it reuses the existing error and the journal's host-distro lookup, so callers and the error code don't change.

Linked Issue

N/A (maintainer, WSL mover flag-on checklist).

Visual Proof

The crash, before the fix: opening the moved chat showed "Orca hit a recoverable UI error / React render error in terminal-workbench", with tiptap's "The editor view is not available" in the renderer log. After the fix, the new e2e opens the chat, sends a message and sees the reply.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • The new e2e:

    • It failed before the fix, at the composer, with the workbench crash.
    • It passes after the fix, alongside the existing wsl-move-moved-project-chats.spec.ts (3/3, built locally, background launch).
  • native-chat-mounted-editor-view.test.ts: returns null before mount and after destroy without throwing, and returns the view once mounted.

  • spawn-cwd-wsl-move.test.ts: after a committed move, a fresh terminal is refused with the message naming the host, not the "try again" one.

  • Local checks:

    • tc and typecheck:ci pass;
    • check:code-quality:changed, audit:anti-slop, ast-grep-gates and the full pnpm lint pass;
    • the native-chat and pty host-env suites pass, apart from one draft-store test that timed out under load and passes alone.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Cross-platform: the editor guard is platform-neutral. The e2e is POSIX-only (stub wrapper). The message change only fires for WSL moves.
  • SSH and mobile: unaffected.
  • Owner decision, flagged separately: whether a desktop chat in a host-owned project should stay writable.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…ed terminal names its host

New e2e: a moved project's existing chat still answers after the move, run by this computer's
agent, with no host involved. Writing it surfaced two product gaps:
- Opening the chat from the moved project's sidebar entry asked its composer for focus before
  the prompt editor mounted; tiptap threw and the terminal workbench crashed. The editor handle
  now focuses (and answers contains) only once its view is mounted.
- A new terminal in a project its WSL host now owns (one a chat's agent might ask for) was
  refused with "is moving ... try again when the move finishes". It now names the host and the
  way back: use the project on this computer again.
… sending

Like #34573: the composer must be editable before typing, and hold the typed text before Send.
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The changes update WSL move fencing so terminal requests can identify the destination host, and add an end-to-end test for sending a chat message after a committed move. They also add a mounted-editor-view helper and use it to guard native chat focus and containment checks.

Priority: Normal

Merge Risk: Low · up to 82caf

The change is broadly mergeable, but the moved-chat test needs stronger assertions for project cwd and local-only execution.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title names two real changes in the diff: the moved-project chat fix in the editor focus path and the fenced-terminal message naming the WSL host. It is long and joins two topics with a semicolon,…
Description check Passed The description follows the template's main sections: ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Review, Agent skill upstream boundary, Notes, and Checklist. It explains the before …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names two real changes in the diff: the moved-project chat fix in the editor focus path and the fenced-terminal message naming the WSL host. It is long and joins two topics with a semicolon, but it is related to the changeset and is not misleading or vague.

Full details: Description check

Explanation

The description follows the template's main sections: ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Review, Agent skill upstream boundary, Notes, and Checklist. It explains the before and after, the mechanism, and the rationale in detail. Gaps: the Linked Issue section says N/A for a maintainer, which the template allows, but the Visual Proof section describes a crash and a post-fix e2e run rather than attaching before and after media. Also, the AI Disclosure section is absent, the Testing checkbox for manual testing is unchecked, and the final pnpm checklist item is unchecked. The author also states that the native-chat and PTY suites were not fully green. These gaps are minor relative to the overall completeness.

Full details: Docstring Coverage

Explanation

Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 7 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nitpick comments: 1
tests/e2e/wsl-move-moved-project-chat-send.spec.ts: 1

129-129: Trivial · Functional Correctness · Quick win

Assert the chat launch cwd.

The test binds the chat to repoPath, but Stub reply. does not depend on the agent cwd. Record process.cwd() in the stub launch log and assert the chat launch uses the canonical repoPath (realpathSync(repoPath)). The existing structured-chat test checks launch arguments and provider IDs, not cwd.

This is a test-coverage improvement, not evidence of a current production failure.


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4fc2ada8-79c2-4064-9faa-2847c7bea427
Commits

Reviewing files that changed from the base of the PR and between a891e36 and c4c5899.

Files selected for processing: 7
  • src/main/ipc/pty/host-env/spawn-cwd-wsl-move.test.ts
  • src/main/ipc/pty/host-env/spawn-cwd.ts
  • src/main/persistence/moving-wsl-projects/wsl-move-scope-guard.ts
  • src/renderer/src/components/native-chat/NativeChatPromptEditor.tsx
  • src/renderer/src/components/native-chat/native-chat-mounted-editor-view.test.ts
  • src/renderer/src/components/native-chat/native-chat-mounted-editor-view.ts
  • tests/e2e/wsl-move-moved-project-chat-send.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nitpick comments: 1
tests/e2e/wsl-move-moved-project-chat-send.spec.ts: 1

135-138: Trivial · Maintainability & Code Quality · Quick win

Assert runtime-host absence at the runtime boundary.

runtimeEnvironments.list() reads only the persisted environment catalog. An empty result does not detect transient or unlisted runtime-host activity, so this test can pass even if the send contacts a runtime host. Assert an execution-target/local marker, or instrument runtime-host requests and assert zero activity. Keep the existing working-directory assertion separate.


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0bb707cf-a4ce-4b5d-84a0-3d9e82b52c53
Commits

Reviewing files that changed from the base of the PR and between c4c5899 and 82caffc.

Files selected for processing: 1
  • tests/e2e/wsl-move-moved-project-chat-send.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

@nwparker
nwparker merged commit fac8a74 into main Oct 28, 2026
57 checks passed
nwparker added a commit that referenced this pull request Nov 6, 2026
…ery keeps

Since #34683 a move journal promotes the WSL hosts gate to serve-only, so startup
recovery now runs and undoes a move interrupted before blobs-transferred. The
spec restarted at source-fenced and expected the fence to survive; assert the
undo there, fence from blobs-transferred, and expect the committed refusal to
name the host (#34880). Route fence and recovery sources to the spec.

Co-Authored-By: Claude <[email protected]>
nwparker added a commit that referenced this pull request Nov 6, 2026
…ery keeps (#39200)

Since #34683 a move journal promotes the WSL hosts gate to serve-only, so startup
recovery now runs and undoes a move interrupted before blobs-transferred. The
spec restarted at source-fenced and expected the fence to survive; assert the
undo there, fence from blobs-transferred, and expect the committed refusal to
name the host (#34880). Route fence and recovery sources to the spec.

Co-authored-by: Claude <[email protected]>
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