Skip to content

fix(tests): use "compaction" as ContextManagement type value#3265

Open
rmotgi1227 wants to merge 1 commit into
openai:mainfrom
rmotgi1227:fix/context-management-type-compaction
Open

fix(tests): use "compaction" as ContextManagement type value#3265
rmotgi1227 wants to merge 1 commit into
openai:mainfrom
rmotgi1227:fix/context-management-type-compaction

Conversation

@rmotgi1227
Copy link
Copy Markdown

Summary

Fixes #2868.

The ContextManagement TypedDict's type field is documented to accept only "compaction":

The context management entry type. Currently only 'compaction' is supported.

The auto-generated test stubs in tests/api_resources/test_responses.py used the placeholder string "type" in four context_management fixtures, which is not a valid value. This means the tests were constructing payloads that the API would reject, not exercising the actual accepted value.

Change

tests/api_resources/test_responses.py — replace "type": "type""type": "compaction" at lines 35, 123, 448, and 536 (all four context_management dict literals in the sync and async test variants).

Verification

# Before: would hit a 400 from the API — "type" is not a valid context management type
context_management=[{"type": "type", "compact_threshold": 1000}]

# After: matches the only accepted value per the type definition
context_management=[{"type": "compaction", "compact_threshold": 1000}]

The ContextManagement TypedDict's type field only accepts "compaction"
(see response_create_params.py: "Currently only 'compaction' is supported").
The auto-generated test stubs used the placeholder string "type", which
is not a valid value and would never exercise the intended code path.

Fixes openai#2868
@rmotgi1227 rmotgi1227 requested a review from a team as a code owner May 18, 2026 19:28
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.

context_management=[{"type": "type"}] in tests, not 'compaction'

1 participant