mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-23 02:45:38 -06:00
fix(release): validate Claude smoke response exactly
This commit is contained in:
@@ -374,6 +374,7 @@ WRAP
|
||||
fi
|
||||
if [ "$auth_mode" = "subscription" ]; then
|
||||
claude --version
|
||||
direct_probe_output="$(mktemp)"
|
||||
direct_probe_log="$(mktemp)"
|
||||
set +e
|
||||
claude \
|
||||
@@ -384,28 +385,31 @@ WRAP
|
||||
--setting-sources user \
|
||||
--strict-mcp-config \
|
||||
--mcp-config '{"mcpServers":{}}' \
|
||||
--no-session-persistence >"$direct_probe_log" 2>&1
|
||||
--no-session-persistence >"$direct_probe_output" 2>"$direct_probe_log"
|
||||
direct_probe_status=$?
|
||||
set -e
|
||||
print_redacted_direct_probe_log() {
|
||||
sed -E \
|
||||
{
|
||||
cat "$direct_probe_output"
|
||||
cat "$direct_probe_log"
|
||||
} | sed -E \
|
||||
-e 's/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/<redacted-email>/g' \
|
||||
-e 's/(sk-ant-|sk-)[A-Za-z0-9_-]+/<redacted-secret>/g' \
|
||||
"$direct_probe_log" >&2
|
||||
-e 's/(sk-ant-|sk-)[A-Za-z0-9_-]+/<redacted-secret>/g' >&2
|
||||
}
|
||||
if [ "$direct_probe_status" -ne 0 ]; then
|
||||
echo "ERROR: direct Claude subscription probe exited with status $direct_probe_status." >&2
|
||||
print_redacted_direct_probe_log
|
||||
rm -f "$direct_probe_log"
|
||||
rm -f "$direct_probe_output" "$direct_probe_log"
|
||||
exit "$direct_probe_status"
|
||||
fi
|
||||
if ! grep -Eiq '(^|[^[:alnum:]])(4|four)([^[:alnum:]]|$)' "$direct_probe_log"; then
|
||||
direct_output="$(<"$direct_probe_output")"
|
||||
if [[ ! "$direct_output" =~ ^[[:space:]]*(4|[Ff][Oo][Uu][Rr])[[:space:]]*$ ]]; then
|
||||
echo "ERROR: direct Claude subscription probe did not return the expected arithmetic result." >&2
|
||||
print_redacted_direct_probe_log
|
||||
rm -f "$direct_probe_log"
|
||||
rm -f "$direct_probe_output" "$direct_probe_log"
|
||||
exit 1
|
||||
fi
|
||||
rm -f "$direct_probe_log"
|
||||
rm -f "$direct_probe_output" "$direct_probe_log"
|
||||
echo "[claude-subscription] direct claude -p probe ok"
|
||||
else
|
||||
claude auth status || true
|
||||
|
||||
@@ -34,10 +34,14 @@ describe("scripts/test-live-cli-backend-docker.sh", () => {
|
||||
it("prints redacted Claude subscription probe failures", () => {
|
||||
const script = fs.readFileSync(SCRIPT_PATH, "utf8");
|
||||
|
||||
expect(script).toContain('direct_probe_output="$(mktemp)"');
|
||||
expect(script).toContain('direct_probe_log="$(mktemp)"');
|
||||
expect(script).toContain('>"$direct_probe_output" 2>"$direct_probe_log"');
|
||||
expect(script).toContain("This is a local CLI smoke test.");
|
||||
expect(script).toContain("What is two plus two?");
|
||||
expect(script).toContain("(4|four)");
|
||||
expect(script).toContain(
|
||||
'[[ ! "$direct_output" =~ ^[[:space:]]*(4|[Ff][Oo][Uu][Rr])[[:space:]]*$ ]]',
|
||||
);
|
||||
expect(script).not.toContain("direct_token=");
|
||||
expect(script).not.toContain("expected token");
|
||||
expect(script).not.toContain("OPENCLAW-CLAUDE-SUBSCRIPTION-DIRECT");
|
||||
|
||||
Reference in New Issue
Block a user