github / github/copilot-cli

Make session worktrees configurable, self-cleaning, and consistently named

未關閉
#3,675 1 則留言 5 個 reaction 已指派 0 人 在 GitHub 檢視
area:configuration area:sessions area:tools
主要語言
Shell
星號
11.2k
分支
1.9k
平均合併
14 小時 16 分鐘
30 天內合併 PR
6

描述

## Problem

Sessions create worktrees under a magic path (`D:\GIT\copilot-worktrees\\`) with three loosely related names:

- a session display name
- a branch name (e.g. `mhaackone10/congenial-fishstick`)
- the worktree folder slug (e.g. `mhaackone10-congenial-fishstick`)

After a branch is merged, the worktree directory and branch are left dangling. The agent tells the user "this worktree is safe to delete whenever convenient," which puts the cleanup burden on the user. Over a few weeks of normal use this produces a graveyard of orphaned worktrees and branches that the app created but won't remove.

It is also frequently confusing: the agent has to constantly explain "this is a worktree, not your main checkout" and walk the user through `git merge --ff-only` from a separate path to actually see the changes in their normal working directory. The mechanism is invisible to the user but leaks into every merge/cleanup interaction.

## Asks

1. **Make the mechanism visible and configurable.** Let the user choose between:
- worktree-per-session (current default)
- in-place editing on a branch in the main checkout
- some other strategy
And let them set the worktree root path, the branch naming scheme, and whether the session name, branch name, and folder name should be derived from one source.

2. **Manage the lifecycle.** When a session's branch is merged (fast-forward or otherwise), the app should offer or perform cleanup of the worktree directory and the local branch. "Safe to delete, do it yourself" is not adequate. Provide an explicit "archive session" / "discard worktree" action and a periodic prompt for stale ones.

3. **Use one consistent name.** The session display name, branch name, and worktree folder name should be derivable from a single user-chosen identifier (or at minimum, displayed together so it's obvious they refer to the same thing). The current `congenial-fishstick`-style autogenerated slug is noise; the fact that `rename_session` and `rename_branch` tools exist as separate operations is itself a sign that the defaults need work.

## Why it matters

The current design optimizes for isolation between sessions (good) but pushes all the housekeeping onto the user (not good). For users running many short sessions, the cumulative cost of "remember to clean up that worktree at `D:\GIT\copilot-worktrees\...`" is real, and the cognitive cost of three names for the same thing is paid on every interaction.

貢獻指南

開啟貢獻指南

研究方向

The issue names session worktrees, the worktree root path, and the separate rename_session and rename_branch tools, but no implementation files or tests. Start by tracing the session and worktree lifecycle and how branches are created and merged. Done would require an agreed configuration model, consistent naming, and explicit or automatic cleanup behavior for merged, archived, discarded, and stale sessions.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
git, shell
領域
cli, developer-experience, tooling
Issue 類型
功能
難度
5/5
預估耗時
一週以上
活躍度
冷清
描述清晰度
需要釐清
新手友好度
25/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。