返回 DeepSeek-Reasonix
cache-guard.sh
根目录 / scripts / cache-guard.sh
1 #!/usr/bin/env bash
2 set -euo pipefail
3
4 tmp=$(mktemp)
5 trap 'rm -f "$tmp"' EXIT
6
7 set +e
8 REASONIX_RELEASE_CACHE_GUARD=1 go test ./internal/agent -run '^TestReleaseCacheHitGuard$' -v -count=1 2>&1 | tee "$tmp"
9 status=${PIPESTATUS[0]}
10 set -e
11
12 if [ "$status" -ne 0 ]; then
13 exit "$status"
14 fi
15
16 # A deterministic enabled extension may intentionally establish a different
17 # prefix once, but independent reload generations must reproduce identical
18 # provider-visible prompt and tool-schema bytes.
19 go test ./internal/boot -run '^TestBootStableExtensionCacheGuard$' -v -count=1
20
21 if [ -n "${GITHUB_STEP_SUMMARY:-}" ]; then
22 {
23 echo "### Cache guard"
24 echo
25 echo '```'
26 grep 'CACHE_GUARD_RESULT:' "$tmp" || true
27 grep 'CACHE_GUARD_WARNING:' "$tmp" || true
28 echo '```'
29 } >> "$GITHUB_STEP_SUMMARY"
30 fi
31
32 while IFS= read -r line; do
33 msg=${line#*CACHE_GUARD_WARNING: }
34 echo "::warning title=Reasonix cache guard::$msg"
35 done < <(grep 'CACHE_GUARD_WARNING:' "$tmp" || true)
36
36 lines BASH