Skip to content

feat: robust fork support for SSH and Docker workspaces #1687

@ammar-agent

Description

@ammar-agent

Problem

User-facing /fork command is blocked for SSH and Docker workspaces (#1686) because the implementation creates broken workspaces. Sub-agent task spawning works via TaskService.create() because it handles initialization differently.

Root cause

SSHRuntime.forkWorkspace() and DockerRuntime.forkWorkspace() were designed for sub-agent spawning, not user-facing fork. They clone the git repo but skip critical initialization:

  • SSH: No initWorkspace() call, missing init scripts, project secrets not injected
  • Docker: Container created but not properly initialized, volume mounts may be wrong

What users see

  1. Fork appears to succeed
  2. Workspace shows wrong runtime badge (Worktree instead of SSH)
  3. Commands fail or workspace is unusable

Regression PR

#1446 implemented SSHRuntime.forkWorkspace() for sub-agent spawning, which unintentionally exposed it to user-facing fork.

Testing gap

No tests/ui/ coverage for fork. Existing tests in tests/ipc/forkWorkspace.test.ts only cover worktree runtime. Need UI integration tests that:

  • Verify error handling when forking SSH/Docker workspaces
  • Verify forked workspace shows correct runtime badge
  • Verify forked workspace is immediately usable

Acceptance criteria

  • Fork works correctly for SSH/Docker workspaces, OR error is clearly shown in UI
  • Forked workspace shows correct runtime badge
  • tests/ui/fork.integration.test.ts covers fork scenarios

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or functionalityneeds-alignmentPR or Issue needs contributor alignment on design before implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions