Skip to content

fix(providers): adapt to claude-agent-sdk 0.2.121 native-binary auto-resolve#1472

Closed
dsorensen wants to merge 1 commit intocoleam00:devfrom
dsorensen:fix/claude-sdk-0.2.121-resolver
Closed

fix(providers): adapt to claude-agent-sdk 0.2.121 native-binary auto-resolve#1472
dsorensen wants to merge 1 commit intocoleam00:devfrom
dsorensen:fix/claude-sdk-0.2.121-resolver

Conversation

@dsorensen
Copy link
Copy Markdown

@dsorensen dsorensen commented Apr 28, 2026

Summary

  • Bumps @anthropic-ai/claude-agent-sdk from ^0.2.74^0.2.121.
  • Drops the dev-mode short-circuit in resolveClaudeBinaryPath so dev follows the same env → config → autodetect chain as binary mode.
  • The native-binary detection in shouldPassNoEnvFile now sees the real resolved path and correctly suppresses --no-env-file for native installs.

Why

claude-agent-sdk 0.2.121 stopped shipping a bundled cli.js and now resolves to a native platform binary by default. Dev mode used to return undefined and let the SDK auto-resolve — but with 0.2.121 the SDK auto-resolves to the native binary, and shouldPassNoEnvFile(undefined) then returns true, so --no-env-file is forwarded to a native binary that rejects unknown flags. Result: every Claude workflow node fails with exit code 1 immediately on spawn.

Reproduced in three back-to-back ai_demo workflow runs and confirmed against direct sendQuery repro (#878 in session memory).

Test plan

  • bun run validate passes locally (type-check, lint, format, all package test suites).
  • binary-resolver-dev.test.ts rewritten as a regression check that dev mode honors env / config (no short-circuit). New assertions are mode-agnostic.
  • provider.test.ts mocks ./binary-resolver to return undefined so existing executableArgs: ['--no-env-file'] assertions don't depend on whether the test host has a native Claude install at ~/.local/bin/claude.
  • Manual repro: re-running archon workflow run claude-plan-full-sdlc against any of the three ai_demo projects no longer hits the --no-env-file crash on the first node spawn.

Notes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Dependencies

    • Updated Claude SDK dependency to version 0.2.121.
  • Improvements

    • Claude native binary resolution now consistently applies environment variable and configuration overrides across all execution modes, ensuring predictable behavior.

…resolve

claude-agent-sdk 0.2.121 stopped shipping a bundled cli.js and now resolves
to a native platform binary by default. The dev-mode short-circuit in
resolveClaudeBinaryPath returned undefined so the SDK auto-resolved that
native binary, but shouldPassNoEnvFile then misclassified the spawned
executable and forwarded `--no-env-file`, which the native binary rejects
(it crashes on the unknown flag).

Drop the dev-mode short-circuit so dev follows the same env → config →
autodetect chain as binary mode. The resolved path then flows into
shouldPassNoEnvFile, which correctly suppresses --no-env-file for native
binaries.

Test changes:
- packages/providers/src/claude/binary-resolver-dev.test.ts: rewritten as
  a regression check that dev mode honors env and config (no short-circuit).
- packages/providers/src/claude/provider.test.ts: mock the resolver to
  return undefined so executableArgs assertions don't depend on whether
  the test host has a native Claude binary installed at ~/.local/bin/claude.

Lockfile: bumps @anthropic-ai/claude-agent-sdk ^0.2.74 → ^0.2.121.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f02cd89e-9d41-409d-8aae-7391f35ecd77

📥 Commits

Reviewing files that changed from the base of the PR and between 7d06773 and 33ef830.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • package.json
  • packages/providers/src/claude/binary-resolver-dev.test.ts
  • packages/providers/src/claude/binary-resolver.ts
  • packages/providers/src/claude/provider.test.ts

📝 Walkthrough

Walkthrough

The Claude binary resolver no longer applies dev-mode special handling, now consistently following an environment-variable-first resolution chain across all modes. Dependency on @anthropic-ai/claude-agent-sdk upgraded from ^0.2.74 to ^0.2.121. Related tests refactored to verify the unified behavior and eliminate environment-dependent test results.

Changes

Cohort / File(s) Summary
Dependency Upgrade
package.json
Updated @anthropic-ai/claude-agent-sdk from ^0.2.74 to ^0.2.121.
Binary Resolver Logic
packages/providers/src/claude/binary-resolver.ts
Removed BUNDLED_IS_BINARY conditional gate; resolveClaudeBinaryPath now consistently applies env/config/autodetect resolution chain in all modes instead of short-circuiting to undefined in dev mode.
Resolver Tests
packages/providers/src/claude/binary-resolver-dev.test.ts, packages/providers/src/claude/provider.test.ts
Refactored dev-mode tests to validate proper resolution chain using fileExists spy; added env variable teardown; mocked binary resolver in provider tests to eliminate environment-dependent behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 Hoppy paths now run on truth,
No shortcuts in the binary booth!
Dev-mode checked, now gone for good,
One clean path, just as it should.
Tests behave, no secrets hid,
The resolver's heart is vivid!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the core problem, why it matters, what changed, and verification approach, but omits multiple required template sections (UX Journey, Architecture Diagram, Label Snapshot, Change Metadata, Validation Evidence, Security Impact, Compatibility, Human Verification, Side Effects, Rollback Plan, Risks and Mitigations). Complete the description template by adding the missing sections: UX Journey, Architecture Diagram, Label Snapshot, full Validation Evidence, Security Impact, Compatibility details, Human Verification checklist, Side Effects assessment, Rollback Plan, and Risks/Mitigations.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adapting providers to a new SDK version's native-binary auto-resolve behavior by updating dependency and resolver logic.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Wirasm
Copy link
Copy Markdown
Collaborator

Wirasm commented Apr 29, 2026

We are already running 0.2.121

@Wirasm Wirasm closed this Apr 29, 2026
@dsorensen dsorensen deleted the fix/claude-sdk-0.2.121-resolver branch April 30, 2026 02:50
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.

2 participants