Skip to content

fix: resolve macOS bin/ directory not found in npm install#327

Merged
khaliqgant merged 3 commits intomainfrom
fix/macos-bin-directory
Jan 28, 2026
Merged

fix: resolve macOS bin/ directory not found in npm install#327
khaliqgant merged 3 commits intomainfrom
fix/macos-bin-directory

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

@khaliqgant khaliqgant commented Jan 28, 2026

Summary

Fix the macOS-specific test failure where node_modules/agent-relay/bin/ directory is not found after npm install, despite bin/ being properly included in the tarball and working correctly on Linux runners.

Problem

  • Failing Test: Verify macOS (arm64) - Test: relay-pty binary exists
  • Error: ls: ./node_modules/agent-relay/bin: No such file or directory
  • Status:
    • ✅ Linux tests PASS (Verify Node 18/20/22)
    • ✅ Docker tests PASS
    • ❌ macOS runner FAILS
    • ✅ CLI version test passes on macOS (binary IS installed somewhere)

Investigation

The issue appears to be that npm on macOS runners doesn't extract the bin/ directory from the tarball, despite:

  • Tarball containing the bin/ directory with all binaries
  • package.json "files" field explicitly including "bin"
  • Linux runners correctly extracting bin/

Root Cause (To Be Determined)

Possible causes under investigation:

  1. npm version difference between macOS and Linux runners
  2. macOS-specific npm behavior with "files" field
  3. File permission preservation issue in tarball extraction
  4. postinstall script interaction

Solution Approach

Will investigate and implement:

  1. Why npm doesn't unpack bin/ on macOS
  2. Whether npm version differs between runners
  3. Whether package.json configuration needs adjustment
  4. If postinstall script needs to handle missing bin/

Test Plan

  • Verify Node 20/22 tests still pass (Linux validation)
  • Docker tests still pass
  • Verify macOS (arm64) test passes
  • Verify macOS (x64) test passes
  • All critical tests green before merge

Technical Context

  • Related: PR Verification improvements & hardening #325 (verification-improvements) - includes CJS exports and bin/ whitelisting
  • Current Issue: macOS runner doesn't extract bin/ despite being in tarball
  • Not Blocking: Linux validation tests confirm core functionality works

Assigned to: macOSFixEngineer for investigation and fix


Open with Devin

khaliqgant and others added 2 commits January 28, 2026 10:42
The verify-macos job was missing the checkout, npm ci, and npm pack
steps that the Linux verify job has. On PRs, this caused the tarball
to not exist, resulting in npm install failing to properly extract
the bin/ directory with relay-pty binaries.

Root cause:
- Linux verify job: checks out → npm ci → npm pack → tarball exists ✓
- macOS verify job: no checkout → tries to use non-existent tarball ✗

Fix: Add the same checkout, npm ci --ignore-scripts, and npm pack
steps to the macOS job that already exist in the Linux job.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View issue and 3 additional flags in Devin Review.

Open in Devin Review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Linux verify job packs tarball but never uses it for PR testing

The Linux verify job packs a local tarball for PRs but then ignores it, always installing from npm registry instead.

Click to expand

Problem

The macOS verify-macos job was fixed to correctly use the local tarball for PR testing, but the Linux verify job was not updated to match.

In the Linux verify job:

  1. Lines 44-50 pack a local tarball when github.event_name == 'pull_request'
  2. But lines 57-69 in "Get package spec" always set SPEC="agent-relay" (from npm), never using the local tarball
# Linux verify job (lines 57-69) - BROKEN
run: |
  VERSION_INPUT="${{ inputs.version }}"
  if [ -z "$VERSION_INPUT" ] || [ "$VERSION_INPUT" = "latest" ]; then
    VERSION="latest"
    SPEC="agent-relay"  # Always uses npm registry!

Compare with macOS job (lines 341-352) which correctly handles PRs:

# macOS verify-macos job - CORRECT
run: |
  if [ "${{ github.event_name }}" = "pull_request" ]; then
    SPEC="./$(ls agent-relay-*.tgz | head -1)"  # Uses local tarball

Impact

For pull requests, the Linux verify job tests whatever version is currently published on npm rather than the actual PR changes. This defeats the purpose of the verification workflow for PRs - bugs or regressions introduced in the PR won't be caught by the Linux tests.

(Refers to lines 57-69)

Recommendation: Update the Linux verify job's "Get package spec" step to check for github.event_name == 'pull_request' and use the local tarball, similar to the macOS job:

run: |
  if [ "${{ github.event_name }}" = "pull_request" ]; then
    SPEC="./$(ls agent-relay-*.tgz | head -1)"
  else
    VERSION_INPUT="${{ inputs.version }}"
    # ... rest of existing logic
  fi
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

The tarball is created in the checkout directory, but the test step
cd's to /tmp/test-project. Using a relative path ./agent-relay-*.tgz
fails because it doesn't exist in the new directory.

Fix: Use $(pwd)/ prefix to create absolute path that works regardless
of current directory.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

🔴 1 issue in files not directly in the diff

🔴 27MB tarball file accidentally committed to repository (agent-relay-2.0.29.tgz:1)

A 27MB npm tarball file agent-relay-2.0.29.tgz was accidentally committed to the git repository.

Click to expand

Impact

  • Bloats the repository by 27MB for every clone
  • The tarball is version-specific (2.0.29) and will become stale as the package version increments
  • The .npmignore file already excludes *.tgz files from npm packages, but the file was committed to git

Evidence

The file appears in the PR diff as a new binary file:

diff --git a/agent-relay-2.0.29.tgz b/agent-relay-2.0.29.tgz
new file mode 100644

It was added in commit 37ef23b ("docs: track macOS bin/ directory issue investigation") and is 27MB in size.

Expected behavior

Tarball files should not be committed to git. They should be generated dynamically by the CI workflow (which the PR correctly does with npm pack).

Recommendation

Remove the tarball from the repository and add *.tgz to .gitignore to prevent future accidental commits.

View issue and 6 additional flags in Devin Review.

Open in Devin Review

@khaliqgant khaliqgant merged commit 22c0f38 into main Jan 28, 2026
29 of 31 checks passed
@khaliqgant khaliqgant deleted the fix/macos-bin-directory branch January 28, 2026 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant