fix: propagate curl failures in install pipeline#1241
Open
akhilesharora wants to merge 1 commit intoanthropics:mainfrom
Open
fix: propagate curl failures in install pipeline#1241akhilesharora wants to merge 1 commit intoanthropics:mainfrom
akhilesharora wants to merge 1 commit intoanthropics:mainfrom
Conversation
installClaudeCode() pipes `curl -fsSL | bash -s --`. Bash exits with the status of the last command, so when curl fails (429 rate limit, 403, or connection error) `bash -s` still exits 0 on empty stdin and the action logs "Claude Code installed successfully". The 3-attempt retry loop never triggers because the first attempt looks successful, and the run later dies with "Executable not found in $PATH: claude". Prefix the pipeline with `set -o pipefail;` so curl's non-zero exit propagates through the pipe and the retry loop can actually kick in. Extracted into buildInstallCommand() with regression tests covering both the old buggy shape and the fixed one.
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.
Summary
Prefix the install pipeline with
set -o pipefail;so curl's non-zero exit propagates throughcurl | bash -s --and the 3-attempt retry loop inrun.ts:71-108actually triggers on 429 / 403 / connect errors. Extracted intobuildInstallCommand(version)so it's unit-testable without spawning a real install.Went with the
pipefailoption from the issue rather than download-then-exec to keep the diff minimal (one prefix, same shell invocation shape).Fixes #1136
Test plan
bun test: 669 pass, 0 fail (5 new tests intest/install-pipefail.test.ts)bun run typecheckcleanbun run format:checkcleancurl | bash -s --shape exits 0 against an unreachable host (no network required), and thatbuildInstallCommand()against the same host exits non-zero. Proves both the bug and the fix without GitHub API or rate-limit dependency.