Skip to content

Allow previous_response_id after server-side compaction#4682

Draft
chrmarti wants to merge 1 commit intomainfrom
chrmarti/use-previous-response-id-after-compaction
Draft

Allow previous_response_id after server-side compaction#4682
chrmarti wants to merge 1 commit intomainfrom
chrmarti/use-previous-response-id-after-compaction

Conversation

@chrmarti
Copy link
Copy Markdown
Collaborator

Summary

Remove the guard that prevented using previous_response_id (stateful marker) when compaction data was present in the message history.

Server-side compaction is transparent to the response ID chain — after compaction, the server retains the compacted context tied to the response ID, so previous_response_id remains valid and avoids re-sending the full history (including the compaction blob).

Session Context

Key decisions from the development session:

  • Compaction + previous_response_id compatibility: Verified via a test script against gpt-5.4 that previous_response_id chaining works across compaction boundaries. Turn 3 triggered compaction and turn 4 succeeded using previous_response_id from turn 3.
  • Server retains compacted state: The compaction blob only needs to be round-tripped on HTTP requests without previous_response_id. When the stateful marker is set (WebSocket reuse or HTTP with marker), the server already has the compacted context.
  • Minimal change: Only removed the latestCompactionMessageIndex === undefined guard from the condition. The compaction slicing logic before it is still correct for the HTTP fallback path.

Changes

  • src/platform/endpoint/node/responsesApi.ts: Removed check that blocked previous_response_id when compaction data existed in message history.

The stateful marker (previous_response_id) continues to work after
server-side compaction. The server retains the compacted context and
the response ID chain remains valid, so there is no need to skip the
marker when compaction data is present in the message history.
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