GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: bound the Claude Code install against a stalled download by RishDevs · Pull Request #1962 · anthropics/claude-code-action

Conversation

@RishDevs

@RishDevs RishDevs commented Nov 10, 2026

Copy link
Copy Markdown

Problem

If the Claude Code download stalls, the action waits until the job times out, which is 360 minutes unless timeout-minutes is set. The three attempts in installClaudeCode don't help because a stalled download never fails.

Root cause

#898 moved the install from action.yml into run.ts and dropped the timeout --kill-after=10 120 wrapper. The current code waits for curl | bash to close with no deadline.

curl --max-time on the outer command wouldn't be enough. It only covers fetching install.sh, and that script downloads the binary with its own curl calls, which have no time limit.

Solution

runInstallCommand replaces the inline spawn. Each attempt gets 120 seconds. At the deadline the install receives SIGTERM, then SIGKILL 10 seconds later. Once the deadline fires the attempt fails as timed out, even if the installer handles SIGTERM and exits 0. It then enters the existing retry loop, so the worst case is about 400 seconds before the action fails.

On POSIX the pipeline runs in its own process group and the whole group is signalled, so curl and the installer don't outlive a timed-out attempt. If bash exits while a descendant ignores the signal, the group gets SIGKILL before the attempt is reported as failed.

Because the group no longer receives signals sent to Bun's own group, SIGINT, SIGTERM and SIGHUP are forwarded to it during the install. Bun waits for the group to exit, using the same 10 second SIGKILL escalation, and then dies from the original signal.

installClaudeCode is now exported and takes an optional deadline so the retry path can be tested. The retry log line now includes the failure reason.

Reproduction

I ran the old and new installClaudeCode with real curl pointed at a local server that accepts connections and never responds. A curl wrapper on PATH redirected the hardcoded URL.

At 130 seconds the old code was still on attempt 1 with curl running. The new code timed out attempt 1 at 120.1 seconds, had terminated that curl, and started attempt 2 at 125.1 seconds.

Test evidence

All results are local, on macOS with Bun 1.4.4, the version pinned in action.yml. CI on Linux has not run yet.

  • With the logic extracted but no deadline, the timeout tests fail.
  • bun test: 988 pass, 0 fail (966 before this change). bun run typecheck and bun run format:check pass.
  • test/install-timeout.test.ts covers the deadline, signal escalation, surviving descendants, signal forwarding and retries. It passed 20 of 20 repeat runs.
  • With a 2 second deadline, all three attempts timed out, the action rejected after 16 seconds, and no stalled processes remained.

Known test issue: with twice as many CPU-bound processes as cores, a small share of bun test runs of the first three timeout tests hang with Bun's main thread spinning in native code and no child processes left. The rate was 6 of 764 runs with this patch, measured before the final signal-handling edit, and 5 of 811 with the previous plain spawn logic, so this change doesn't appear to cause it. I haven't determined the root cause, and these runs don't rule out hangs in general.

Compatibility and limitations

There are no new inputs, outputs or dependencies, and PATH_TO_CLAUDE_CODE_EXECUTABLE still skips the install. Installations exceeding 120 seconds now time out and enter the retry loop. This matches the timeout configured in base-action when the system's timeout utility is available. Without that utility base-action has no limit, while this change always applies one.

#709 reports retries failing after a timed-out install with "another process is currently installing Claude", and its comments point to stale lock files. #790 changed the timeout flags in response to those failures. This change makes sure the timed-out processes are gone but doesn't remove lock files, so an install killed while holding a lock could still hit #709. I haven't tested that case.

Cancellation has not been tested on a GitHub-hosted runner. GitHub documents SIGINT, then SIGTERM, then killing the process tree if the entry process is still running. In a local simulation of that sequence on macOS, bash exited on SIGTERM while Bun and curl kept running, with the old and new code alike, and the new deadline still fired afterwards. From reading actions/runner, leftover processes are removed at job end by matching RUNNER_TRACKING_ID, which curl inherited in the simulation.

The deadline runs in Bun, so it only holds while Bun is running. A forwarded signal can delay Bun's exit by up to 10 seconds if the install ignores it. SIGKILL to Bun can't be forwarded, and the installer then keeps running without a deadline, as it did before this change.

Windows has not been run. There is no process group or signal forwarding on that path, so only bash is signalled and descendants may survive.

AI assistance

I used Claude Code (Claude Opus 5.5) for investigation, implementation, testing, and drafting this PR. The test results and known limitations are documented above.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@RishDevs
fix: bound the Claude Code install against a stalled download
91e2db0
The move to the unified run.ts entrypoint dropped the 120 second limit
that base-action/action.yml still applies to the same install script
when the timeout utility is available. A stalled download then never
reached the retry loop and held the job until its timeout.

Run the install in its own process group with a deadline, escalating
from SIGTERM to SIGKILL, so a timed-out attempt is gone before the next
one starts. Forward SIGINT, SIGTERM and SIGHUP to that group, since it
no longer receives signals sent to Bun's own group.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@RishDevs
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.