fix(agent): clear ordered thinking replay state on signature recovery - #70107
fix(agent): clear ordered thinking replay state on signature recovery#70107Eklps wants to merge 1 commit into
Conversation
|
Thanks for tracing the ordered-block replay channel. The premise holds on current main: Problems
Suggested changes
This is an automated hermes-sweeper review. |
SummaryTwo open PRs address the same invalid signed-thinking replay failure during signature recovery. #24407 strips thinking blocks from canonical messages, while #70107 clears both replay channels from API-time copies and preserves canonical history. Related pull requests
Duplicates#24407 and #70107 substantially overlap: both target repeated HTTP 400 failures caused by replayed signed thinking state during recovery. #24407 is the broader content-array variant; #70107 targets the current API-time ordered-replay architecture. Suggested consolidationKeep open #70107 with a salvage path: retain its API-time clearing of both replay channels and add the requested real-path retry/conversion test. Close #24407 as duplicate of #70107 after preserving its content-array diagnosis; this differs from #24407's automated keep-open verdict, but the recorded diff shows canonical-history mutation and the same fix must be relocated to the API-time path. Complex graphflowchart LR
classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
classDef best stroke-width:3px,stroke:#b45309
classDef target stroke-width:3px,stroke:#4338ca
subgraph Dup24407 ["PRs duplicating each other"]
P24407["PR #24407 (open)"]
P70107["PR #70107 (open)"]
end
class P24407 open
class P70107 open
class P70107 target
click P24407 "https://github.com/NousResearch/hermes-agent/pull/24407"
click P70107 "https://github.com/NousResearch/hermes-agent/pull/70107"
Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed (state tag in the node label). Cross-PR triage: Reviewed 2 pull requests and 0 issues in this complex. Each diff was read against this issue; Assessment working set: 15 kB of PR diffs, 5 kB of issue/PR text, 0 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch. |
On Invalid signature in thinking block recovery, Hermes previously stripped only reasoning_details from API-time message copies but retained anthropic_content_blocks — a separate ordered-block channel that can replay the same invalid signed thinking block, causing the retry to 400 again. This clears both fields from api_messages while leaving the canonical messages store untouched (session history is preserved). Adds a real-path test that exercises convert_messages_to_anthropic() to verify the ordered-block replay fast path does not fire after recovery stripping, while canonical messages retain both fields. Addresses review feedback on NousResearch#70107 from @teknium1 and triage bot.
fca586e to
e78c9f6
Compare
|
Updated with real-path test coverage as requested by @teknium1 and triage review. The new
Rebased onto current |
Summary
Follow-up to #66694.
On
Invalid signature in thinking blockrecovery, Hermes previously stripped onlyreasoning_detailsfrom API-time message copies but retainedanthropic_content_blocks— a separate ordered-block channel that can replay the same invalid signed thinking block, causing the retry to 400 again.This clears both fields from
api_messageswhile leaving the canonicalmessagesstore untouched (session history is preserved).Root cause
When a provider returns HTTP 400
Invalid signature in thinking block, the recovery path inconversation_loop.pystripsreasoning_detailsfrom shallow-copiedapi_messagesand retries. However,build_assistant_messagealso liftsanthropic_content_blocks(the verbatim, order-preserving Anthropic content block list) onto the stored message. The replay fast-path inconvert_messages_to_anthropicsources from this channel when present — so the retry still replayed the same invalid signed thinking block and 400'd again.Fix
Strip
anthropic_content_blocksfrom API-time copies alongsidereasoning_detailsduring signature recovery. The canonicalmessageslist (and thereforestate.db) is unchanged.Verification
python -m py_compile— passedgit diff --check— passedtests/run_agent/test_thinking_sig_recovery_persistence.py— 4 passed (updated to cover bothreasoning_detailsandanthropic_content_blocks)Scope
Two files:
agent/conversation_loop.py— addanthropic_content_blocksto the recovery striptests/run_agent/test_thinking_sig_recovery_persistence.py— update tests to cover both fieldsNo changes to
agent/anthropic_adapter.py,agent/transports/, or any provider plugin.