Skip to content

Agent Zero AI framework

fix(oauth): send Codex client version header on upstream requests

axelray-dev01def8603ae9
diff --git a/plugins/_oauth/helpers/codex.py b/plugins/_oauth/helpers/codex.py
index bc59b0100..3018dbe89 100644
--- a/plugins/_oauth/helpers/codex.py
+++ b/plugins/_oauth/helpers/codex.py
@@ -599,6 +599,9 @@ def request_codex(
"thread-id": metadata["thread_id"],
}
)
+ client_version = resolve_codex_version()
+ if client_version:
+ request_headers["version"] = client_version
return requests.request(
method,
diff --git a/tests/test_oauth_codex.py b/tests/test_oauth_codex.py
index ab0e71c9a..02592f7f9 100644
--- a/tests/test_oauth_codex.py
+++ b/tests/test_oauth_codex.py
@@ -301,7 +301,10 @@ def test_prepare_responses_body_sends_empty_continuation_input_as_list(monkeypat
assert body["previous_response_id"] == "resp_1"
-def test_request_codex_sends_current_codex_headers_from_body(monkeypatch):
[email protected]("client_version", ["0.142.5", ""])
+def test_request_codex_sends_current_codex_headers_from_body(
+ monkeypatch, client_version
+):
calls = []
body = json.dumps(
{
@@ -333,6 +336,7 @@ def test_request_codex_sends_current_codex_headers_from_body(monkeypatch):
account_id="account-1",
),
)
+ monkeypatch.setattr(codex, "resolve_codex_version", lambda: client_version)
def fake_request(method, target, headers, data, params, timeout, stream):
calls.append(
@@ -369,6 +373,10 @@ def test_request_codex_sends_current_codex_headers_from_body(monkeypatch):
assert call["headers"]["session-id"] == "session-1"
assert call["headers"]["thread-id"] == "thread-1"
assert call["headers"]["x-codex-window-id"] == "agent-zero"
+ if client_version:
+ assert call["headers"]["version"] == "0.142.5"
+ else:
+ assert "version" not in call["headers"]
def test_chat_messages_to_response_body_preserves_image_parts_for_responses():