What Changed#
Changed the Claude adapter and capability probe to import SDK runtime values only when they start Claude work. Type imports remain static, and the existing injected query path is unchanged.
Added a regression test that makes the Claude SDK throw if importing the adapter evaluates it. Focused adapter and capability-probe tests pass with 78 tests, the server typecheck passes, and the production server bundle contains only deferred Claude SDK imports.
Why#
T3 currently evaluates @anthropic-ai/claude-agent-sdk during server startup even when the active provider is Codex, Cursor, Grok, or OpenCode. Provider-specific runtime code should load at the point where T3 starts a Claude query or SDK capability probe. This keeps unrelated provider startup isolated while preserving the existing Claude behavior.
Checklist#
Created with the Codex harness using gpt-5.6-sol.
Note
Medium Risk
Touches Claude session startup and capability probing, including abort-during-import cleanup. Behavior is otherwise unchanged, but SDK failures now appear later than module load.
Overview
Stops evaluating @anthropic-ai/claude-agent-sdk when Claude adapter/provider modules load. Type imports stay static; query is dynamic-imported only when starting a session or probing capabilities.
Session start now uses Effect.tryPromise with abort handling so an interrupted lazy import does not call query. Injected createQuery is unchanged.
Adds a module-load regression test and an interrupt test covering the abort path. SDK load failures now surface at first Claude use instead of import time.
Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 20ebbc412af467614aea27a77549a6447f9feace. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).
Note
Defer loading @anthropic-ai/claude-agent-sdk until session start in ClaudeAdapter#
- Changes
ClaudeAdapter and ClaudeProvider to import only types from the Claude SDK at module load, and dynamically import() the query value inside Effect.tryPromise when a session starts or capabilities are probed.
- Starting a Claude session now checks the abort signal before and after the dynamic import, and closes the runtime exactly once if interrupted during loading.
- Adds tests asserting the adapter module imports without touching the SDK, and that interrupting
startSession mid-import prevents query from being called.
- Risk:
createQuery is no longer passed the statically imported query as a default; callers that relied on the old default in ClaudeAdapter.ts must supply it via options or rely on the new dynamic import path.
Macroscope summarized 20ebbc4.
Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
56e718d0-128d-4665-b59f-6761405d3cb3You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
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