Skip to content

fix(workspaces): start task agents on remote hosts - #13412

Merged
Jinwoo-H merged 1 commit into
mainfrom
create-remote-workspace
Aug 10, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
create-remote-workspace

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Remote workspaces created from Tasks now start and prefill the requested Codex agent on the owning host instead of opening idle fallback shells.

  • Forward the existing worktree.create.startupDraft only to paired runtimes.
  • Carry the host startup-terminal receipt through activation.
  • Suppress renderer fallback and wake terminal creation while the authoritative host tab is being mirrored.
  • Keep local, direct-SSH, and non-agent creation paths unchanged.

Screenshots

No visual change.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that would catch regressions

Focused validation:

  • 408 tests passed across six renderer and runtime RPC files.
  • Pre-commit oxlint, React Doctor oxlint, and formatting passed.
  • git diff --check passed.
  • Physical paired Windows host E2E passed.

Deterministic Windows reproduction:

Build Authoritative host PTYs Result
Baseline 3 Two blank Git Bash shells plus Setup; Codex never starts; one shell can expose the ConPTY DA1 response.
This PR 2 Codex starts with the issue URL as an unsent draft, Setup completes, and no stray shell or DA1 text appears.

AI Review Report

The review traced terminal ownership from Tasks quick-create through worktree.create, activation, host mirroring, and wake recovery. It identified the missing startupDraft handoff and the race between a successful host spawn and renderer fallback creation.

The implementation was checked for macOS, Linux, and Windows compatibility. It adds no shortcut, label, path, shell, or Electron platform-specific behavior. It also preserves folder-workspace assumptions, direct SSH behavior, and local worktree startup.

Mixed client/host behavior was reviewed against the remote wire policy. The fix reuses an optional field and an existing optional response receipt; it introduces no opcode or required RPC field.

Security Audit

The forwarded value is the existing task draft already accepted by worktree.create and is used as agent input, not interpolated into a shell command. No new authentication, secret, dependency, filesystem path, command-execution, or IPC surface is introduced. Runtime ownership checks still determine which host receives the draft.

Notes

Compatibility matrix:

Client Host before v1.4.19 Host v1.4.19-v1.4.41 Host v1.4.42+
Client without this PR Original bug remains Original bug remains Original bug remains
Client with this PR Unknown optional draft is safely stripped; old behavior remains Codex starts, but an extra-shell race can still occur because the host has no spawn receipt Fully fixed: Codex starts and renderer fallbacks are suppressed

The reported windows 2 host is v1.4.177 and is in the fully supported cell.

Tradeoff: once a compatible host reports that it spawned the startup terminal, the renderer waits for that terminal to mirror instead of creating a competing fallback. If host tab mirroring itself fails, the user may wait for recovery rather than immediately receiving an unrelated shell.

@coderabbitai

coderabbitai Bot commented Aug 10, 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 Plus

Run ID: 5fb312b1-9c1c-4ce6-9b57-44c9bc6f9a05

📥 Commits

Reviewing files that changed from the base of the PR and between b2e29a2 and 4cf9a7f.

📒 Files selected for processing (9)
  • src/renderer/src/hooks/useComposerState-host-context-boundaries.test.ts
  • src/renderer/src/hooks/useComposerState.ts
  • src/renderer/src/lib/worktree-activation.test.ts
  • src/renderer/src/lib/worktree-activation.ts
  • src/renderer/src/lib/worktree-creation-flow.test.ts
  • src/renderer/src/lib/worktree-creation-flow.ts
  • src/renderer/src/store/slices/worktree-helpers.ts
  • src/renderer/src/store/slices/worktrees.test.ts
  • src/renderer/src/store/slices/worktrees.ts

📝 Walkthrough

Walkthrough

The change forwards agent startup drafts through worktree creation for local and remote runtimes. Worktree creation results now report whether the backend spawned the startup terminal. Activation passes this state to terminal setup, treats backend-created terminals as authoritative, avoids duplicate fallback terminals, skips redundant web-runtime recovery, and preserves deferred issue-command delivery. Tests cover draft forwarding, activation metadata, remote requests, and mirrored terminal handling.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: starting task agents on remote hosts.
Description check ✅ Passed The description includes all required sections and provides clear summaries, testing evidence, review coverage, security analysis, and compatibility notes.
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 💡 1
📝 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 a3ca887 into main Aug 10, 2026
45 checks passed
@Jinwoo-H
Jinwoo-H deleted the create-remote-workspace branch August 10, 2026 02:09
zpyoung pushed a commit to zpyoung/orca that referenced this pull request Aug 11, 2026
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