Skip to content

fix(workspaces): add main-owned project move pause barrier - #32940

Merged
nwparker merged 2 commits into
mainfrom
nwparker/ci-wsl-sleep-integration-oct23
Oct 24, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/ci-wsl-sleep-integration-oct23

Conversation

@nwparker

@nwparker nwparker commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​438 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​437
Prod 10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​418 $\color{#cf222e}{\Huge{\mathbf{−}}}$​17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​401

ELI5

Updating the WSL mover stack onto current main removed the old sleep relay. A direct replacement would close browser tabs and let export read terminal state before the window finished saving it. This adds the main-owned pause boundary needed to refresh that stack safely.

What Changed

  • Add pauseWorkspacesForProjectMove(window, runtime, workspaceIds). The window resolves existing terminal/twin/chat owners, then main runs the existing sleep lifecycle queues and host stop proofs.
  • Require an explicit versioned handshake with the current preload/follower before stopping hosts. A correlated move pause preserves browser tabs and awaits renderer teardown, host-partition session writes, and durable flush before returning.
  • Fail closed on unsupported clients, renderer reload/loss, incomplete or superseded sleeps, teardown failure, and persistence failure. ProjectMovePauseError.outcomes preserves known partial-stop results and chat receipts on rejected barriers.
  • Keep ordinary Sleep behavior. Ordinary renderer sleep IPC strips the mover-only correlation field.

Why

This is the compatibility prerequisite for #31417/#32401 and their descendants in the stack ending at #32789. It reuses current main's lifecycle ownership rather than restoring the deleted renderer-owned sleep path.

The WSL owner agreed to adopt this API, remove the old relay plumbing, and review this PR before merge. No WSL stack branches are rewritten here, and the larger restore redesign remains a separate decision.

Linked Issue

Refs #31417, #32401, #32789.

Visual Proof

N/A — adds a lifecycle integration API and renderer persistence handshake; no new rendered UI. The WSL caller is not wired in this PR. Its packaged move/restart/undo verification follows stack adoption.

Testing

  • Automated tests added/updated: 188 tests pass across 11 focused suites covering the new broker/follower, existing sleep queues, ordinary Sleep, twin isolation, IPC bridges, and host-partition persistence/contention.
  • Native TypeScript checks pass for Node, web, and CLI projects.
  • Changed-code quality, low-evidence-pattern lint, precommit lint/format, workspace-record-read and runtime-electron ratchets pass.
  • Independent read-only review; fixed its receipt-loss finding and verified the correction with a follow-up review.
  • Packaged Windows/WSL move, restart, failed move, and undo verification after owner wiring. The existing awin verify-6 build is preserved.

Local checks ran on macOS with ORCA_BACKGROUND_LAUNCH=1. Hosted PR checks cover platform validation; no claim of local Windows/WSL execution.

Review

The caller must retain its move gate/fence across pause and export, inspect every outcome's failure, chatFailed, and vmSuspendFailure, and journal existing receipts. On rejection, journal ProjectMovePauseError.outcomes too. An empty error outcomes array is not evidence that no stop occurred. This API does not replace mover admission, restore hints, post-stop proofs, or transfer/undo logic.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer content copied or translated.

Notes

The handshake is desktop-only; web/headless clients fail closed. Remote terminal and chat targeting uses existing owner resolution and compatibility paths. General mobile/CLI Sleep remains unchanged. No OS-specific process or path behavior is introduced.

Checklist

  • Focused on the missing main-side pause integration
  • Explained trigger, behavior, mechanism, and ownership
  • Visual proof marked N/A with scope limitation
  • Self-reviewed correctness, security, persistence, and cleanup
  • Cross-platform, remote/twin, mobile, and mixed-version behavior considered
  • Focused tests and typechecks pass; full platform/package validation belongs to CI and subsequent WSL wiring

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent 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: 6af27902-5215-4c79-8012-30ffe1f4bc80
📥 Commits

Reviewing files that changed from the base of the PR and between a5d547c and e614a16.

📒 Files selected for processing: 1
  • src/main/window/project-move-pause.test.ts
🚧 Files skipped from review as they are similar to previous changes: 1
  • src/main/window/project-move-pause.test.ts

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

📝 Walkthrough

The change adds a versioned IPC protocol for pausing workspaces before a project move. The main process prepares renderer targets, sleeps the workspaces, and requests persistence of successful results. The renderer tracks sleep notices, terminal teardown, and persistence, then reports success or failure. Workspace sleep notices carry an optional pause ID. Tests cover protocol validation, scope handling, timeouts, teardown, and persistence outcomes.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to e614a

The reply-fixture typing change addresses the identified lint failure without changing the tested pause behavior. No actionable merge-blocking risk remains in this review.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 13 files. 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 "fix(workspaces): add main-owned project move pause barrier" names the primary change: a main-process pause barrier that stops workspaces before a project move. The changeset adds pauseWorks…
Description check Passed The description follows the template and fills most sections with specific content. It has an ELI5, What Changed, Why, Linked Issue (refs only, not a 'Fixes #' link), Visual Proof marked N/A with a re…
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 "fix(workspaces): add main-owned project move pause barrier" names the primary change: a main-process pause barrier that stops workspaces before a project move. The changeset adds pauseWorkspacesForProjectMove, a versioned renderer handshake, and ProjectMovePauseError, which match the title. The title uses a conventional-commit prefix, and "fix" is a loose fit for what is mostly a new API, but the title still describes the main change accurately.

Full details: Description check

Explanation

The description follows the template and fills most sections with specific content. It has an ELI5, What Changed, Why, Linked Issue (refs only, not a 'Fixes #' link), Visual Proof marked N/A with a reason, Testing with checkboxes and results, Review, Agent skill boundary, Notes, and Checklist. Gaps: the Linked Issue section uses 'Refs' rather than an actual closing link, which the template says outside contributors must provide. The AI Disclosure section is empty. The 'Ensure no issues in' Notes section is partly addressed. The description is long and dense, which conflicts with the template's 'keep scope tight' guidance, but the required information is present.

Resolution

Optional improvements: fill in the AI Disclosure section (or confirm it does not apply to the author), and confirm whether the linked issues should be closed by this PR, since the template expects an actual issue link and 'Refs' alone may not meet the outside-contributor rule.

✨ 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: b286569c-4158-41a3-893e-cd3fc31f928e
📥 Commits

Reviewing files that changed from the base of the PR and between 1855520 and a5d547c.

📒 Files selected for processing: 13
  • src/main/ipc/worktrees/sleep/register-worktree-sleep-handlers.ts
  • src/main/runtime/workspaces/workspace-sleep-execution.test.ts
  • src/main/runtime/workspaces/workspace-sleep-execution.ts
  • src/main/window/project-move-pause.test.ts
  • src/main/window/project-move-pause.ts
  • src/preload/api/ui-bridge-clipboard-and-window-controls.ts
  • src/preload/api/ui-command-event-api.ts
  • src/renderer/src/components/sidebar/project-move-pause-follower.test.ts
  • src/renderer/src/components/sidebar/project-move-pause-follower.ts
  • src/renderer/src/components/sidebar/workspace-sleep-follower.ts
  • src/renderer/src/hooks/ipc-events/mobile-terminal-close-ipc-bridge.ts
  • src/shared/project-move-pause.ts
  • src/shared/workspace-sleep.ts

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

@nwparker
nwparker merged commit cd59239 into main Oct 24, 2026
47 checks passed
@nwparker
nwparker deleted the nwparker/ci-wsl-sleep-integration-oct23 branch October 24, 2026 00:26
nwparker added a commit that referenced this pull request Oct 24, 2026
Main's project move pause barrier (#32940) replaces the deleted renderer sleep relay: the move's
quiesce now pauses through pauseWorkspacesForProjectMove, which keeps browser tabs and waits for
the window's session to persist. Conflicts resolved as unions; the restore cwd keeps the WSL folder
check on Windows and main's folder probe elsewhere. (register-core-handlers max-lines is inherited
and fixed in the next commit of the stack.)

