Skip to content

Commit 68d63ab

Browse files
committed
fix(release): avoid token-shaped Claude live probe
1 parent 6d39ec5 commit 68d63ab

2 files changed

Lines changed: 15 additions & 9 deletions

File tree

‎scripts/test-live-cli-backend-docker.sh‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -374,11 +374,10 @@ WRAP
374374
fi
375375
if [ "$auth_mode" = "subscription" ]; then
376376
claude --version
377-
direct_token="violet-lantern-42"
378377
direct_probe_log="$(mktemp)"
379378
set +e
380379
claude \
381-
-p "This is a local CLI smoke test. Reply with only this harmless phrase: $direct_token" \
380+
-p "This is a local CLI smoke test. What is two plus two? Reply with only the result." \
382381
--output-format text \
383382
--model sonnet \
384383
--permission-mode bypassPermissions \
@@ -388,22 +387,25 @@ WRAP
388387
--no-session-persistence >"$direct_probe_log" 2>&1
389388
direct_probe_status=$?
390389
set -e
391-
direct_output="$(<"$direct_probe_log")"
392-
if [ "$direct_probe_status" -ne 0 ]; then
393-
echo "ERROR: direct Claude subscription probe exited with status $direct_probe_status." >&2
390+
print_redacted_direct_probe_log() {
394391
sed -E \
395392
-e 's/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/<redacted-email>/g' \
396393
-e 's/(sk-ant-|sk-)[A-Za-z0-9_-]+/<redacted-secret>/g' \
397394
"$direct_probe_log" >&2
395+
}
396+
if [ "$direct_probe_status" -ne 0 ]; then
397+
echo "ERROR: direct Claude subscription probe exited with status $direct_probe_status." >&2
398+
print_redacted_direct_probe_log
398399
rm -f "$direct_probe_log"
399400
exit "$direct_probe_status"
400401
fi
401-
rm -f "$direct_probe_log"
402-
if [[ "$direct_output" != *"$direct_token"* ]]; then
403-
echo "ERROR: direct Claude subscription probe did not return expected token." >&2
404-
echo "$direct_output" >&2
402+
if ! grep -Eiq '(^|[^[:alnum:]])(4|four)([^[:alnum:]]|$)' "$direct_probe_log"; then
403+
echo "ERROR: direct Claude subscription probe did not return the expected arithmetic result." >&2
404+
print_redacted_direct_probe_log
405+
rm -f "$direct_probe_log"
405406
exit 1
406407
fi
408+
rm -f "$direct_probe_log"
407409
echo "[claude-subscription] direct claude -p probe ok"
408410
else
409411
claude auth status || true

‎test/scripts/test-live-cli-backend-docker.test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ describe("scripts/test-live-cli-backend-docker.sh", () => {
6161

6262
expect(script).toContain('direct_probe_log="$(mktemp)"');
6363
expect(script).toContain("This is a local CLI smoke test.");
64+
expect(script).toContain("What is two plus two?");
65+
expect(script).toContain("(4|four)");
66+
expect(script).not.toContain("direct_token=");
67+
expect(script).not.toContain("expected token");
6468
expect(script).not.toContain("OPENCLAW-CLAUDE-SUBSCRIPTION-DIRECT");
6569
expect(script).toContain("direct Claude subscription probe exited with status");
6670
expect(script).toContain("<redacted-email>");

0 commit comments

Comments
 (0)