Files
Agent-System-Dev/scripts/check-pins.sh
T
weichenandCursor 88d5787f29
ci / test (pull_request) Failing after 1m0s
Compare pin trees offline and archive finished task cards
Why: Merge commits share a tree with the pinned feature commit, the import ratchet downloaded modules during CI, and task sync wrote the checkpoint onto the wrong card.
Evidence: check-pins accepts 6c0f1e8 (same tree as Backend squad 8e987bf) and rejects empty-tree 8db069d; both objects stayed local. An empty GOMODCACHE run of lint-boundaries matches the cached go list, 14 pairs. bash -n scripts/task.sh.
Impact: make pin no longer checks out Backend nested core or agent-command, and a failing pin check does not fail the target. task sync writes the branch card or warns. precheck reports completed-but-unarchived cards and card-close branches older than 24 hours.
Refs: feature/agent-stack-r0-r1
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-03 10:19:06 +00:00

70 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# 组合指针一致:容器仓在 Dev 钉住的提交上,deps/ 里的每个 gitlink
# 必须等于 Dev 顶层对应指针。development-guidelines 只告警。
set -euo pipefail
root=$(cd "$(dirname "$0")/.." && pwd)
cd "$root"
fail=0
pin_of() {
git rev-parse ":$1"
}
check_link() {
local container="$1" name="$2" sha="$3" expect_path="$4"
local expect
if ! expect=$(pin_of "$expect_path" 2>/dev/null); then
echo "pin: $container deps/$name has no Dev pin at $expect_path" >&2
fail=1
return
fi
if [ "$sha" != "$expect" ]; then
local sha_tree expect_tree
if ! sha_tree=$(git -C "$expect_path" rev-parse "${sha}^{tree}" 2>/dev/null); then
echo "pin: $container deps/$name ${sha:0:12} is missing locally; fetch $expect_path first" >&2
fail=1
return
fi
if ! expect_tree=$(git -C "$expect_path" rev-parse "${expect}^{tree}" 2>/dev/null); then
echo "pin: Dev $expect_path ${expect:0:12} is missing locally; fetch $expect_path first" >&2
fail=1
return
fi
if [ "$sha_tree" = "$expect_tree" ]; then
echo "ok $container $name (same tree)"
return
fi
echo "pin: $container deps/$name is ${sha:0:12}, Dev $expect_path is ${expect:0:12}" >&2
fail=1
return
fi
echo "ok $container $name"
}
containers=(modules/backend deps/agent-native deps/agent-squad deps/agent-intent)
for container in "${containers[@]}"; do
commit=$(pin_of "$container")
while read -r mode _typ sha name; do
[ "$mode" = "160000" ] || continue
base=${name#deps/}
if [ "$base" = "development-guidelines" ]; then
dev=$(pin_of deps/development-guidelines)
if [ "$sha" != "$dev" ]; then
echo "warn: $container deps/development-guidelines is ${sha:0:12}, Dev is ${dev:0:12}" >&2
fi
continue
fi
if [ "$base" = "agent-system-core" ]; then
check_link "$container" "$base" "$sha" modules/core
else
check_link "$container" "$base" "$sha" "deps/$base"
fi
done < <(git -C "$container" ls-tree "$commit" deps/)
done
if [ "$fail" -ne 0 ]; then
exit 1
fi
echo "pins ok"