Lift the `openai <2.44` cap once the API recorder is fixed for openai ≥ 2.44
What is the technical debt you think should be addressed?
We currently pin openai>=2.41.0,<2.44 in pyproject.toml (added while unblocking
dependabot PR #6587). That cap is not a real openai compatibility constraint —
it works around a bug in our own test-recording infrastructure, and it has started
driving unrelated dependency pins.
Mechanism: src/ogx/testing/api_recorder.py (patch_httpx_for_test_id, invoked from
tests/integration/conftest.py) wraps OgxClient._prepare_request and, inside the
wrapper, calls openai.OpenAI._prepare_request(self, request) with the generated
OgxClient instance as self (lines ~325, 333-335, 359). That is only safe while
openai's _prepare_request doesn't touch attributes a real openai.OpenAI sets in
__init__. In openai 2.44.0, _prepare_request began dereferencing
self._provider_runtime (an __init__-set attribute), so calling it on an OgxClient
raises AttributeError: 'OgxClient' object has no attribute '_provider_runtime', which
fails every recorded integration test.
Because the cap is <2.44, it also dragged in a second pin: langchain-openai is
capped at >=1.2.2,<1.3 since 1.6.2 requires openai>=2.45.0. One internal test bug is
therefore currently holding back two dependency lines, and the openai cap will keep
blocking future dependabot bumps until it's addressed.
What is the benefit of addressing this technical debt?
- Restores the ability to track the latest
openai(and, transitively,langchain-openai) without a version ceiling, so dependabot python-deps PRs stop needing manual reverts. - Keeps the integration recording infra correct for current and future openai clients.
- Removes a "magic" version cap that isn't self-explanatory without this issue for context.
Other thoughts
- The root fix belongs in
src/ogx/testing/api_recorder.py, not the dependency pin — the recorder should not callOpenAI._prepare_requeston a non-OpenAIself. Options:- Drop the
openai_orig(self, request)delegation entirely ifOgxClient._prepare_requestalready does what's needed (confirm why the openai call was added first). - If the openai behavior is required, replicate the specific request mutations (headers / auth) directly rather than invoking the bound method, so we don't depend on openai's private instance state.
- At minimum, guard the call so it can't dereference attributes absent on
OgxClient.
- Drop the
- Once the recorder is verified against openai ≥ 2.44, remove both caps in a single PR and re-record any integration tests whose request bodies changed.
- Could be a
good first issueonce the intended behavior of theopenai_origcall is documented.
Source: ogx-ai/ogx