Skip to content

[BUG] Forking an existing session replays incompatible reasoning.encrypted_content #37444

Closed as not planned

Description

@wr-web

Description

After forking an older session, continuing with the same reasoning model failed with:

encrypted content missing recognized prefix (expected `rsn_` or `smry_`)

A new session with the same model worked, and switching the fork to another model also worked. Clearing the OpenCode cache did not change the result.

Environment

  • OpenCode: 1.17.20
  • OS: macOS
  • Provider: custom provider using @ai-sdk/openai
  • Provider ID: matrix
  • Model: matrix/gpt-5.6-sol
  • API: OpenAI Responses-compatible endpoint

Relevant redacted configuration:

{
  "model": "matrix/gpt-5.6-sol",
  "provider": {
    "matrix": {
      "npm": "@ai-sdk/openai",
      "options": {
        "baseURL": "https://<redacted>/v1",
        "apiKey": "<redacted>"
      },
      "models": {
        "gpt-5.6-sol": {
          "id": "gpt-5.6-sol",
          "options": {
            "reasoning": {
              "effort": "high"
            }
          }
        }
      }
    }
  }
}

Steps to reproduce

  1. Open an existing session that contains reasoning output from the model above.
  2. Fork the session from an earlier user message.
  3. Continue the new fork with the same model.
  4. The request fails with the encrypted-content prefix error.

Actual behavior

The fork copies the source reasoning part's provider metadata, including itemId and reasoningEncryptedContent. The copied encrypted state is replayed from the new session and rejected by the endpoint.

Expected behavior

The fork should retain the visible conversation and reasoning summary, but it should not reuse opaque reasoning continuation state from the source session.

Verification

I tested a local patch against a backup of the affected OpenCode database:

  • Before the patch, a new fork reproduced the error.
  • After removing itemId and reasoningEncryptedContent from copied reasoning metadata, a new fork continued successfully with the same model.
  • The source session remained unchanged.

The patch also includes a regression test covering source-session preservation and fork metadata sanitization.

Activity

  1. added
    needs:complianceThis means the issue will auto-close after 2 hours.
    and removed
    needs:complianceThis means the issue will auto-close after 2 hours.
    on Jul 17, 2026
  2. github-actions commented on Jul 17, 2026

    @github-actions
    Contributor

    Thanks for updating the issue! It now meets our contributing guidelines — the bug report is clear, includes environment details, reproduction steps, and a verified patch. We appreciate the thorough write-up.

  3. github-actions commented on Sep 17, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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