Skip to content

Add defensive caps for Responses rehydrate history #66

Description

@leseb

Parent: #93

Responses rehydration currently loads record.messages, clones the full stored array into ResponsesState, and later persists accumulated state into the next response record. That leaves proxy memory and DB growth unbounded across chained previous_response_id turns.

Scope:

  • Add a default-enabled max_history_bytes guard to openai_responses_rehydrate.
  • Consider an optional max_history_items guard for operational clarity.
  • Enforce before cloning/splicing stored history into request state.
  • Enforce before persisting accumulated ResponsesState.messages into the response store.
  • Return 413 Payload Too Large with guidance to compact before continuing.
  • Add regression tests for oversized stored history and oversized accumulated history.

Notes:

  • OpenAI context_management.compact_threshold and truncation are backend/model-context controls; they do not protect Praxis from loading large DB-backed history before forwarding to the inference backend.
  • This follow-up was split out from review of the Responses rehydrate filter.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingrustPull requests that update rust code

Type

Fields

No fields configured for Task.

Projects

Status
In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions