Skip to content
Source
Sign inSign up
TanStack/ai

fix(ai-anthropic): give Sonnet 5.5 and Haiku 5.5 their mid-conversation channels #2200

Mergedjperasmus(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/2200/headmerged by AlemTuzlak View on GitHub

🎯 Changes

Fixes #2154.

claude-sonnet-5-5 and claude-haiku-5-5 had no supports.mid_conversation_channels, so ANTHROPIC_MODEL_MID_CONVERSATION_CHANNELS left them out. On both models, a tool or system prompt added during a conversation rewrote the start of the request and missed the prompt cache, even with midConversationChannels: true.

Anthropic's mid-conversation system messages page lists both models for system messages, and says tool changes "are in beta on the same models". Sonnet 5 is still excluded there, so it stays out of the map.

  • model-meta.ts: both models get { tools: true, systemPrompts: true } and a row in the map.
  • Unit tests: the map test lists seven models. The "outside the map" cases now use claude-sonnet-5, because claude-sonnet-5-5 is in the map.
  • E2E (mid-conversation-changes-wire): the Claude channel test runs on Opus 5.5, Sonnet 5.5 and Haiku 5.5. The no-channel case uses claude-sonnet-5.
  • Docs: both model lists name the two models.

One note for reviewers: the same docs page says Sonnet 5.5 and Haiku 5.5 can ignore a system message placed right after a tool result when it relays the user's words. It recommends a text block in the user turn for those. Harness notices stay in a separate system message after that turn, which is where chat() puts an added system prompt, so this PR does not change placement.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with pnpm run test:pr, or these tests do not apply to this pull request.
  • I fully understand the code in this pull request, including any code generated with AI assistance.
  • Docs: I updated docs/ for this change, or this change is not user-facing.
  • Changeset: I added a changeset (pnpm changeset), or this PR does not change a published package.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Claude Sonnet 5.5 and Haiku 5.5 now support adding tools and system prompts during a conversation while preserving the cached request start.
  • Documentation
    • Updated model support information for mid-conversation changes.
    1. 🦋 Changeset detected

      Latest commit: 40800a23f6240fdc4880bb71c355a0c0983b6e00

      The changes in this PR will be included in the next version bump.

      This PR includes changesets to release 1 package
      NameType
      @tanstack/ai-anthropicPatch

      Not sure what this means? Click here to learn what changesets are.

      Click here if you're a maintainer who wants to add another changeset to this PR

    2. Explain Change →

      No actionable comments were generated in the recent review.

      Walkthrough

      Claude Sonnet 5.5 and Haiku 5.5 now appear in Anthropic’s mid-conversation channel metadata. Tests and documentation include the updated model coverage.

      Changes: Anthropic channel support

      Layer / File(s)Summary
      Register mid-conversation channel support
      packages/ai-anthropic/src/model-meta.ts, packages/ai-anthropic/tests/mid-conversation-changes.test.ts, docs/adapters/anthropic-advanced.md, docs/advanced/mid-conversation-changes.md, .changeset/anthropic-5-5-mid-conversation-channels.md
      Sonnet 5.5 and Haiku 5.5 now declare mid-conversation channel support and appear in the channel lookup. Unit tests and documentation include the updated model coverage.
      Extend wire test coverage
      testing/e2e/src/routes/api.mid-conversation-changes-wire.ts, testing/e2e/tests/mid-conversation-changes-wire.spec.ts
      The route includes Sonnet 5 and Haiku 5.5 cases with midConversationChannels: true. Wire tests exercise tool additions for Opus, Sonnet, and Haiku 5.5, and use Sonnet 5 for the no-channel case.

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix · Severity of issue fixed: Medium

      Suggested reviewers: alemtuzlak

      Merge Risk: Minimal · up to 40800

      This change makes the Claude Sonnet 5.5 and Haiku 5.5 models use mid-conversation channels when enabled, so adding tools or system prompts mid-conversation no longer breaks the prompt cache. Docs and tests are updated to match. No merge-blocking risk was identified.

      Pre-merge checks: Passed 4

      Check nameStatusExplanation
      Title checkPassedThe title names the main change: adding Sonnet 5.5 and Haiku 5.5 to the mid-conversation channel map and metadata in the ai-anthropic package. The changeset, model metadata, tests, E2E coverage, and d…
      Description checkPassedThe description follows the template. It covers the change and its reason, and it explains why Sonnet 5 stays out of the map. It also lists tests, E2E coverage, and docs. All checklist items are marke…
      Linked Issues checkPassedIssue #2154 requires claude-sonnet-5-5 and claude-haiku-5-5 to resolve to { tools: true, systemPrompts: true } when midConversationChannels: true is set. At the reviewed head, `packages/ai-ant…
      Out of Scope Changes checkPassedChanges are limited to the issue scope or their direct support. Scope items: the model metadata and channel map in model-meta.ts, which the issue requests. Supporting items: the unit-test updates (m…
      Full details: Title check

      Explanation

      The title names the main change: adding Sonnet 5.5 and Haiku 5.5 to the mid-conversation channel map and metadata in the ai-anthropic package. The changeset, model metadata, tests, E2E coverage, and docs all match this. The title is short and specific.

      Full details: Description check

      Explanation

      The description follows the template. It covers the change and its reason, and it explains why Sonnet 5 stays out of the map. It also lists tests, E2E coverage, and docs. All checklist items are marked, and the release impact is set. The Changes section also gives a reviewer note about system message placement. The description has no major gaps.

      Full details: Linked Issues check

      Explanation

      Issue #2154 requires claude-sonnet-5-5 and claude-haiku-5-5 to resolve to { tools: true, systemPrompts: true } when midConversationChannels: true is set. At the reviewed head, packages/ai-anthropic/src/model-meta.ts adds mid_conversation_channels: { tools: true, systemPrompts: true } to CLAUDE_SONNET_5_5 and CLAUDE_HAIKU_5_5. Both models also get entries in ANTHROPIC_MODEL_MID_CONVERSATION_CHANNELS, which the constructor reads. This matches the Opus 5.5 pattern. The issue excludes Sonnet 5, and the PR leaves claude-sonnet-5 out of the map. The unit tests and E2E cases were updated to cover the new map entries. The issue asks for metadata and map changes only. No unmet coding requirement was found. The unit-test assertions were not executed during this review, so test results are not confirmed.

      Full details: Out of Scope Changes check

      Explanation

      Changes are limited to the issue scope or their direct support. Scope items: the model metadata and channel map in model-meta.ts, which the issue requests. Supporting items: the unit-test updates (map list and claude-sonnet-5 used for the outside-map cases), the E2E mid-conversation-changes-wire route and spec, the docs model lists, and the changeset. These support the new behavior and do not add unrelated functionality. The PR does not change message placement. The Anthropic text-block recommendation is noted but not implemented, which is consistent with the issue scope.

      Finishing Touches

      Generate unit tests (beta)

      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      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

      Recent review info

      Run configuration

      • Source mode: Auto
      • Repository: TanStack/ai
      • Branch: main
      • File: .coderabbit.yaml
      • Commit: fb6b041
      • Layers: Repository YAML
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: 3e8a8abb-a435-4447-a709-6d2fc36a1655
      Commits

      Reviewing files that changed from the base of the PR and between fb6b04185011ed831f04848af6fe439524ea3be6 and 40800a23f6240fdc4880bb71c355a0c0983b6e00.

      Files selected for processing: 7

      • .changeset/anthropic-5-5-mid-conversation-channels.md
      • docs/adapters/anthropic-advanced.md
      • docs/advanced/mid-conversation-changes.md
      • packages/ai-anthropic/src/model-meta.ts
      • packages/ai-anthropic/tests/mid-conversation-changes.test.ts
      • testing/e2e/src/routes/api.mid-conversation-changes-wire.ts
      • testing/e2e/tests/mid-conversation-changes-wire.spec.ts

      Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

    3. AlemTuzlak approved these changes

    4. AlemTuzlak turned on merge when ready (merge)

    5. View your CI Pipeline Execution ↗ for commit 40800a23f6240fdc4880bb71c355a0c0983b6e00

      CommandStatusDurationResult
      nx affected --targets=test:sherif,test:knip,tes...✅ Succeeded3m 7sView ↗
      nx run-many --targets=test:coverage --projects=...✅ Succeeded1sView ↗
      nx run-many --targets=build --exclude=examples/...✅ Succeeded10sView ↗

      💡 With Ultracache enabled, Nx Cloud learns each task's file inputs in CI and uses them on later runs. Turn on Ultracache in workspace settings ↗ · Read docs ↗


      ☁️ Nx Cloud last updated this comment at 2026-11-19 18:24:47 UTC

    6. Open in StackBlitz

      @tanstack/ai

      npm i https://pkg.pr.new/@tanstack/ai@2200

      @tanstack/ai-acp

      npm i https://pkg.pr.new/@tanstack/ai-acp@2200

      @tanstack/ai-angular

      npm i https://pkg.pr.new/@tanstack/ai-angular@2200

      @tanstack/ai-anthropic

      npm i https://pkg.pr.new/@tanstack/ai-anthropic@2200

      @tanstack/ai-bedrock

      npm i https://pkg.pr.new/@tanstack/ai-bedrock@2200

      @tanstack/ai-byteplus

      npm i https://pkg.pr.new/@tanstack/ai-byteplus@2200

      @tanstack/ai-claude-code

      npm i https://pkg.pr.new/@tanstack/ai-claude-code@2200

      @tanstack/ai-client

      npm i https://pkg.pr.new/@tanstack/ai-client@2200

      @tanstack/ai-cloudflare

      npm i https://pkg.pr.new/@tanstack/ai-cloudflare@2200

      @tanstack/ai-code-mode

      npm i https://pkg.pr.new/@tanstack/ai-code-mode@2200

      @tanstack/ai-code-mode-snippets

      npm i https://pkg.pr.new/@tanstack/ai-code-mode-snippets@2200

      @tanstack/ai-codex

      npm i https://pkg.pr.new/@tanstack/ai-codex@2200

      @tanstack/ai-cohere

      npm i https://pkg.pr.new/@tanstack/ai-cohere@2200

      @tanstack/ai-compaction

      npm i https://pkg.pr.new/@tanstack/ai-compaction@2200

      @tanstack/ai-computer-local

      npm i https://pkg.pr.new/@tanstack/ai-computer-local@2200

      @tanstack/ai-computer-playwright

      npm i https://pkg.pr.new/@tanstack/ai-computer-playwright@2200

      @tanstack/ai-computer-sandbox

      npm i https://pkg.pr.new/@tanstack/ai-computer-sandbox@2200

      @tanstack/ai-computer-use

      npm i https://pkg.pr.new/@tanstack/ai-computer-use@2200

      @tanstack/ai-devtools-core

      npm i https://pkg.pr.new/@tanstack/ai-devtools-core@2200

      @tanstack/ai-durable-stream

      npm i https://pkg.pr.new/@tanstack/ai-durable-stream@2200

      @tanstack/ai-effect

      npm i https://pkg.pr.new/@tanstack/ai-effect@2200

      @tanstack/ai-elevenlabs

      npm i https://pkg.pr.new/@tanstack/ai-elevenlabs@2200

      @tanstack/ai-event-client

      npm i https://pkg.pr.new/@tanstack/ai-event-client@2200

      @tanstack/ai-fal

      npm i https://pkg.pr.new/@tanstack/ai-fal@2200

      @tanstack/ai-gemini

      npm i https://pkg.pr.new/@tanstack/ai-gemini@2200

      @tanstack/ai-grok

      npm i https://pkg.pr.new/@tanstack/ai-grok@2200

      @tanstack/ai-grok-build

      npm i https://pkg.pr.new/@tanstack/ai-grok-build@2200

      @tanstack/ai-groq

      npm i https://pkg.pr.new/@tanstack/ai-groq@2200

      @tanstack/ai-harness

      npm i https://pkg.pr.new/@tanstack/ai-harness@2200

      @tanstack/ai-harness-cli

      npm i https://pkg.pr.new/@tanstack/ai-harness-cli@2200

      @tanstack/ai-isolate-cloudflare

      npm i https://pkg.pr.new/@tanstack/ai-isolate-cloudflare@2200

      @tanstack/ai-isolate-daytona

      npm i https://pkg.pr.new/@tanstack/ai-isolate-daytona@2200

      @tanstack/ai-isolate-e2b

      npm i https://pkg.pr.new/@tanstack/ai-isolate-e2b@2200

      @tanstack/ai-isolate-node

      npm i https://pkg.pr.new/@tanstack/ai-isolate-node@2200

      @tanstack/ai-isolate-quickjs

      npm i https://pkg.pr.new/@tanstack/ai-isolate-quickjs@2200

      @tanstack/ai-isolate-quickjs-bun

      npm i https://pkg.pr.new/@tanstack/ai-isolate-quickjs-bun@2200

      @tanstack/ai-llmgateway

      npm i https://pkg.pr.new/@tanstack/ai-llmgateway@2200

      @tanstack/ai-lovable

      npm i https://pkg.pr.new/@tanstack/ai-lovable@2200

      @tanstack/ai-mcp

      npm i https://pkg.pr.new/@tanstack/ai-mcp@2200

      @tanstack/ai-memory

      npm i https://pkg.pr.new/@tanstack/ai-memory@2200

      @tanstack/ai-mistral

      npm i https://pkg.pr.new/@tanstack/ai-mistral@2200

      @tanstack/ai-muse

      npm i https://pkg.pr.new/@tanstack/ai-muse@2200

      @tanstack/ai-neon

      npm i https://pkg.pr.new/@tanstack/ai-neon@2200

      @tanstack/ai-octane

      npm i https://pkg.pr.new/@tanstack/ai-octane@2200

      @tanstack/ai-ollama

      npm i https://pkg.pr.new/@tanstack/ai-ollama@2200

      @tanstack/ai-ollaya

      npm i https://pkg.pr.new/@tanstack/ai-ollaya@2200

      @tanstack/ai-openai

      npm i https://pkg.pr.new/@tanstack/ai-openai@2200

      @tanstack/ai-opencode

      npm i https://pkg.pr.new/@tanstack/ai-opencode@2200

      @tanstack/ai-openrouter

      npm i https://pkg.pr.new/@tanstack/ai-openrouter@2200

      @tanstack/ai-perplexity

      npm i https://pkg.pr.new/@tanstack/ai-perplexity@2200

      @tanstack/ai-persistence

      npm i https://pkg.pr.new/@tanstack/ai-persistence@2200

      @tanstack/ai-preact

      npm i https://pkg.pr.new/@tanstack/ai-preact@2200

      @tanstack/ai-react

      npm i https://pkg.pr.new/@tanstack/ai-react@2200

      @tanstack/ai-reactor

      npm i https://pkg.pr.new/@tanstack/ai-reactor@2200

      @tanstack/ai-remix

      npm i https://pkg.pr.new/@tanstack/ai-remix@2200

      @tanstack/ai-sandbox

      npm i https://pkg.pr.new/@tanstack/ai-sandbox@2200

      @tanstack/ai-sandbox-blaxel

      npm i https://pkg.pr.new/@tanstack/ai-sandbox-blaxel@2200

      @tanstack/ai-sandbox-boxd

      npm i https://pkg.pr.new/@tanstack/ai-sandbox-boxd@2200

      @tanstack/ai-sandbox-cloudflare

      npm i https://pkg.pr.new/@tanstack/ai-sandbox-cloudflare@2200

      @tanstack/ai-sandbox-daytona

      npm i https://pkg.pr.new/@tanstack/ai-sandbox-daytona@2200

      @tanstack/ai-sandbox-docker

      npm i https://pkg.pr.new/@tanstack/ai-sandbox-docker@2200

      @tanstack/ai-sandbox-e2b

      npm i https://pkg.pr.new/@tanstack/ai-sandbox-e2b@2200

      @tanstack/ai-sandbox-local-process

      npm i https://pkg.pr.new/@tanstack/ai-sandbox-local-process@2200

      @tanstack/ai-sandbox-railway

      npm i https://pkg.pr.new/@tanstack/ai-sandbox-railway@2200

      @tanstack/ai-sandbox-sprites

      npm i https://pkg.pr.new/@tanstack/ai-sandbox-sprites@2200

      @tanstack/ai-sandbox-upstash-box

      npm i https://pkg.pr.new/@tanstack/ai-sandbox-upstash-box@2200

      @tanstack/ai-sandbox-vercel

      npm i https://pkg.pr.new/@tanstack/ai-sandbox-vercel@2200

      @tanstack/ai-skills

      npm i https://pkg.pr.new/@tanstack/ai-skills@2200

      @tanstack/ai-solid

      npm i https://pkg.pr.new/@tanstack/ai-solid@2200

      @tanstack/ai-svelte

      npm i https://pkg.pr.new/@tanstack/ai-svelte@2200

      @tanstack/ai-typesafe

      npm i https://pkg.pr.new/@tanstack/ai-typesafe@2200

      @tanstack/ai-uthana

      npm i https://pkg.pr.new/@tanstack/ai-uthana@2200

      @tanstack/ai-utils

      npm i https://pkg.pr.new/@tanstack/ai-utils@2200

      @tanstack/ai-vercel-gateway

      npm i https://pkg.pr.new/@tanstack/ai-vercel-gateway@2200

      @tanstack/ai-vertex

      npm i https://pkg.pr.new/@tanstack/ai-vertex@2200

      @tanstack/ai-vue

      npm i https://pkg.pr.new/@tanstack/ai-vue@2200

      @tanstack/ai-worldlabs

      npm i https://pkg.pr.new/@tanstack/ai-worldlabs@2200

      @tanstack/openai-base

      npm i https://pkg.pr.new/@tanstack/openai-base@2200

      @tanstack/preact-ai-devtools

      npm i https://pkg.pr.new/@tanstack/preact-ai-devtools@2200

      @tanstack/react-ai-devtools

      npm i https://pkg.pr.new/@tanstack/react-ai-devtools@2200

      @tanstack/solid-ai-devtools

      npm i https://pkg.pr.new/@tanstack/solid-ai-devtools@2200

      @tanstack/svelte-ai-devtools

      npm i https://pkg.pr.new/@tanstack/svelte-ai-devtools@2200

      commit: 40800a2

    7. AlemTuzlak merged thisd0dfd86

    8. AlemTuzlak closed this

Sign in to join this conversation.