Plan history loses its Versions tab when the agent changes directory into another git repo between submits
Maintainer thường phản hồi trong vòng 1 ngày
@aomalov đang làm issue này rồi.
Từ ngày 26/10/2026.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- backend
Hướng nghiên cứu
Start with server/index.ts and trace how startPlannotatorServer detects the project and saves plan history. Then read the Claude Code plan launch path in apps/hook/hooks/mod/controller.ts and the classic PermissionRequest hook to see which session directory information is available. Done means consecutive submits stay in the same history chain after the agent changes directories, so the Versions tab and diff remain available.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happened?
When the agent changes directory into a different git repo between two plan submits, the Versions tab disappears and there is no diff. The revised plan is correct and the earlier version is still on disk; they just land in two different history projects, so the UI sees a chain of length 1.
Concretely: a Claude Code session started in a workspace repo (workspace) whose subfolders are separate git clones. The first submit went to history/workspace/<slug>/001.md. Before the resubmit, the agent ran cd service-a (a nested clone) in its shell, and the second submit went to history/service-a/<slug>/001.md. The session record for the second review shows "project": "service-a".
Root cause: the history project is detected from the process cwd at every submit.
packages/server/index.ts (startPlannotatorServer):
project = (await detectProjectName()) ?? "_unknown";
historySlug = resolveHistorySlug(project, slug);
const historyResult = saveToHistory(project, historySlug, plan);
detectProjectName() defaults to process.cwd() and returns the basename of git rev-parse --show-toplevel. The plan CLI inherits whatever directory the session is in at that moment:
- the Claude Code mod launches
plannotator claude-mod-planwithout acwdorPLANNOTATOR_CWD(apps/hook/hooks/mod/controller.ts,launch) - the classic
PermissionRequesthook runsplannotatorin the session's current directory
So a shell cd mid-session (common in multi-repo workspaces and monorepos with nested clones) changes the project key, getNextVersionNumber returns 1 in the fresh directory, previousPlan is null, and the Versions gate never opens. The code-review paths already prefer PLANNOTATOR_CWD; the plan paths ignore it.
This is the same class of bug as #1679 (history key not stable across a resubmit), on the project half of history/{project}/{slug} rather than the slug half.
Suggested fix
- Name the history project from the session's project root rather than the current directory:
$.session.root()in the mod (a shellcddoes not move it),CLAUDE_PROJECT_DIRin the classic hook. - Pin a plan's project per (session, date-free slug) on its first save, so
/cdor a worktree move mid-plan still continues the same chain.
Other agents (OpenCode, Pi, Codex, Gemini, Copilot, Droid, Vibe) are unaffected.
Plannotator version
plannotator 0.28.31
OS
macOS
Agent
Claude Code
Where did it happen?
Plan review
- Ngôn ngữ chính
- TypeScript
- Star
- 8.7k
- Fork
- 649
- Merge trung bình
- 11 giờ 16 phút
- Pull request đã merge (30 ngày)
- 585
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của backnotprop/plannotator
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
backnotprop/plannotator#2372 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
backnotprop/plannotator#2317 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
backnotprop/plannotator#2290 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
backnotprop/plannotator#2243 · 1 bình luận · 2 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Annotate documentation omits per-file version history and privacy controlsCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
backnotprop/plannotator#1086 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của backnotprop/plannotator
Issue tương tự
-
Replace discontinued crypto-js in the themeCó thể đã có người làm @aelmanaa đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
PaloAltoNetworks/docusaurus-openapi-docs#1689 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
solana-foundation/solana-web3.js#4015 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
formatSearchQuery drops the :present modifier, so `email:present=true` is sent as `email=true`Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 90/100
ivopogace/opencode-courier#422 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
chapel-lang/chapel-vscode#158 ·
Maintainer thường phản hồi trong vòng 1 ngày