fix: also retry dagger when exit code is 2 (engine connection failure)

dagger call --progress=plain -q writes its final error (e.g.
"invalid return status code") directly to the controlling terminal
rather than through stdout/stderr, so the DAGGER_OUT file that the
grep-based retry check reads ends up empty.  Add RC=2 as an
additional fallback condition so the retry triggers even when the
output-capture path misses the error message.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Thomas SharedInbox
2026-05-29 12:11:46 +02:00
co-authored by Claude Sonnet 4.6
parent e251c74139
commit eba94f2aa7
+1 -1
View File
@@ -294,7 +294,7 @@ tasks:
for attempt in 1 2 3; do
run_dagger "$@" && return 0
RC=$?
if [ "$attempt" -lt 3 ] && grep -qE "connection reset|context canceled|context deadline exceeded|connection refused|invalid return status code" "$DAGGER_OUT"; then
if [ "$attempt" -lt 3 ] && { grep -qE "connection reset|context canceled|context deadline exceeded|connection refused|invalid return status code" "$DAGGER_OUT" || [ "$RC" -eq 2 ]; }; then
echo "$(_ts) dagger: network error on attempt $attempt/3, retrying..." >&2
elif [ "$attempt" -lt 3 ] && grep -q "No space left on device" "$DAGGER_OUT"; then
echo "$(_ts) dagger: disk space error on attempt $attempt/3, pruning Dagger cache..." >&2