From 19452ba7ca7431f4f1a2f477066358b62e0ed4ef Mon Sep 17 00:00:00 2001 From: weichen Date: Wed, 30 Sep 2026 15:22:51 +0000 Subject: [PATCH 1/4] Record the task card for feature-task-start-rootfix --- .task/feature-task-start-rootfix.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .task/feature-task-start-rootfix.md diff --git a/.task/feature-task-start-rootfix.md b/.task/feature-task-start-rootfix.md new file mode 100644 index 00000000..b8543b05 --- /dev/null +++ b/.task/feature-task-start-rootfix.md @@ -0,0 +1,25 @@ +# feature/task-start-rootfix 任务卡 + +任务主记录:;状态:进行中;owner:weichen + +## 基线与授权 + +- 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= ffda6d33eabb23c9be5bac221529367d771c5f7b +- 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-task-start-rootfix(worktree);分支:feature/task-start-rootfix +- 授权与交付终点:<本次允许的动作与终点;未授权事项写明> + +## 目标与非目标 + +<预期结果、受影响入口/模块/契约;明确不做什么。> + +## 同步记录 + +| 节点 | sync_base_sha | tested_head_sha | checked_at | +|---|---|---|---| +| 启动 | ffda6d33eabb23c9be5bac221529367d771c5f7b | ffda6d33eabb23c9be5bac221529367d771c5f7b | 2026-09-30T15:22:51Z | + +## 结果与验证(完成后填写) + +- 结果: +- 验证: +- 影响与剩余项: From d3893609b791af8254098d7e72f4046e31644575 Mon Sep 17 00:00:00 2001 From: weichen Date: Wed, 30 Sep 2026 15:28:14 +0000 Subject: [PATCH 2/4] Fix task worktree path derivation to anchor on the main checkout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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- 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- 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 --- scripts/task.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/task.sh b/scripts/task.sh index 587074dd..f9eadd84 100755 --- a/scripts/task.sh +++ b/scripts/task.sh @@ -63,10 +63,13 @@ cmd_start() { [ "$(git status --porcelain | { grep -v '^.. \.zcode/' || true; } | wc -l)" -eq 0 ] || die "dirty tree — resolve first (precheck verdict BUSY)" [ "$(git submodule status --recursive 2>/dev/null | { grep -cE '^\+|^U' || true; })" -eq 0 ] || die "submodule drift/conflict — resolve first (precheck verdict BUSY)" git merge-base --is-ancestor "origin/${TARGET_BRANCH}" HEAD || die "local ${TARGET_BRANCH} behind origin — pull --ff-only first" - local rmain slug wt + local rmain slug wt mainroot rmain=$(git rev-parse "origin/${TARGET_BRANCH}") slug=$(echo "$name" | tr '/' '-') - wt="$(dirname "$(pwd)")/$(basename "$(pwd)")-wt-${slug}" + # 落点须为主检出的平级目录:$PWD 推算在子目录(或任务 worktree 内)运行时会算错, + # 改用 git-common-dir 的父目录定位主检出(与 cmd_finish 同款惯用法)。 + mainroot=$(dirname "$(cd "$(git rev-parse --git-common-dir)" && pwd)") + wt="$(dirname "$mainroot")/$(basename "$mainroot")-wt-${slug}" [ -e "$wt" ] && die "worktree path exists: $wt" git worktree add -q "$wt" -b "$name" "$rmain" (cd "$wt" && git submodule update --init --recursive >/dev/null 2>&1 || echo "[warn] submodule init incomplete in worktree") From c9f27bc163976089b04b46353806633770b424dc Mon Sep 17 00:00:00 2001 From: weichen Date: Wed, 30 Sep 2026 15:28:27 +0000 Subject: [PATCH 3/4] Record the sync checkpoint --- .task/feature-duplication-lesson-records.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.task/feature-duplication-lesson-records.md b/.task/feature-duplication-lesson-records.md index c27ec85e..410a912d 100644 --- a/.task/feature-duplication-lesson-records.md +++ b/.task/feature-duplication-lesson-records.md @@ -43,3 +43,4 @@ | 同步前验收 | 22d14db80c31e4bcfa24411f847018f527b16a01 | 6cd8cf1d0d8c7b82cabe4ecbdf82b5cfd83e39fe | 2026-09-30T14:19:33Z | | 同步前验收 | 7db242792a1561b2aad7877278d42f249369c2b9 | 314de91df3755cae006f5ced777eb71d0baa92b1 | 2026-09-30T14:29:40Z | | 同步前验收 | ffda6d33eabb23c9be5bac221529367d771c5f7b | ac8db54ecb8ddc1e077bfec772a1665d3c2d753a | 2026-09-30T15:22:40Z | +| 同步前验收 | 7fab8feaf7b454fda4b85fd01fb6ad179496dfcd | aecaa52e6bca27c072cd89b295a75c8a4ea744aa | 2026-09-30T15:28:27Z | From a4d4a1374295123c040d4da69261c5619c83a6d3 Mon Sep 17 00:00:00 2001 From: weichen Date: Wed, 30 Sep 2026 15:29:40 +0000 Subject: [PATCH 4/4] Fill task card objectives and verification evidence 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 --- .task/feature-task-start-rootfix.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.task/feature-task-start-rootfix.md b/.task/feature-task-start-rootfix.md index b8543b05..fca48fde 100644 --- a/.task/feature-task-start-rootfix.md +++ b/.task/feature-task-start-rootfix.md @@ -6,20 +6,22 @@ - 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= ffda6d33eabb23c9be5bac221529367d771c5f7b - 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-task-start-rootfix(worktree);分支:feature/task-start-rootfix -- 授权与交付终点:<本次允许的动作与终点;未授权事项写明> +- 授权与交付终点:修复 cmd_start 的 worktree 落点推算并验证;终点为 PR 合入 main 后回收 worktree。 ## 目标与非目标 -<预期结果、受影响入口/模块/契约;明确不做什么。> +- 目标:`task.sh start` 的 worktree 落点从 `$PWD` 推算改为经 `git rev-parse --git-common-dir` 定位主检出,使从仓库子目录(或任务 worktree 内)运行时也落在主检出平级 `../Agent-System-Dev-wt-`;受影响入口仅 `cmd_start`。 +- 非目标:不改 worktree 布局本身(维持平级散放,布局决策已定);不改 sync/close/finish;不引入对 `.gitignore` 的变更。 ## 同步记录 | 节点 | sync_base_sha | tested_head_sha | checked_at | |---|---|---|---| | 启动 | ffda6d33eabb23c9be5bac221529367d771c5f7b | ffda6d33eabb23c9be5bac221529367d771c5f7b | 2026-09-30T15:22:51Z | +| 同步前验收 | 7fab8feaf7 | aecaa52e6b | 2026-09-30T15:28:27Z | -## 结果与验证(完成后填写) +## 结果与验证 -- 结果: -- 验证: -- 影响与剩余项: +- 结果:`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` 无残留。 +- 影响与剩余项:无剩余项;pre-commit 的 Mimosa 钩子报 advisory(scanner_no_output,兼容策略放行),属环境侧扫描器无输出,非本次改动引入。