Skip to content

A reasoning-only answer makes the identical agent retry sample, not replay - #183

Open
AgentSparko wants to merge 2 commits into
TandemLLM:mainfrom
AgentSparko:fix/reasoning-only-retry
Open

AgentSparko wants to merge 2 commits into
TandemLLM:mainfrom
AgentSparko:fix/reasoning-only-retry

Conversation

@AgentSparko

Copy link
Copy Markdown
Contributor

An agent client that gets a completion of pure reasoning (finish=stop, no visible content, no tool call) retries by re-sending the byte-identical conversation, whose tail is a tool result. signature cannot match it (the rule needs a user tail), and greedy decode + prefix cache replays the identical degenerate continuation on every retry - observed three byte-identical retries in a row (request chatcmpl-6d21296b94bb48f5b802af7d, 118k prompt, dev-tip build).

The fix remembers a conversation whose completion was reasoning-only by its retry signature (a user OR tool tail); the next request with that signature samples like a regenerate. A good answer clears the mark, X-Tandem-Regenerate: 0 never matches, and a client that names sampling parameters decides as ever. The classic regenerate path is untouched.

Tests: tests/test_regenerate_degenerate.py (new, all ok) + tests/test_regenerate.py pair suite (ALL PASS with TANDEMAPP_SRC set).

…eplay

An agent client that gets a completion of pure reasoning (finish=stop, no visible
content, no tool call) retries by re-sending the byte-identical conversation, whose
tail is a tool result. The regenerate detector cannot match it (a user tail is the
rule), and greedy decode plus the prefix cache replays the identical degenerate
continuation on every retry -- observed three times in a row, request
chatcmpl-6d21296b94bb48f5b802af7d.

Remember a conversation whose completion was reasoning-only by its retry signature
(a user OR tool tail); the next request with that signature samples like a
regenerate. A good answer clears the mark, X-Tandem-Regenerate: 0 never matches,
and a client that names sampling parameters decides as ever. The classic
regenerate path is untouched.
@github-project-automation github-project-automation Bot moved this to Triage in TandemLLM Nov 21, 2026
@github-actions github-actions Bot added the server/api Server: the OpenAI API, tool calls, streaming, structured output label Nov 21, 2026
A client that appends a nudge to the retry tail (a user row after the tool
result, or a second user row after its prompt) changed the conversation bytes,
so the degenerate-retry mark never matched and greedy replay stood. The
signature now covers the conversation up to its unanswered anchor - the last
tool result, else the first user row of a trailing user run - which is what
the retry re-sends under any nudge. Two scenarios added; the classic
regenerate path and the off switch are untouched.

This branch has not been deployed

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

Labels

server/api Server: the OpenAI API, tool calls, streaming, structured output

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant