anthropics / anthropics/claude-agent-sdk-typescript

Ripgrep binary lacks execute permission on Remote SSH (VSIX doesn't preserve Unix permissions)

Open
#129 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Shell
Stars
1.8k
Forks
226
PR merge metrics
No merged PRs in 30d

Description

### Summary

When a VS Code extension using the Claude Agent SDK is installed on a remote Linux server via Remote SSH, the bundled ripgrep binary at `vendor/ripgrep/{platform}/rg` loses its execute permission. This causes command and agent discovery from `.claude/commands/` and `.claude/agents/` to silently fail.

### Environment

- VS Code Remote SSH to Linux server
- Extension installed from VSIX package
- Claude Agent SDK version: 0.2.5

### Root Cause

VSIX files are ZIP archives, and ZIP format does not preserve Unix file permissions. When VS Code extracts the extension on the remote server, the ripgrep binary ends up with `644` permissions instead of `755`.

### Reproduction

1. Package a VS Code extension that uses the Agent SDK
2. Install on a remote Linux server via VS Code Remote SSH
3. Check the ripgrep binary permissions:
```bash
ls -la node_modules/@anthropic-ai/claude-agent-sdk/vendor/ripgrep/x64-linux/rg
# Shows: -rw-r--r-- (644) instead of -rwxr-xr-x (755)
```
4. SDK fails with `EACCES` when trying to spawn ripgrep
5. Command discovery silently returns empty results

### Current Workaround

Extensions can fix permissions at activation:

```typescript
async function fixSdkBinaryPermissions(extensionUri: vscode.Uri): Promise {
if (process.platform === "win32") return;

const sdkVendorPath = path.join(
extensionUri.fsPath,
"node_modules",
"@anthropic-ai",
"claude-agent-sdk",
"vendor"
);

const binaries = [
path.join(sdkVendorPath, "ripgrep", "x64-linux", "rg"),
path.join(sdkVendorPath, "ripgrep", "arm64-linux", "rg"),
path.join(sdkVendorPath, "ripgrep", "x64-darwin", "rg"),
path.join(sdkVendorPath, "ripgrep", "arm64-darwin", "rg"),
];

for (const binary of binaries) {
try {
await fs.promises.access(binary, fs.constants.F_OK);
await fs.promises.chmod(binary, 0o755);
} catch {
// Binary doesn't exist for this platform
}
}
}
```

### Suggested Fix

The SDK could check and fix the ripgrep binary's permissions before first use on non-Windows platforms:

```typescript
// Before spawning ripgrep
if (process.platform !== "win32") {
await fs.promises.chmod(rgPath, 0o755);
}
```

This is a common pattern for VS Code extensions that bundle native binaries for remote scenarios.

### Impact

- Commands and agents from `.claude/commands/`, `.claude/agents/` are not discovered
- Skills still work (different discovery mechanism)
- No error is surfaced to the user - commands just silently don't appear

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.