Skip to content

fix(wsl): held terminals read as a sentence; a person's worktree create starts its own terminals - #35935

Merged
nwparker merged 1 commit into
mainfrom
nwparker/wsl-hold-copy-followup
Oct 29, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/wsl-hold-copy-followup

Conversation

@nwparker

@nwparker nwparker commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​97 $\color{#cf222e}{\Huge{\mathbf{−}}}$​10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​87
Prod 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​77 $\color{#cf222e}{\Huge{\mathbf{−}}}$​14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​63

ELI5

When Orca holds a terminal because its WSL distro is stopped (#35813, #35865), some places still showed the raw code terminal_held_wsl_distro_stopped:Ubuntu:

  • A command or phone action whose terminal had to be recreated gets a plain sentence instead: "The WSL distro Ubuntu is stopped, so Orca didn't start this terminal. Start the distro, then try again." When Orca couldn't check the distro, it says so.
  • A background automation launch that was held now records the friendly "distro stopped" skip that fix(automations): a scheduled run never starts a stopped WSL distro #35857 added, not the raw code.
  • A worktree you create yourself (in the app, from the CLI, by an agent or from a paired phone) now opens its setup and default terminals as your own act, so they're never held. A worktree a scheduled automation creates keeps its terminals held, because scheduled runs never start a distro.

Flag-off: applies to WSL bridge workspaces, which exist with ORCA_INTERNAL_WSL_HOSTS unset too. Nothing changes for SSH, WSL-host (orcad) or non-WSL workspaces.

User risk: low.

  • Error wording only, plus one behaviour change: a worktree you create starts its setup and default terminals even if the distro was stopped. Creating that worktree already runs git there in the common case.
  • Automation-created worktrees behave exactly as before.

What Changed

  • Shared (wsl-distro-stopped-hold.ts):
    • wslDistroHoldUserMessage(hold) gives the sentence, with stopped and unverifiable variants.
    • wslDistroHoldRpcFailure(message) gives the RPC message and data.
  • RPC errors (rpc/errors.ts): mapRuntimeError maps a hold to the same code, runtime_error, with the readable message plus data: { wslDistroHold: { distro, state } }.
  • Headless automation (headless-dispatch-runner.ts): a launch that rejects with a hold becomes a skipped_unavailable run with fix(automations): a scheduled run never starts a stopped WSL distro #35857's wslDistroStopped code. Any other launch error still fails with its own message. This was the launchAgentTerminal dedup path.
  • Worktree origin split (E9):
    • Marked as the user's act:
      • buildManagedWorktreeCreateArgs (RPC worktree.create and agent.launch's create) sets wslUserAct unless the create carries automationProvenance.
      • The window's own create (spawnLocalStartupAndSetupTerminals in ipc/worktree-remote.ts) marks its startup and setup terminals.
    • Left background: automation creates through the window are host-provisioned without the flag, and the headless and orchestration creates don't set it.
    • How the flag reaches the terminals: RuntimeManagedWorktreeCreateArgs.wslUserAct flows through createInResolvedProject's createTerminal and provision ports (and the folder-workspace create). provisionWorktreeTerminals carries it in the shared surfacing options, so every setup and default terminal gets it.

Why

  • Wording at the edge: the RPC boundary and the automation run record are where people read these errors. Keeping runtime_error means no client breaks, and the structured hold in data lets newer clients act on it.
  • No hold for creates someone asked for: holding them would need new UI in shipped builds, and a Start that replays the setup command. The creator explicitly asked, and a scheduled automation's create still never starts a distro.

Linked Issue

N/A (maintainer change; follow-up to #35813, #35857 and #35865)

Visual Proof

N/A: wording only, no new UI.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated:
    • errors.test.ts:
      • a held terminal (stopped and unverifiable) keeps runtime_error, with the sentence and data;
      • SSH and other errors map as before.
    • headless-dispatch-durability.test.ts: a held launch records the wslDistroStopped skip, and another error still fails with its message.
    • worktree-create-args.test.ts: a person's create sets wslUserAct, and an automation's doesn't.
    • runtime-worktree-terminal-provisioning.test.ts: every default terminal of a person's create carries wslUserAct, and an automation's carry none.
    • worktrees-local-create-flow.test.ts and worktree.test.ts: exact expectations now include wslUserAct. One redundant exact setup assertion became objectContaining to stay within max-lines; the setup command stays pinned in the neighbouring test.
  • Ran pnpm tc, pnpm run typecheck:ci, oxlint, the anti-slop lint, check:code-quality:changed, the ast-grep test and gates, the worktree IPC, workspace, RPC and automation suites, and the full src/main/runtime suite.
    • One test, structured-agent-shell-environment, failed 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

  • Mixed versions: the code is unchanged and data is an optional addition. Older clients show the new message, which is clearer than the raw code.

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)

…te starts its own terminals

RPC errors for a terminal held on a stopped or unchecked WSL distro keep runtime_error but carry a readable message and the hold in data. A headless launch the runtime held records the coded wslDistroStopped skip. A worktree create someone asked for (UI, CLI, agent, paired client) starts its setup and default terminals as their act; an automation's create stays background.
@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge; no actionable issues were found.

Summary

This PR makes held-terminal RPC errors readable and records held automation launches as friendly skips. It also marks terminals from person-driven worktree creates as user actions.

  • RPC errors for held WSL terminals explain why the terminal did not start.
  • Headless automation records a held WSL launch as an unavailable skip.
  • Person-requested worktree creates pass their intent to the terminals they start.

No actionable issues were found. No tests were run during this review.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Worktree create] --> B{Automation provenance?}
  B -->|No| C[Set wslUserAct]
  B -->|Yes| D[Keep background behavior]
  C --> E[Startup, setup and default terminals]
  D --> E
  E --> F{Terminal held?}
  F -->|RPC error| G[Readable message and hold data]
  F -->|Headless automation| H[Record skipped_unavailable]
Loading

Reviews (1) · Last reviewed commit: "fix(wsl): held terminals read as a sente..." · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

Worktree creation now passes wslUserAct: true to terminals for user-driven creates and omits it for automation-created terminals. Runtime RPC errors for recognized WSL distro holds include a state-specific message and hold data. Headless dispatch records stopped-distro holds as skipped_unavailable; other dispatch errors remain dispatch_failed.

Priority: Normal

Merge Risk: Low · up to dafe4

Run history can incorrectly say a WSL distro is stopped when its state could not be checked. The change is otherwise mergeable with that limitation understood.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 36.36% 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 leads with the fix type and scope (fix(wsl)) and names two changes: readable wording for held terminals and worktree terminals starting for a person's create. Both match the changeset and ob…
Description check Passed The description follows the template closely. It has an ELI5 section, What Changed, Why, Visual Proof (N/A with reason), Testing with test coverage and commands run, AI Disclosure and Review sections,…
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 leads with the fix type and scope (fix(wsl)) and names two changes: readable wording for held terminals and worktree terminals starting for a person's create. Both match the changeset and objectives. It is long (96 characters, 15 words) and joins two unrelated changes with a semicolon, but it is not vague or off-topic.

Full details: Description check

Explanation

The description follows the template closely. It has an ELI5 section, What Changed, Why, Visual Proof (N/A with reason), Testing with test coverage and commands run, AI Disclosure and Review sections, Notes, and a Checklist. The Linked Issue section is N/A with a maintainer reason, and the template says outside contributors must link an issue. The author is a maintainer, so this is acceptable. The Visual Proof section gives a reason for N/A. The Agent skill upstream boundary item is checked. The final checklist item for pnpm lint/typecheck/test/build is unchecked, which the template allows because CI covers it. The AI Disclosure section is empty, which is acceptable for internal contributors.

Full details: Docstring Coverage

Explanation

Docstring coverage is 36.36% 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 11 functions across 15 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.

Actionable comments posted: 1


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: 78f8f65f-2570-4b64-912e-b05e6e3317c6
Commits

Reviewing files that changed from the base of the PR and between 010d0d5 and dafe414.

Files selected for processing: 15
  • src/main/automations/headless-dispatch-durability.test.ts
  • src/main/automations/headless-dispatch-runner.ts
  • src/main/ipc/worktree-remote.ts
  • src/main/ipc/worktrees-local-create-flow.test.ts
  • src/main/runtime/rpc/errors.test.ts
  • src/main/runtime/rpc/errors.ts
  • src/main/runtime/rpc/methods/worktree-create-args.test.ts
  • src/main/runtime/rpc/methods/worktree-create-args.ts
  • src/main/runtime/rpc/methods/worktree.test.ts
  • src/main/runtime/runtime-managed-worktree-create-types.ts
  • src/main/runtime/runtime-worktree-terminal-provisioning.test.ts
  • src/main/runtime/runtime-worktree-terminal-provisioning.ts
  • src/main/runtime/workspaces/workspace-activation.ts
  • src/main/runtime/workspaces/workspace-creation.ts
  • src/shared/wsl-distro-stopped-hold.ts

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

Comment on lines +47 to +48
const hold = parseWslDistroHold(describeDispatchError(error))
return hold ? automationRunFailure('wslDistroStopped', { distro: hold.distro }) : null

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.

Minor · Functional Correctness · Quick win

Do not describe an unverifiable distro as stopped.

When parseWslDistroHold returns unverifiable, this branch still creates a wslDistroStopped failure. Its run-history message says the distro is stopped, although Orca could not check its state. Keep the required skip and code, but use neutral failure copy for both states or render the message from hold.state. (raw.githubusercontent.com)

@nwparker
nwparker merged commit 0ff3fb6 into main Oct 29, 2026
61 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