Skip to content

feat: Sync Claude ACP adapter to v0.30.0 (SDK 0.2.112)#1748

Merged
charlesvien merged 5 commits intomainfrom
04-20-sync_claude_acp_adapter_to_v0.30.0_sdk_0.2.114_
Apr 21, 2026
Merged

feat: Sync Claude ACP adapter to v0.30.0 (SDK 0.2.112)#1748
charlesvien merged 5 commits intomainfrom
04-20-sync_claude_acp_adapter_to_v0.30.0_sdk_0.2.114_

Conversation

@charlesvien
Copy link
Copy Markdown
Member

@charlesvien charlesvien commented Apr 21, 2026

Problem

Adapter was pinned to v0.22.2 and missing several upstream fixes and features from the Claude ACP reference implementation.

Closes #1692

Changes

  1. Bump claude-agent-sdk to 0.2.112, ACP SDK to 0.19.0 and anthropic SDK to 0.89.0
  2. Add null-safe guards on all usage token fields from SDK
  3. Fix SettingsManager race condition with initPromise to prevent concurrent initialize()/setCwd() corruption
  4. Add idle state (session_state_changed) as end-of-turn signal via CLAUDE_CODE_EMIT_SESSION_STATE_EVENTS=1
  5. Fire mid-stream usage_update from message_start/message_delta events
  6. Add emitRawSDKMessages opt-in for raw SDK message relay
  7. Add xhigh effort level and call applyFlagSettings on effort changes
  8. Log warning for non-ENOENT settings file errors instead of silently swallowing

How did you test this?

Manually

@charlesvien charlesvien changed the title Sync Claude ACP adapter to v0.30.0 (SDK 0.2.114) feat: Sync Claude ACP adapter to v0.30.0 (SDK 0.2.114) Apr 21, 2026
Copy link
Copy Markdown
Member Author

charlesvien commented Apr 21, 2026

@charlesvien charlesvien marked this pull request as ready for review April 21, 2026 03:10
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 21, 2026

Prompt To Fix All With AI
This is a comment left during a code review.
Path: packages/agent/src/adapters/claude/claude-agent.ts
Line: 595

Comment:
**Missing null-coalescing on `output_tokens` in `message_delta` handler**

Every other field in this block uses `?? lastStreamUsage.<field>` as a fallback, but `output_tokens` is assigned directly from `u.output_tokens`. If the SDK returns `null` here (the entire motivation for the null-safe guards in this PR), `lastStreamUsage.output_tokens` will silently become `null`, and `nextTotal` will be computed incorrectly since `null` coerces to `0` in JS arithmetic — dropping any previously accumulated output token count from the total.

```suggestion
                  output_tokens: u.output_tokens ?? lastStreamUsage.output_tokens,
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: packages/agent/src/adapters/claude/claude-agent.ts
Line: 1408-1411

Comment:
**Inconsistent `void` vs `await` for `applyFlagSettings`**

The first call to `applyFlagSettings` (when setting a new effort level) is `await`ed, but the reset path here and the `syncEffort` path (a few lines below) use `void` instead. If `applyFlagSettings` fails silently in the reset or sync paths, the SDK effort level state could diverge from `this.session.effort` without any observable error. Consider using `await` (or at minimum being intentional and adding a comment) for consistency.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "Sync Claude ACP adapter to v0.30.0 (SDK ..." | Re-trigger Greptile

Comment thread packages/agent/src/adapters/claude/claude-agent.ts
Comment thread packages/agent/src/adapters/claude/claude-agent.ts
@charlesvien charlesvien changed the title feat: Sync Claude ACP adapter to v0.30.0 (SDK 0.2.114) feat: Sync Claude ACP adapter to v0.30.0 (SDK 0.2.112) Apr 21, 2026
@charlesvien charlesvien force-pushed the 04-20-sync_claude_acp_adapter_to_v0.30.0_sdk_0.2.114_ branch from 7f338d1 to 65b74b6 Compare April 21, 2026 03:56
@charlesvien charlesvien force-pushed the 04-20-misc-bugs-n-nits branch from 6192199 to ff740e2 Compare April 21, 2026 18:57
@charlesvien charlesvien force-pushed the 04-20-sync_claude_acp_adapter_to_v0.30.0_sdk_0.2.114_ branch 3 times, most recently from 3687000 to 9b5f5ee Compare April 21, 2026 19:28
@charlesvien charlesvien changed the base branch from 04-20-misc-bugs-n-nits to graphite-base/1748 April 21, 2026 19:46
@charlesvien charlesvien force-pushed the 04-20-sync_claude_acp_adapter_to_v0.30.0_sdk_0.2.114_ branch from 9b5f5ee to 96d7541 Compare April 21, 2026 19:46
@graphite-app graphite-app Bot changed the base branch from graphite-base/1748 to main April 21, 2026 19:47
@charlesvien charlesvien force-pushed the 04-20-sync_claude_acp_adapter_to_v0.30.0_sdk_0.2.114_ branch from 96d7541 to 79e0837 Compare April 21, 2026 19:47
@charlesvien charlesvien merged commit b548a39 into main Apr 21, 2026
15 of 16 checks passed
Copy link
Copy Markdown
Member Author

Merge activity

@charlesvien charlesvien deleted the 04-20-sync_claude_acp_adapter_to_v0.30.0_sdk_0.2.114_ branch April 21, 2026 19:57
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.

Missing extra high reasoning on codex

2 participants