Files
DeepSeek-Reasonix/scripts/cache-guard.sh
T
SivanCola fd49f2e000 fix(extension): harden latency race and cache contracts
Problem:
Extension catalog cold reads could issue duplicate concurrent RPCs, observation events could block the Agent behind a wedged sidecar, SDK callback concurrency was implicit, and stable enabled-extension cache behavior had no release guard.

Root cause:
Catalog caching used an unlocked check-then-fetch sequence, event notifications waited for physical writes, and equal host/SDK intercept deadlines could race into different error reasons.

Fix:
Coalesce per-plugin catalog fetches, add a bounded non-blocking notification path that preserves request capacity, freeze SDK timeout classification, document concurrent callbacks, and add real-sidecar p50/p95 benchmarks plus a stable-extension cache guard.

Verification:
go test ./...
go test -race ./internal/rpcwire ./internal/extension/providerext ./internal/extension/dispatch ./internal/extension/sidecar ./internal/boot ./internal/agent ./internal/control
(cd sdk/go && go test -race ./...)
./scripts/cache-guard.sh
go vet ./...
go run ./cmd/extension-protocol-gen -check
2026-08-05 16:19:04 +08:00

36 lines
978 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
tmp=$(mktemp)
trap 'rm -f "$tmp"' EXIT
set +e
REASONIX_RELEASE_CACHE_GUARD=1 go test ./internal/agent -run '^TestReleaseCacheHitGuard$' -v -count=1 2>&1 | tee "$tmp"
status=${PIPESTATUS[0]}
set -e
if [ "$status" -ne 0 ]; then
exit "$status"
fi
# A deterministic enabled extension may intentionally establish a different
# prefix once, but independent reload generations must reproduce identical
# provider-visible prompt and tool-schema bytes.
go test ./internal/boot -run '^TestBootStableExtensionCacheGuard$' -v -count=1
if [ -n "${GITHUB_STEP_SUMMARY:-}" ]; then
{
echo "### Cache guard"
echo
echo '```'
grep 'CACHE_GUARD_RESULT:' "$tmp" || true
grep 'CACHE_GUARD_WARNING:' "$tmp" || true
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
fi
while IFS= read -r line; do
msg=${line#*CACHE_GUARD_WARNING: }
echo "::warning title=Reasonix cache guard::$msg"
done < <(grep 'CACHE_GUARD_WARNING:' "$tmp" || true)