Skip to content

feat(agent): Sync claude adapter with upstream v0.44.0#2593

Merged
charlesvien merged 3 commits into
mainfrom
06-11-feat_agent_sync_claude_adapter_with_upstream_v0.44.0
Jun 11, 2026
Merged

feat(agent): Sync claude adapter with upstream v0.44.0#2593
charlesvien merged 3 commits into
mainfrom
06-11-feat_agent_sync_claude_adapter_with_upstream_v0.44.0

Conversation

@charlesvien

@charlesvien charlesvien commented Jun 11, 2026

Copy link
Copy Markdown
Member

Problem

The claude adapter fork is behind upstream v0.44.0, most notably missing the fix for assistant text being lost behind gateways that return a turn as a single non-streamed block.

Changes

  1. Bump claude-agent-sdk to 0.3.170 and anthropic SDK to 0.104.1
  2. Forward un-streamed assistant text/thinking blocks via per-turn streamed-block tracker
  3. No-op the new fallback content block instead of tripping unreachable
  4. Stub the new usage_EXPERIMENTAL Query method in the SDK test mock
  5. Skip upstream's elicitation feature (conflicts with AskUserQuestion divergence)
  6. Update UPSTREAM.md with v0.44.0 ported/skipped notes

How did you test this?

Automatic notifications

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

charlesvien commented Jun 11, 2026

Copy link
Copy Markdown
Member Author

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 78f207b.

@greptile-apps

greptile-apps Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

T-Rex T-Rex Logs

What T-Rex did

  • Generated focused edge-case checks for the Claude ACP conversion of streamed and assembled assistant blocks.
  • Exercised edge-case scenarios including assembled text without deltas, duplicate streamed text, mixed text/thinking streaming, missing message_start, subagent deltas, multiple message IDs, empty IDs, and the new fallback block type.
  • The focused checks passed, and the existing conversion tests also passed.
  • No dropped or duplicated assistant content was reproduced in those conversion paths.
  • Created sdk-to-acp-edge.test.ts with 12 targeted tests exercising the hypothesis edge cases.
  • Ran pnpm vitest run in packages/agent; all 12 tests passed (exit 0).
  • Confirmed existing 15 tests in sdk-to-acp.test.ts also passed.
  • No content is dropped or duplicated in any tested scenario.
  • The fallback content block type (SDK 0.3.170) is handled by the existing case in processContentChunk, with no crash.
  • Empty message id ("") correctly becomes undefined via || undefined, preventing false matches in streamed ID sets.

View all artifacts

T-Rex Ran code and verified through T-Rex

Comments Outside Diff (1)

  1. packages/agent/src/adapters/claude/claude-agent.ts, line 994 (link)

    P1 Handle fallback retractions

    SDK 0.3.170 assistant messages can now include supersedes for refusal fallback replacement, and the matching model_refusal_fallback system message can carry retracted_message_uuids. Those fields mean previously delivered refused chunks or tombstoned tool results should be evicted. This path renders the replacement assistant message, but nothing in the prompt loop or handleSystemMessage removes the retracted messages, so a refusal fallback can leave stale refused content visible in the transcript or persisted session log alongside the canonical fallback answer.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: packages/agent/src/adapters/claude/claude-agent.ts
    Line: 994
    
    Comment:
    **Handle fallback retractions**
    
    SDK 0.3.170 assistant messages can now include `supersedes` for refusal fallback replacement, and the matching `model_refusal_fallback` system message can carry `retracted_message_uuids`. Those fields mean previously delivered refused chunks or tombstoned tool results should be evicted. This path renders the replacement assistant message, but nothing in the prompt loop or `handleSystemMessage` removes the retracted messages, so a refusal fallback can leave stale refused content visible in the transcript or persisted session log alongside the canonical fallback answer.
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
packages/agent/src/adapters/claude/claude-agent.ts:994
**Handle fallback retractions**

SDK 0.3.170 assistant messages can now include `supersedes` for refusal fallback replacement, and the matching `model_refusal_fallback` system message can carry `retracted_message_uuids`. Those fields mean previously delivered refused chunks or tombstoned tool results should be evicted. This path renders the replacement assistant message, but nothing in the prompt loop or `handleSystemMessage` removes the retracted messages, so a refusal fallback can leave stale refused content visible in the transcript or persisted session log alongside the canonical fallback answer.

Reviews (1): Last reviewed commit: "feat(agent): Sync claude adapter with up..." | Re-trigger Greptile

@charlesvien charlesvien force-pushed the 06-06-add-crash-telemetry branch from 98b3e03 to b843675 Compare June 11, 2026 08:08
@charlesvien charlesvien force-pushed the 06-11-feat_agent_sync_claude_adapter_with_upstream_v0.44.0 branch from b815015 to 1430655 Compare June 11, 2026 08:08
@charlesvien charlesvien changed the base branch from 06-06-add-crash-telemetry to graphite-base/2593 June 11, 2026 08:47
@charlesvien charlesvien force-pushed the 06-11-feat_agent_sync_claude_adapter_with_upstream_v0.44.0 branch from 1430655 to 0cefecf Compare June 11, 2026 09:03
@graphite-app graphite-app Bot changed the base branch from graphite-base/2593 to main June 11, 2026 09:04
@charlesvien charlesvien force-pushed the 06-11-feat_agent_sync_claude_adapter_with_upstream_v0.44.0 branch from 0cefecf to 78f207b Compare June 11, 2026 09:04
@charlesvien charlesvien merged commit db3f9d3 into main Jun 11, 2026
24 checks passed

Copy link
Copy Markdown
Member Author

Merge activity

@charlesvien charlesvien deleted the 06-11-feat_agent_sync_claude_adapter_with_upstream_v0.44.0 branch June 11, 2026 09:13
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