Skip to content

BUG: Compaction fails on first attempt — thinking blocks mutation error #264

Description

@jacktrnr

Summary

Compacting an autoresearch session fails on the first attempt with: "The model returned the following errors: messages.3.content.2: thinking or redacted_thinking blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the original response." Retrying immediately succeeds.

Context

harmoniqs.amicode@0.3.0; Darwin 25.6.0 arm64; engine base v1.18.10-amicode.17 (harmoniqs/opencode). Observed during an autoresearch session compaction.

Expected vs actual

  • Expected: Compaction succeeds on the first attempt.
  • Actual: First attempt errors because the compaction pass mutates or reorders thinking/redacted_thinking blocks in the latest assistant message before sending to the API. A second attempt works (likely because the errored message is dropped or the thinking blocks are no longer the "latest" after the retry).
Diagnostics
  • macOS 25.6.0 arm64, extension v0.3.0, engine v1.18.10-amicode.17
  • error source: Anthropic API 400 response rejecting modified thinking blocks

intake: not-ready — mature per the maturity contract before picking up
suggested_path: A
diagnostics: inline
upstream: anomalyco/opencode#41738 (open), anomalyco/opencode#39291 (open)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions