Summary
With enable_response_chaining: auto (the default behavior when the model supports reasoning), the OpenAI provider sends both previous_response_id and the full re-converted conversation history as input on each request. Server-side, the chained prior context is then counted in addition to the re-sent history, inflating effective context usage and accelerating context_length_exceeded failures (see #320 for the downstream failure mode).
Environment
- Amplifier CLI:
2026.07.11-c150034
- amplifier-core:
1.6.0
- Provider: OpenAI (
gpt-5.6-sol), enable_response_chaining: auto, enable_long_context: true
Details
In amplifier_module_provider_openai/__init__.py (current module cache):
- At
~:1050-1053 and ~:1091-1092, when a chained response id is available the request still includes the full converted message history in input alongside previous_response_id.
- The code itself acknowledges the double-count hazard for the continuation path at
~:1860-1864.
The azure-openai provider reuses OpenAIProvider and inherits the behavior.
Expected behavior
When previous_response_id is sent, input should contain only the delta (new messages since the chained response), or chaining should be disabled and full history sent — not both.
Actual behavior
Both are sent; server-side context consumption roughly doubles relative to the visible conversation, so overflow occurs well before the local token estimate predicts.
Suggested fix
- When chaining is active, send only messages added since the last chained response.
- Add a regression test asserting that a chained request's
input excludes messages already covered by previous_response_id.
Related
Summary
With
enable_response_chaining: auto(the default behavior when the model supports reasoning), the OpenAI provider sends bothprevious_response_idand the full re-converted conversation history asinputon each request. Server-side, the chained prior context is then counted in addition to the re-sent history, inflating effective context usage and acceleratingcontext_length_exceededfailures (see #320 for the downstream failure mode).Environment
2026.07.11-c1500341.6.0gpt-5.6-sol),enable_response_chaining: auto,enable_long_context: trueDetails
In
amplifier_module_provider_openai/__init__.py(current module cache):~:1050-1053and~:1091-1092, when a chained response id is available the request still includes the full converted message history ininputalongsideprevious_response_id.~:1860-1864.The azure-openai provider reuses
OpenAIProviderand inherits the behavior.Expected behavior
When
previous_response_idis sent,inputshould contain only the delta (new messages since the chained response), or chaining should be disabled and full history sent — not both.Actual behavior
Both are sent; server-side context consumption roughly doubles relative to the visible conversation, so overflow occurs well before the local token estimate predicts.
Suggested fix
inputexcludes messages already covered byprevious_response_id.Related
context_length_exceeded)