group worktree sessions under their repository, not their worktree #99

Closed
opened 2026-08-24 17:13:22 +01:00 by naps62-yolo · 0 comments
Collaborator

A session spawned into a worktree is nested in the sidebar under the worktree path, so ~/tea/agent-skills grows a ~/tea/agent-skills/worktrees/largo-clarinet section containing a single session also called largo-clarinet. The folder and the session say the same thing, and the repository the work belongs to is no longer where you would look for it.

The session should appear directly under the repository — ~/tea/agent-skills, holding a session largo-clarinet.

Two parts:

  1. Daemon. SessionManager::create stores worktree_base_repo as whatever the request passed (Some(base_repo.clone())). Spawning from inside a linked worktree therefore records that worktree as the base repo. Record the resolved main checkout instead — worktree.rs already has main_checkout() for exactly this, and it is what the placement logic uses. Then every client gets a repository path without having to resolve one.

  2. Clients. The tree keys off sessionCwd() in web/src/types.ts (current_cwd else cwd), which for a worktree session is the worktree. Group under the session worktree base repo when there is one, falling back to the cwd. Mirror it in the TUI sidebar so the two agree.

The session row still shows its own name; only the grouping changes. A session with no worktree is unaffected.

A session spawned into a worktree is nested in the sidebar under the worktree path, so `~/tea/agent-skills` grows a `~/tea/agent-skills/worktrees/largo-clarinet` section containing a single session also called `largo-clarinet`. The folder and the session say the same thing, and the repository the work belongs to is no longer where you would look for it. The session should appear directly under the repository — `~/tea/agent-skills`, holding a session `largo-clarinet`. Two parts: 1. **Daemon.** `SessionManager::create` stores `worktree_base_repo` as whatever the request passed (`Some(base_repo.clone())`). Spawning from inside a linked worktree therefore records that worktree as the base repo. Record the resolved main checkout instead — `worktree.rs` already has `main_checkout()` for exactly this, and it is what the placement logic uses. Then every client gets a repository path without having to resolve one. 2. **Clients.** The tree keys off `sessionCwd()` in `web/src/types.ts` (`current_cwd` else `cwd`), which for a worktree session is the worktree. Group under the session worktree base repo when there is one, falling back to the cwd. Mirror it in the TUI sidebar so the two agree. The session row still shows its own name; only the grouping changes. A session with no worktree is unaffected.
naps62-yolo added this to the Spawn v2 milestone 2026-08-24 17:13:22 +01:00
This repo is archived. You cannot comment on issues.
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: naps62/maestro#99