feat(provider): exact signed-thinking capture, persistence and replay (incl. Bedrock)
维护者通常 1 天内回复
@aheritier 已经在做这个了。
开始于 2026年10月19日。
评估
这个 Issue 还没有评估数据。
描述
Goal
Capture, persist and replay signed thinking exactly, on all three transports. If the stored state can't be trusted, refuse to continue instead of replaying a rebuilt version.
Why
- Bedrock flattens reasoning into text + signature fields (adapter.go) and rebuilds the blocks later. It treats a signature without text as redacted content (convert.go), but a signed thinking block can legitimately have empty text. Order between thinking, text and tool calls is also rebuilt rather than preserved.
thinkingBindingBehaviorpicksdrop_blockautomatically when the primary or any fallback checks thinking prefixes (thinking_binding.go). The preserved thinking docs makeerrorthe default and describedrop_blockas a stopgap that can cost extra output tokens. Switching the default is a deliberate client policy change.- The Anthropic client already stores raw response blocks in
ProviderStateand replays them when they still describe the message (response_content.go). Extend that mechanism; don't create a second one.
Scope
- Keep blocks in order with their index: thinking (including signed-empty), redacted thinking bytes, text, tool use IDs/inputs and tool results. No "last signature wins".
- Extend
ProviderStateadditively with a version and the serving model. Unknown versions, incomplete or interrupted streams are never replayed as if they were verified. - Bedrock: store and replay native reasoning blocks instead of rebuilding them from flattened fields.
- Keep the Haiku 5.5 exceptions from #4553 and only those: when thinking is off on Direct/Vertex, omit earlier reasoning from the outgoing request; on Converse, omit it with a warning. Stored history is never modified, and turning thinking back on does not silently re-insert omitted blocks.
- Make
thinking_prefix_mismatch: errorthe default for 5.x models whose server checks thinking prefixes (moved from #4652). Usingdrop_blockthen requires explicit config, keeps logging the dropped paths, and never triggers an automatic retry with thinking removed. Use the native binding control only on the Messages API, where it is documented; don't invent an equivalent for Converse. drop_block, when explicitly configured, never deletes the stored original.
Acceptance criteria
- Round-trip tests per transport: stream →
ProviderState→ SQLite and JSON → new runtime → continue an unchanged tool conversation; the replayed request matches the original blocks byte for byte. - Signed-empty thinking, redacted thinking and interleaved thinking/text/tool calls survive the round trip.
- Edited or trimmed history, an imported session and an unknown state version lead to a clear refusal or a documented fallback, never to a silently rebuilt replay.
- Default
erroron prefix-checking 5.x models, explicitdrop_blockwith diagnostics, legacy models unchanged. A session usingnum_history_itemstrimming either replays exactly or fails with a clear refusal, never a raw 400. - Older binaries reading the new state: the limitation is documented (no promise of transparent downgrade).
-
task build,task test,task lint, andgo test -raceon the touched packages pass.
Parent: #4583 · Depends on #4651
- 主要语言
- Go
- 星标
- 4.6k
- 派生
- 522
- 平均合并
- 8 小时 7 分钟
- 30 天内合并 PR
- 231
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
docker/docker-agent 的其他 Issue
-
area/cli
难度 2/5 1-3 小时 新手友好度 62/100
docker/docker-agent#4672 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
pkg/hooks tests fail with a misleading assertion when jq is not installed可能已有人在做 @dwin-gharibi 于 58 天前认领。 未关闭area/testing
难度 2/5 1-3 小时 新手友好度 86/100
docker/docker-agent#4052 ·
维护者通常 1 天内回复
-
`remove_directory` and `create_directory` hide work they already did when a later path fails可能已有人在做 @dwin-gharibi 于 76 天前认领。 未关闭area/tools
难度 2/5 1-3 小时 新手友好度 85/100
docker/docker-agent#3933 ·
维护者通常 1 天内回复
-
`edit_file` silently edits the first match when `oldText` occurs more than once可能已有人在做 @dwin-gharibi 于 76 天前认领。 未关闭area/tools
难度 2/5 1-3 小时 新手友好度 78/100
docker/docker-agent#3929 · 2 条评论 ·
维护者通常 1 天内回复
-
area/providers/anthropic area/runtime area/tools
难度 4/5 3-5 天 新手友好度 48/100
docker/docker-agent#4671 ·
维护者通常 1 天内回复
查看 docker/docker-agent 的全部 Issue
相似的 Issue
-
Mend: dependency security vulnerability
难度 2/5 1-3 小时 新手友好度 72/100
kube-tarian/sigrun#202 ·
-
question raised-by:verifier
难度 2/5 1-3 小时 新手友好度 72/100
medici-finance/assay#4013 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 83/100
tsukumogami/tsuku#2775 ·
维护者通常 1 天内回复
-
automation models
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 69/100
维护者通常 1 天内回复