Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

test(e2e): retarget the Codex remote-compaction metadata case to v2 (#2261)

Call Whitedd1507bf9f8b
diff --git a/docs/plans/codex-request-routing.md b/docs/plans/codex-request-routing.md
index eacfb6c94..92ed1b3c6 100644
--- a/docs/plans/codex-request-routing.md
+++ b/docs/plans/codex-request-routing.md
@@ -81,5 +81,7 @@ restart is part of this change.
- Genuine direct/native/Hub channel changes may still require process replacement.
- No broad catch, notification suppression, or extra delivery retry is added.
- The Hub provider's automatic compaction uses the existing Responses route.
- The legacy remote compact endpoint remains unsupported; its header-only native
- wire probe verifies the carrier, not end-to-end gateway support.
+ Codex compacts remotely only for OpenAI or Azure providers. That request uses
+ the ordinary Responses endpoint with identity in both carriers; Codex 0.155
+ removed the legacy `/responses/compact` client. Its native wire probe
+ verifies the carrier, not end-to-end gateway support.
diff --git a/tests/e2e/test_codex_request_metadata.py b/tests/e2e/test_codex_request_metadata.py
index 527121cda..17d6ba697 100644
--- a/tests/e2e/test_codex_request_metadata.py
+++ b/tests/e2e/test_codex_request_metadata.py
@@ -128,17 +128,17 @@ async def _completed(queue):
return result
-def _assert_identity(request, identity, *, body_metadata=True):
+def _assert_identity(request, identity):
assert request["headers"]["authorization"] == f"Bearer {TOKEN}"
header = json.loads(request["headers"][METADATA_HEADER])
assert {key: header[key] for key in identity} == identity
- body = request["body"]
- if body_metadata:
- metadata = json.loads(body["client_metadata"][METADATA_HEADER])
- assert {key: metadata[key] for key in identity} == identity
- assert metadata["turn_id"] == header["turn_id"]
- else:
- assert "client_metadata" not in body
+ metadata = json.loads(request["body"]["client_metadata"][METADATA_HEADER])
+ assert {key: metadata[key] for key in identity} == identity
+ assert metadata["turn_id"] == header["turn_id"]
+
+
+def _is_remote_compaction(body):
+ return any(item.get("type") == "compaction_trigger" for item in body["input"])
@pytest.fixture
@@ -195,33 +195,30 @@ def test_codex_auto_compaction_wire_metadata(metadata_runtime, large_initial_usa
def test_codex_remote_compact_request_uses_header_metadata(
metadata_runtime, large_initial_usage, monkeypatch,
):
- """MH-PROTOCOL-004: inspect remote compact's carrier, not gateway support.
+ """MH-CODEX-METADATA-001: inspect remote compact's carrier, not gateway support.
The Hub provider uses local compaction. A test-only OpenAI provider name
- with remote_compaction_v2 disabled activates the legacy remote endpoint.
- Its HTTP header survives even though its body has no client_metadata. The
- receiver rejects that endpoint deterministically; no fake compaction
- output or gateway support is implied.
+ activates remote compaction. Codex sends it to the ordinary Responses
+ endpoint, marked by a compaction_trigger input item; 0.155 removed the
+ legacy /responses/compact client. Its header and body both carry the new
+ turn's identity. The receiver rejects that request deterministically; no
+ fake compaction output or gateway support is implied.
"""
- original_post = upstream.MockLLMUpstreamHandler.do_POST
+ original_stream = upstream.MockLLMUpstreamHandler._write_stream
- def post(handler):
- if handler.path != "/v1/responses/compact":
- return original_post(handler)
- handler._capture(handler.path, handler._read_json_body())
+ def stream(handler, protocol, body, behavior):
+ if not _is_remote_compaction(body):
+ return original_stream(handler, protocol, body, behavior)
handler._write_json(400, {"error": {
"type": "invalid_request_error", "message": "synthetic compact probe stop",
}})
- monkeypatch.setattr(upstream.MockLLMUpstreamHandler, "do_POST", post)
+ monkeypatch.setattr(upstream.MockLLMUpstreamHandler, "_write_stream", stream)
first = {"avibe_route_id": "route-compact", "avibe_turn_id": "avibe-turn-before-compact"}
second = {**first, "avibe_turn_id": "avibe-turn-compact"}
async def probe(gateway):
- overrides = [
- "-c", 'model_providers.avibe_model_hub.name="OpenAI"',
- "-c", "features.remote_compaction_v2=false",
- ]
+ overrides = ["-c", 'model_providers.avibe_model_hub.name="OpenAI"']
async with _transport(metadata_runtime, gateway, overrides=overrides) as (transport, queue, _notifications):
thread_id = await _thread(transport, MODELS[0])
await _turn(transport, thread_id, first)
@@ -235,9 +232,10 @@ def test_codex_remote_compact_request_uses_header_metadata(
gateway.configure(protocol="openai_responses")
asyncio.run(probe(gateway))
requests = gateway.requests()
- assert [request["path"] for request in requests] == ["/v1/responses", "/v1/responses/compact"]
+ assert [request["path"] for request in requests] == ["/v1/responses"] * 2
+ assert [_is_remote_compaction(request["body"]) for request in requests] == [False, True]
_assert_identity(requests[0], first)
- _assert_identity(requests[1], second, body_metadata=False)
+ _assert_identity(requests[1], second)
assert requests[1]["body"]["model"] == MODELS[0]
diff --git a/tests/scenarios/model_hub/observations.yaml b/tests/scenarios/model_hub/observations.yaml
index ee464476c..add485e14 100644
--- a/tests/scenarios/model_hub/observations.yaml
+++ b/tests/scenarios/model_hub/observations.yaml
@@ -1,6 +1,11 @@
version: 2
capability: model_hub
observations:
+ - id: MH-OBS-012
+ source: codex-0.156.0-hermetic-remote-compaction-wire-2026-09-29
+ summary: Codex 0.155.0 removed the remote_compaction_v2 switch and the legacy /responses/compact client, so MH-OBS-009's header-only compact probe is unreachable. Remote compaction posts to the ordinary Responses endpoint with a compaction_trigger input item and carries the new turn's identity in both the metadata header and body client_metadata. Codex 0.154.0, where v2 was already the default, and 0.158.0 send the same shape.
+ affects:
+ - MH-CODEX-METADATA-001
- id: MH-OBS-011
source: claude-cli-2.1.280-hub-request-timeouts-2026-09-26
summary: Claude hub turns failed with "Request timed out" while the Hub was still resolving. The CLI aborts a stream whose headers miss its first-byte window (300s by default for non-Anthropic base URLs) or whose body stays byte-silent, and the Hub withheld headers until the first model output. Claude streams now commit headers early and send SSE comments during resolution, and Claude hub launches raise the first-byte and API timeouts to the CLI maximum.