Co-Authored-By: Claude <[email protected]>
sj900211 added a commit to sj900211/orcinus that referenced this pull request Oct 30, 2026
One day of upstream past stage 13: 365 commits and 24 conflicting files, base
`120f01331ca`. Three cluster analysts, one implementer, one independent critic,
which returned ACCEPT with 0 blocking defects.

The target is the parent of the PTY delivery refactor `ad1b81d53a0` (stablyai#33358,
"group PTY delivery and drain ownership"), which is left to stage 15 on its own.
The remaining gap after this merge is about 1,685 commits.

## Most PTY conflicts were comments

Bisection showed the first upstream commit to make any PTY file conflict is
`3286f3b2591` (stablyai#32966, a comment audit); before it there were 5 conflicts and no
PTY ones. 16 of the 24 conflicts are that audit colliding with the fork's
per-window delivery code. Each was resolved as the fork's code with upstream's
comment text, adapted where it now misdescribes per-window behaviour, and the
critic confirmed by token comparison that the resolved code is identical to
`main` in all 16 (two more resolved files also qualify).

## Collateral outside the conflict list

- `terminal-query-responder.test.ts`: upstream stablyai#33273 wrote a one-argument
  `markHiddenRendererPty` call against the single-window gate; the fork keys
  marks by `webContentsId`, so the test now marks `GATE_WINDOW`.
- `pty-spawn-env-terminal-basics.test.ts`: a cast upstream removed is restored
  with a `SAFETY:` reason, because the fork's `registerPtyHandlers` takes a
  `BrowserWindow` for owner routing.
- `local-file-access.test.ts`: the fork's census still named
  `WorkspaceEmptyState.tsx`, which upstream deleted when reverting stablyai#32182
  (stablyai#32838). Its renderer-relative path hid it from the repo-rooted path sweep;
  the regression sweep found it.

## Identity

`LOCAL_HOST_ROOT_NAME = 'Orcinus'` and the `sj900211/orcinus` release feed
(`TAG_HREF_RE`) survive; the identity guard passes with `upstreamRefs=0`. The
guard cannot see regex-escaped URLs, so the feed's unit test is what protects
that hunk. Pre-existing `stablyai` drift in the prerelease feed's download regex
and its readiness-test mocks is left for a separate commit so this merge stays
attributable.

## Gates

Cold typecheck 0 errors (17,824 files), full-tree oxlint 0 errors and 0
`max-lines` (`register-handlers.ts` and `daemon-host-relocation.ts` at 297/300),
identity guard OK, fork contracts green. A full `discoverUnitFiles()` sweep on
three trees (13,498 / 13,523 / 13,585 files, missing=0) raised 81 merge-only
tests; isolated and serial rechecks attribute every one to Windows EPERM
teardown or shell timing that also fails on the baselines, leaving 0. The
critic's independent 807-file resample on LF trees agrees.

Not applied here, by ruling: cosmetic comment ports into fork-only extractions,
and upstream stablyai#32940's main-window-only project-move pause barrier, which has no
production caller yet and is a watch item for when upstream wires one.

Co-Authored-By: Claude Opus 5.5 <[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