Skip to content

fix: drop a broken 5.5 thinking chain - #500

Merged
dofastted merged 2 commits into
mainfrom
fix/thinking-chain-183
Oct 17, 2026
Merged

dofastted merged 2 commits into
mainfrom
fix/thinking-chain-183

Conversation

@dofastted

@dofastted dofastted commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Opus / Sonnet / Haiku 5.5 出站过滤对齐 sub2api:一块无效 thinking 或 redacted 块拆掉整段签名历史,空轮删除。
  • 没有 type 但带 thinking 字段的块也算无效。redacted_thinking 有 data 就留,否则看签名。
  • 版本 1.3.183。cli-hop 首跳和默认 HTTP 保留路径不变。

Test

  • anthropic-policy、cli-hop-body、mid-convo-effort:79 pass。

Note

Medium Risk
Changes outbound message shaping for Anthropic 5.5 thinking history on the default (non-preserve) path; misclassification could strip valid chains or leave bad blocks, affecting multi-turn adaptive-thinking sessions.

Overview
Release 1.3.183 tightens outbound thinking / redacted_thinking sanitization for Opus, Sonnet, and Haiku 5.5, matching sub2api behavior documented in docs/PROTOCOL.md.

On 5.5 models, stripInvalidThinkingBlocks now treats any non-empty, non-dummy signature as valid (no 24-character cutoff). redacted_thinking is kept when it has data, otherwise when its signature passes the same rules. If history contains one invalid block—including blocks without type but with a thinking field—the gateway strips the entire signed thinking chain (all later thinking / redacted_thinking), leaves only visible text, and drops turns that end up empty. When every block is valid, nothing is chain-stripped. Older models still use per-block filtering with the 24-character signature rule; redacted_thinking without long signatures is dropped as before.

cli-hop first hop and default HTTP paths that set preserveThinkingBlocks: true are unchanged (still pad missing signature without chain teardown). Unit tests in anthropic-policy, cli-hop-body, and mid-convo-effort cover chain drops, short signatures on 5.5, and preserve-path behavior.

Reviewed by Cursor Bugbot for commit cdf8b37. Configure here.

Opus, Sonnet, and Haiku 5.5 now follow sub2api: one invalid thinking or redacted block removes the whole signed history. A redacted block stays on data, or on a usable signature when data is absent.
A content block with a thinking field and no type is invalid, matching sub2api. On 5.5 it now drops the signed history that follows it.
@dofastted
dofastted merged commit 20352d1 into main Oct 17, 2026
8 checks passed
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.

1 participant