Skip to content

feat(sessions): fork + fork-into-worktree (F1/W1/FW)#26

Merged
iret77 merged 3 commits into
mainfrom
feat/session-fork-worktree
Jul 3, 2026
Merged

feat(sessions): fork + fork-into-worktree (F1/W1/FW)#26
iret77 merged 3 commits into
mainfrom
feat/session-fork-worktree

Conversation

@iret77

@iret77 iret77 commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Implements F1, W1 and FW of the fork/worktree design (docs/superpowers/specs/2026-07-03-agent-session-fork-and-worktree-launch-design.md):

  • Fork capability, verified against both CLIs (2026-07-03): claude --resume <id> --fork-session, codex fork <id>. CLIAgent::fork_command returns None for everything else — no surface, no fake fork. fork_command_pinned prepends CLAUDE_CONFIG_DIR/CODEX_HOME as inline env for non-default accounts (one string that also works in worktree configs and, later, daemon startup_commands).
  • WorkspaceAction::ForkAgentSession: plain fork opens a tab in the source session's cwd and queues the fork command (the SSH-launch pattern); fork-into-worktree builds a one-shot worktree tab config (autogenerated branch from HEAD, fork command appended after the cd) and opens it without persisting it to the tab-config dir. git worktree add failures stay visible as the session's first output.
  • Cockpit dashboard session rows get ⑂ fork / ⑂ +worktree hover actions; the worktree variant only renders when the cwd is inside a git repo (precomputed on cockpit updates, render never touches the filesystem).
  • Drive-by fix: the four EventLoop::start test callers were missing the install_progress_rx/host_label params from PR feat(remote-session): Stage 2 client-attach (part 1: client protocol) [draft] #16, so the whole -p warp test binary failed to build (cargo check doesn't compile cfg(test) code, which is why the gate missed it). Repaired in its own commit.

Open (design status header updated): W2 remote worktree via daemon startup_command (natural anchor: C4 launcher), block-header surface, Codex surface (waits on Codex session discovery — the fork mechanics are ready).

Verified: cargo check -p warp 0 errors/0 warnings; targeted suites green (fork_command 3, build_worktree_toml 3, daemon_tty 7). Runtime acceptance lands with the next user test build — none triggered per instruction.

🤖 Generated with Claude Code

iret77 and others added 3 commits July 3, 2026 18:20
The install_progress_rx/host_label params added on the stage2 branch
never reached the four cfg(test) call sites, so the whole -p warp test
binary failed to build. cargo check does not compile cfg(test) code,
which is why the PR gate missed it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…(F1/W1/FW)

From any live session in the cockpit dashboard, two row actions branch a
copy of the conversation into a new block; the original session stays
untouched (fork/worktree design §2-3):

- CLIAgent::fork_command, verified against both CLIs on 2026-07-03:
  `claude --resume <id> --fork-session`, `codex fork <id>`; other agents
  return None and get no surface (no fake fork). fork_command_pinned
  prepends CLAUDE_CONFIG_DIR/CODEX_HOME as inline env for non-default
  accounts — one string that works in local tabs, worktree configs, and
  (later, W2) daemon startup_commands, with the pinning visible.
- WorkspaceAction::ForkAgentSession → workspace fork_agent_session:
  plain fork opens a tab in the source cwd and queues the fork command
  (the SSH-launch pattern); fork-into-worktree builds a one-shot
  worktree tab config (autogenerated branch from HEAD, fork command
  appended after the cd) and opens it without persisting — a fork is a
  moment, not a template. git errors stay visible as the session's
  first output.
- build_worktree_config_toml gains an optional followup_command,
  appended after the cd in both naming modes.
- Cockpit dashboard session rows: "⑂ fork" / "⑂ +worktree" hover
  actions; the worktree variant only appears when the session's cwd is
  inside a git repo (precomputed on cockpit updates — render never
  touches the filesystem); stable per-session MouseStateHandles.

Verified: cargo check -p warp 0 errors/0 warnings; targeted suites
green (fork_command 3, build_worktree_toml 3, daemon_tty 7). Runtime
acceptance needs the next user test build.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ktree

# Conflicts:
#	app/i18n/en/warp.ftl
#	app/src/cockpit/pane.rs
@iret77 iret77 merged commit 3984e46 into main Jul 3, 2026
2 checks passed
@iret77 iret77 deleted the feat/session-fork-worktree branch July 3, 2026 20:34
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