fix: pass install.sh binary path explicitly to Agent SDK (#1235)

Agent SDK 0.2.113 dropped vendor/ripgrep and now ships native binaries
via per-platform optionalDependencies. Two breakages:

- action.yml chmod'd vendor/ripgrep which no longer exists, failing the
  Install Dependencies step with find exit 1.
- The SDK auto-resolves its bundled binary by trying the -musl platform
  package before the glibc one. bun install does not respect the
  package.json libc field and installs both on glibc Linux, so the SDK
  picks the musl binary and spawn fails with ENOENT.

Remove the obsolete ripgrep chmod. Make installClaudeCode() return the
install.sh binary path and pass it explicitly as
pathToClaudeCodeExecutable so the SDK skips auto-resolution entirely.
This commit is contained in:
Ashwin Bhat 2026-04-17 15:50:46 -07:00 committed by GitHub
parent c68f82cb11
commit 0d2971c794
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 14 deletions

View File

@ -194,10 +194,6 @@ runs:
run: | run: |
cd ${GITHUB_ACTION_PATH} cd ${GITHUB_ACTION_PATH}
bun install --production bun install --production
# bun install --production strips execute bits from vendored binaries (bun issue #1140).
# Restore +x on the ripgrep binaries so the Claude Agent SDK can exec them.
find "${GITHUB_ACTION_PATH}/node_modules/@anthropic-ai/claude-agent-sdk/vendor/ripgrep" \
-name "rg" -type f -exec chmod +x {} \;
- name: Install subprocess isolation dependencies - name: Install subprocess isolation dependencies
# Install subprocess isolation dependencies when processing content from non-write users. # Install subprocess isolation dependencies when processing content from non-write users.

View File

@ -11,6 +11,14 @@ async function run() {
try { try {
validateEnvironmentVariables(); validateEnvironmentVariables();
// The composite action's "Install Claude Code" step writes the binary to
// ~/.local/bin/claude. Pass that path explicitly so the Agent SDK doesn't
// fall back to its bundled platform package, which bun may resolve to the
// wrong libc variant on Linux.
const claudeExecutable =
process.env.INPUT_PATH_TO_CLAUDE_CODE_EXECUTABLE ||
`${process.env.HOME}/.local/bin/claude`;
await setupClaudeCodeSettings( await setupClaudeCodeSettings(
process.env.INPUT_SETTINGS, process.env.INPUT_SETTINGS,
undefined, // homeDir undefined, // homeDir
@ -20,7 +28,7 @@ async function run() {
await installPlugins( await installPlugins(
process.env.INPUT_PLUGIN_MARKETPLACES, process.env.INPUT_PLUGIN_MARKETPLACES,
process.env.INPUT_PLUGINS, process.env.INPUT_PLUGINS,
process.env.INPUT_PATH_TO_CLAUDE_CODE_EXECUTABLE, claudeExecutable,
); );
const promptConfig = await preparePrompt({ const promptConfig = await preparePrompt({
@ -38,8 +46,7 @@ async function run() {
appendSystemPrompt: process.env.INPUT_APPEND_SYSTEM_PROMPT, appendSystemPrompt: process.env.INPUT_APPEND_SYSTEM_PROMPT,
fallbackModel: process.env.INPUT_FALLBACK_MODEL, fallbackModel: process.env.INPUT_FALLBACK_MODEL,
model: process.env.ANTHROPIC_MODEL, model: process.env.ANTHROPIC_MODEL,
pathToClaudeCodeExecutable: pathToClaudeCodeExecutable: claudeExecutable,
process.env.INPUT_PATH_TO_CLAUDE_CODE_EXECUTABLE,
showFullOutput: process.env.INPUT_SHOW_FULL_OUTPUT, showFullOutput: process.env.INPUT_SHOW_FULL_OUTPUT,
}); });

View File

@ -43,8 +43,9 @@ import type { ClaudeRunResult } from "../../base-action/src/run-claude-sdk";
/** /**
* Install Claude Code CLI, handling retry logic and custom executable paths. * Install Claude Code CLI, handling retry logic and custom executable paths.
* Returns the absolute path to the claude executable.
*/ */
async function installClaudeCode(): Promise<void> { async function installClaudeCode(): Promise<string> {
const customExecutable = process.env.PATH_TO_CLAUDE_CODE_EXECUTABLE; const customExecutable = process.env.PATH_TO_CLAUDE_CODE_EXECUTABLE;
if (customExecutable) { if (customExecutable) {
if (/[\x00-\x1f\x7f]/.test(customExecutable)) { if (/[\x00-\x1f\x7f]/.test(customExecutable)) {
@ -61,7 +62,7 @@ async function installClaudeCode(): Promise<void> {
} }
// Also add to current process PATH // Also add to current process PATH
process.env.PATH = `${claudeDir}:${process.env.PATH}`; process.env.PATH = `${claudeDir}:${process.env.PATH}`;
return; return customExecutable;
} }
const claudeCodeVersion = "2.1.113"; const claudeCodeVersion = "2.1.113";
@ -93,7 +94,7 @@ async function installClaudeCode(): Promise<void> {
await appendFile(githubPath, `${homeBin}\n`); await appendFile(githubPath, `${homeBin}\n`);
} }
process.env.PATH = `${homeBin}:${process.env.PATH}`; process.env.PATH = `${homeBin}:${process.env.PATH}`;
return; return `${homeBin}/claude`;
} catch (error) { } catch (error) {
if (attempt === 3) { if (attempt === 3) {
throw new Error( throw new Error(
@ -104,6 +105,7 @@ async function installClaudeCode(): Promise<void> {
await new Promise((resolve) => setTimeout(resolve, 5000)); await new Promise((resolve) => setTimeout(resolve, 5000));
} }
} }
throw new Error("unreachable");
} }
/** /**
@ -220,7 +222,7 @@ async function run() {
prepareCompleted = true; prepareCompleted = true;
// Phase 2: Install Claude Code CLI // Phase 2: Install Claude Code CLI
await installClaudeCode(); const claudeExecutable = await installClaudeCode();
// Phase 3: Run Claude (import base-action directly) // Phase 3: Run Claude (import base-action directly)
// Set env vars needed by the base-action code // Set env vars needed by the base-action code
@ -259,7 +261,7 @@ async function run() {
await installPlugins( await installPlugins(
process.env.INPUT_PLUGIN_MARKETPLACES, process.env.INPUT_PLUGIN_MARKETPLACES,
process.env.INPUT_PLUGINS, process.env.INPUT_PLUGINS,
process.env.INPUT_PATH_TO_CLAUDE_CODE_EXECUTABLE, claudeExecutable,
); );
const promptFile = const promptFile =
@ -274,8 +276,7 @@ async function run() {
claudeArgs: prepareResult.claudeArgs, claudeArgs: prepareResult.claudeArgs,
appendSystemPrompt: process.env.APPEND_SYSTEM_PROMPT, appendSystemPrompt: process.env.APPEND_SYSTEM_PROMPT,
model: process.env.ANTHROPIC_MODEL, model: process.env.ANTHROPIC_MODEL,
pathToClaudeCodeExecutable: pathToClaudeCodeExecutable: claudeExecutable,
process.env.INPUT_PATH_TO_CLAUDE_CODE_EXECUTABLE,
showFullOutput: process.env.INPUT_SHOW_FULL_OUTPUT, showFullOutput: process.env.INPUT_SHOW_FULL_OUTPUT,
}); });