[Bugs] Title: Restoring an archived worktree session leaves it anchored to a stale, ...
- Ngôn ngữ chính
- Không có dữ liệu ngôn ngữ
- Star
- 2.1k
- Fork
- 153
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
**Mood:** 😔
**Category:** Bugs
Title: Restoring an archived worktree session leaves it anchored to a stale, empty folder (breaks file tools + custom-agent discovery)
Affected version: 1.0.66-1 (desktop app, Windows)
## Describe the bug
After restoring a worktree-backed session from archive, the session's working directory still points at the *original* generated worktree folder, but the actual git worktree has been re-created under a different (branch-named) folder. The original folder is left as an empty, non-git stub, so the session is anchored to a dead directory.
## Steps to reproduce
1. Create a worktree-backed session (generates a folder, e.g. `/`).
2. Rename the branch early in the session (folder and branch names now diverge).
3. Archive the session, then later restore it from archive.
4. `git worktree list` shows the worktree at `/`, but the session's working directory is still `/` — now empty (no `.git`, no repo content, no `.github/agents/`).
## Impact
- File/edit/glob tools default to the dead path and fail until absolute paths to the real worktree are used.
- Custom agents are discovered from `/.github/agents/`; because cwd is the empty stub, all custom agents vanish from in-session tooling (only built-in agents remain) — even though the app UI still lists them.
- Shell commands default to the wrong directory.
## Expected behavior
On restore, the session's working directory should be updated to the worktree's current path (or the worktree restored at the path the session references), so file tools and `.github/agents/` discovery keep working.
## Workaround
Restart/reopen the session to re-anchor cwd; until then, pass absolute paths to the real worktree.
## Possibly related
- #3931 (worktree/cwd divergence affecting resume)
- #3528 (agent starts in wrong cwd)
---
| Field | Value |
| --- | --- |
| App version | 1.0.12 |
| OS | Windows 10.0.26200 |
| Theme | GitHub |
| Path | /chat |
| Tenure | Week 3 |
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng cách lần theo luồng archive-restore và cách nó phân giải thư mục làm việc của session đối với Git worktree được tạo lại. Tái hiện chuỗi đổi tên branch và restore trên Windows, sau đó xác minh rằng cwd của session trỏ đến worktree thực và các công cụ tệp, lệnh shell cũng như việc discovery .github/agents/ hoạt động mà không cần đường dẫn tuyệt đối.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- git
- Lĩnh vực
- desktop, devtools
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 52/100