Why: cmd_start derived the worktree location from $PWD, so running task.sh start from a repository subdirectory (or inside a task worktree) placed the new worktree at the wrong spot — e.g. scripts-wt-<slug> nested inside the repo.
Evidence: bash -n clean; functional smoke of the patched script from both the main checkout scripts/ subdir and the repo root created ../Agent-System-Dev-wt-<slug> as a sibling of the main checkout (paths asserted; pre-fix subdir run would nest inside the repo); git rev-parse --git-common-dir resolves to the main checkout from both locations (relative ../.git vs absolute).
Impact: scripts/task.sh cmd_start only; from the main checkout root the derived path is identical to before; new worktrees now always land as siblings of the main checkout regardless of invocation directory.
Refs: .task/feature-task-start-rootfix.md
Why: the task card and PR description are one document; objectives, results and verification evidence must be on the record before requesting review.
Evidence: card filled with smoke A/B results (sibling-path assertions both PASS) and sync row 7fab8feaf7/aecaa52e6b.
Impact: .task/feature-task-start-rootfix.md only; no code change.
Refs: feature-task-start-rootfix
weichen
merged commit 84b6ab084e into main2026-09-30 15:32:24 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
feature/task-start-rootfix 任务卡
任务主记录:<PR 链接,task-finish 时填写>;状态:进行中;owner:weichen
基线与授权
ffda6d33ea目标与非目标
task.sh start的 worktree 落点从$PWD推算改为经git rev-parse --git-common-dir定位主检出,使从仓库子目录(或任务 worktree 内)运行时也落在主检出平级../Agent-System-Dev-wt-<slug>;受影响入口仅cmd_start。.gitignore的变更。同步记录
ffda6d33eaffda6d33ea7fab8feaf7aecaa52e6b结果与验证
cmd_start增设mainroot=$(dirname "$(cd "$(git rev-parse --git-common-dir)" && pwd)")(与cmd_finish定位主检出同款惯用法),落点改为$(dirname "$mainroot")/$(basename "$mainroot")-wt-${slug};主检出根运行时路径与旧实现一致。bash -n通过(shellcheck 未安装,跳过);冒烟 A——主检出scripts/子目录运行修复版 start,worktree 落在/home/weichen/projects/Agent-System-Dev-wt-feature-rootfix-smoke(修复前形态scripts-wt-…已断言不存在);冒烟 B——主检出根目录运行,落点与现有惯例一致;smoke worktree/分支已全部清理,git worktree list无残留。