Skip to content

Fix task workspace handoff after switching workspaces - #8226

Merged
Jinwoo-H merged 1 commit into
mainfrom
Jinwoo-H/workspace-ready-indicator
Jul 11, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
Jinwoo-H/workspace-ready-indicator

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When a workspace created from Tasks finishes after the user switches to another workspace, complete the handoff and open the new workspace instead of dropping its pending row and leaving it inactive.

Leaving the creation flow for Tasks, Settings, or another app view still keeps creation in the background without stealing focus. Cancelled creations also remain cancelled when post-create trust preflight finishes late.

Screenshots

No visual change. This changes the completion/navigation behavior of the existing pending workspace row.

Testing

  • pnpm lint (full repository lint not run)
  • pnpm run typecheck:web
  • pnpm test (full repository suite not run)
  • pnpm build (not run)
  • Added regression coverage for switching workspaces during creation and cancelling during post-create trust preflight
  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/lib/worktree-creation-flow.test.ts src/renderer/src/store/slices/worktrees.test.ts — 211 passed
  • Focused oxlint and oxfmt checks passed
  • pnpm check:max-lines-ratchet and git diff --check passed
  • Electron validation: started a GitHub issue workspace, switched to an existing workspace while creation was pending, and confirmed the completed workspace became active with its terminal mounted

AI Review Report

Ran two adversarial review/fix rounds with review-until-clean against the branch diff.

Round 1 found a cancellation race: if the pending row was cancelled while agent-trust preflight was still awaiting, the new completion predicate could misclassify the cleared pending pointer as a workspace switch. Added an entry-existence guard and a regression test. Round 2 found no remaining in-scope issues.

The review checked success, failure, cancellation, retry/concurrency state, terminal startup handoff, Tasks/settings focus preservation, local/SSH/runtime ownership, and test depth. It explicitly checked macOS, Linux, and Windows compatibility; this renderer-only state change touches no shortcuts, labels, paths, shell commands, Git commands, or platform-specific Electron APIs.

Performance risk is negligible: completion adds one Zustand state read/map lookup and predicate evaluation once per workspace creation, with no polling, listeners, timers, IPC/RPC, storage, or render fanout.

Security Audit

No new external inputs, command execution, path handling, authentication, secrets, dependencies, or IPC surfaces are introduced. Existing agent-trust and workspace-create boundaries are unchanged. The cancellation guard prevents a late async trust result from reviving a user-cancelled workspace.

Notes

The fix is renderer-state based and applies equally to local, SSH, and runtime-backed workspace creation. Temporary workspaces created for manual reproduction and validation were removed.

Made with Orca 🐋

Co-authored-by: Orca <help@stably.ai>
@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: af1fca21-06ba-47ca-8b97-b9d2833f895b

📥 Commits

Reviewing files that changed from the base of the PR and between e3f0b99 and 9872dbe.

📒 Files selected for processing (2)
  • src/renderer/src/lib/worktree-creation-flow.test.ts
  • src/renderer/src/lib/worktree-creation-flow.ts

📝 Walkthrough

Walkthrough

Worktree creation completion now activates and reveals a worktree when its pending entry remains and either the creation surface is visible or the terminal view is active without a pending creation selection. Terminal focus queuing uses the same completion condition. Tests cover workspace switching during background creation and cancellation during trust preflight.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: fixing workspace handoff when switching workspaces during task creation.
Description check ✅ Passed The description includes all required sections and is detailed enough, with summary, screenshots, testing, AI review, security audit, and notes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@Jinwoo-H
Jinwoo-H merged commit 5b1fcb0 into main Jul 11, 2026
3 checks passed
@Jinwoo-H
Jinwoo-H deleted the Jinwoo-H/workspace-ready-indicator branch July 11, 2026 05:56
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
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