fix(vitest-cloud): retry transient post-execute status/log queries - #660
Merged
Conversation
Observed 2026-08-18 on a fully-green 4-shard run (execution ended with succeededCount=4): the wrapper exited 1 because the gcloud executions describe for succeededCount errored once right after execute --wait returned. Retry each status query up to 5x3s and retry an empty log read once, so a transient CLI flake cannot fail an otherwise-green cloud run. Regression-covered in cloud-vitest-wrapper.test.sh (fake gcloud fails the first two describe calls; run must still succeed).
pull Bot
pushed a commit
to HinchK/freshell
that referenced
this pull request
Aug 18, 2026
…xecute output gcloud prints 'Execution [NAME] has successfully completed.' with literal brackets and ANSI SGR codes around the name; the wrappers parsed with grep -oP 'Execution \K[^ ]+', capturing the bracket (and escapes). Every downstream describe/logs call then addressed a nonexistent execution: - vitest-cloud.sh: status queries all failed, so a fully green 4-shard run exited 1 (observed live 2026-08-18, executions freshell-vitest-xzrwg and -ftrdv; the 5x retry from danshapiro#660 could not help a deterministic miss). - e2e-cloud.sh: '|| echo 0' masked it into succeeded=0 — the wrapper would report success even when the status query never reached the real execution. Fix: strip ANSI escapes and accept the bracketed form ('Execution \[?\K[A-Za-z0-9][A-Za-z0-9-]*'). Regression-tested in scripts/test/cloud-exec-id-parse.test.sh for both wrappers (exit code, truthful succeeded count, clean id in downstream describe calls), verified RED before the fix and green after; cloud-vitest-wrapper.test.sh and cloud-vitest-entrypoint.test.sh remain green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
After
gcloud run jobs execute --waitcompletes, the wrapper queries execution status to decide success. Right at that moment theexecutions describecall can transiently fail — observed live 2026-08-18 on a run where all 4 shards finished green: the wrapper exited 1 purely because that single query errored.Fix
Test plan
scripts/test/cloud-vitest-wrapper.test.sh: new regression checks — a fake gcloud fails the first two describe calls, run must still exit 0; full suite passes locally.