Skip to content

[Bug] @ai-sdk/azure Responses API: encrypted content verification fails after 3-4 tool-calling turns (store: false) #29879

Description

@samuel-pullely

Description

Using @ai-sdk/azure with the Responses API in stateless mode (store: false enforced server-side), multi-turn sessions consistently fail after 3-4 tool-calling turns with:

{
  "error": {
    "message": "The encrypted content gAAA...= could not be verified. Reason: Encrypted content could not be decrypted or parsed.",
    "type": "invalid_request_error",
    "param": null,
    "code": "invalid_encrypted_content"
  }
}

This happens on a fresh session with GPT-5.5 (gpt-5.5-2026-04-24) after just a few tool calls. It's 100% reproducible.

Environment

  • OpenCode v1.15.12
  • Provider: @ai-sdk/azure with custom baseURL pointing to an Azure OpenAI-compatible gateway
  • Model: gpt-5.5-2026-04-24
  • store: false enforced by the backend (stateless mode, no data retention)
  • Responses API endpoint: /responses?api-version=2025-04-01-preview

Config (relevant section)

{
  "npm": "@ai-sdk/azure",
  "options": {
    "baseURL": "http://localhost:9000/openai",
    "apiKey": "key",
    "apiVersion": "2025-04-01-preview"
  },
  "models": {
    "gpt-5.5-2026-04-24": {
      "name": "GPT-5.5",
      "modalities": {
        "input": ["text", "image"],
        "output": ["text"]
      }
    }
  }
}

Steps to Reproduce

  1. Configure a custom provider using @ai-sdk/azure with a backend that enforces store: false
  2. Start a new session with GPT-5.5
  3. Send a prompt that triggers multiple tool calls (e.g., any multi-step task requiring 3+ tool invocations)
  4. After 3-4 successful Responses API round-trips, the next request fails with invalid_encrypted_content

Analysis

PRs #28678 and #29000 fixed similar issues for the @ai-sdk/openai path (preserving native continuation metadata, splitting reasoning summary blocks). However, these fixes may not cover the @ai-sdk/azure code path.

The @ai-sdk/azure SDK's createResponsesModel is used (default provider.languageModel), and include: ["reasoning.encrypted_content"] is set by OpenCode's transform layer. The encrypted blob returned in one response is passed back in subsequent requests but becomes unverifiable after a few turns.

Possibly related closed issues:

Expected Behavior

Multi-turn sessions with tool calling should work beyond 3-4 turns without encrypted content verification failures when using @ai-sdk/azure with store: false.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions