Skip to content

feat(agent): Sync Claude ACP adapter with upstream v0.42.0#2513

Open
charlesvien wants to merge 4 commits into
06-06-package_updatesfrom
06-06-claude-adapter-upgrade
Open

feat(agent): Sync Claude ACP adapter with upstream v0.42.0#2513
charlesvien wants to merge 4 commits into
06-06-package_updatesfrom
06-06-claude-adapter-upgrade

Conversation

@charlesvien

@charlesvien charlesvien commented Jun 6, 2026

Copy link
Copy Markdown
Member

Problem

Our fork of @anthropic-ai/claude-agent-acp lagged upstream by three releases (v0.39→v0.42), missing SDK fixes (Opus refusal handling, wedged-cancel hangs) and a breaking ACP SDK model-API removal.

Changes

  1. Bump claude-agent-sdk 0.3.156→0.3.165 and @agentclientprotocol/sdk 0.22.1→0.25.0
  2. Migrate off the removed ACP model-state API to config-options (incl. codex adapter)
  3. Port refusal handling, commands_changed, and new SDK messages (tool_progress / rate_limit / permission_denied / mirror_error)
  4. Port fixes: force-cancel backstop for wedged SDK, cross-family model match, cwd validation, marker-strip perf
  5. Prune the never-cleared tool-use cache; refresh post-compaction usage via getContextUsage
  6. Update UPSTREAM.md and add a reusable SKILL.md upgrade runbook

How did you test this?

Manually

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

charlesvien commented Jun 6, 2026

Copy link
Copy Markdown
Member Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@charlesvien charlesvien changed the title update claude adapter with upstream feat(agent): update claude adapter with upstream Jun 6, 2026
@charlesvien charlesvien changed the title feat(agent): update claude adapter with upstream feat(agent): Sync Claude ACP adapter with upstream v0.42.0 Jun 6, 2026
@charlesvien charlesvien marked this pull request as ready for review June 6, 2026 23:47
@greptile-apps

greptile-apps Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

T-Rex T-Rex Logs

What T-Rex did

  • Targeted tests were generated for Claude alias matching, Opus model capability flags, marker stripping, refusal extraction, Codex model config extraction, and Codex config normalization.
  • All 29 generated checks passed.
  • Existing Claude and Codex model test suites passed with no regressions.
  • The model context-hint guard prevents context-only cross-family matches, and the marker scanner handles unclosed tags, unknown tags, empty tags, nested-like content, and pathological input.
  • Three targeted test files were created: models.trex.test.ts (Claude), sdk-to-acp.trex.test.ts (conversion), and models.trex.test.ts (Codex), containing 29 total test cases.
  • All 29 tests passed when running vitest from packages/agent with verbose output.
  • Existing model test suites for Claude and Codex passed with no regressions.
  • The stripMarkerTags pathological input test shows the new single-pass scanner completes in under 1ms for 1000 repeated open tags, avoiding catastrophic backtracking.
  • The scoreModelMatch context-hint guard returns score 0 when only the context hint (for example, '1m') matches but no family/name token does.
  • modelIdFromConfigOptions correctly handles null, undefined, non-string currentValue, and missing model category.
Artifacts

Verbose output from 29 generated targeted tests

  • Shows the 29 targeted checks generated for Claude alias matching, Opus model capability flags, marker stripping, refusal extraction, Codex model config extraction, and Codex config normalization.

Existing model test suite output

  • Shows Claude and Codex model test suites ran with no regressions.

Generated Claude model tests

  • Contains the newly generated Claude model tests.

Generated SDK-to-ACP conversion tests

  • Contains the SDK-to-ACP conversion tests.

Generated Codex model tests

  • Contains the Codex model tests.

Verbose output from 29 T-Rex-generated tests

  • Confirms all 29 tests passed and shows duration.

Existing model test suites pass with no regressions

  • Shows claude and codex test suites passed with no regressions.

T-Rex Ran code and verified through T-Rex

Prompt To Fix All With AI
Fix the following 3 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 3
packages/agent/src/adapters/claude/claude-agent.ts:1050-1074
**Use ACP session id**

These new updates are sent with `message.session_id`, but the client routes ACP notifications by the active ACP session id. In this adapter those ids can differ because the adapter creates its own ACP session id and the SDK message carries the Claude SDK session id. When a long-running tool emits progress, the update can be sent to a session the client is not rendering, so the visible tool call keeps looking stalled. The same applies to the rate-limit update.

### Issue 2 of 3
packages/agent/src/adapters/claude/conversion/sdk-to-acp.ts:795-797
**Route denial updates correctly**

This sends the permission-denied tool update to the SDK session id instead of the ACP session id from `context`. The original tool call is emitted under the ACP session, so when a permission rule denies the tool, the failure update can be dropped or routed elsewhere. The user then sees a tool call that never resolves instead of the permission-denied message.

### Issue 3 of 3
packages/agent/src/adapters/claude/claude-agent.ts:626-634
**Refresh skills baseline**

This mid-session command update refreshes the visible command list, but it skips the same skills-token baseline update done by `sendAvailableCommandsUpdate`. When skills or plugin commands are discovered during a session, the command list changes while the context breakdown keeps the old skills estimate. Later usage breakdown notifications can show stale skills context even though the session has the new commands.

Reviews (1): Last reviewed commit: "update claude adapter with upstream" | Re-trigger Greptile

Comment thread packages/agent/src/adapters/claude/claude-agent.ts
Comment thread packages/agent/src/adapters/claude/conversion/sdk-to-acp.ts
Comment thread packages/agent/src/adapters/claude/claude-agent.ts
@charlesvien charlesvien force-pushed the 06-06-claude-adapter-upgrade branch 3 times, most recently from 8c6bc8d to fec00b8 Compare June 8, 2026 00:53
@charlesvien charlesvien force-pushed the 06-06-package_updates branch from c7bf83f to c505ae8 Compare June 8, 2026 00:53
@charlesvien charlesvien force-pushed the 06-06-claude-adapter-upgrade branch from fec00b8 to a51aca3 Compare June 9, 2026 01:37
@charlesvien charlesvien force-pushed the 06-06-package_updates branch from c505ae8 to 978596d Compare June 9, 2026 01:37
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit da4b88a.

@charlesvien charlesvien force-pushed the 06-06-claude-adapter-upgrade branch from a51aca3 to da4b88a Compare June 9, 2026 02:01
@charlesvien charlesvien force-pushed the 06-06-package_updates branch from 978596d to f71d76f Compare June 9, 2026 02:01
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