refactor(codex): 移除 envelope/request_patching 层,用 context var 统一 compact 状态判断

- 删除 CodexOAuthEnvelope 和 request_patching 模块,Codex 不再需要 envelope 层
- 移除 _aether_compact 请求体内部标记,改用 is_codex_compact_request() 集中查询
- 简化 OpenAI CLI adapter,移除 Codex 专用的 get_cli_extra_headers/build_test_request_body 逻辑
- 移除 Codex behavior variant 注册(same_format/cross_format)
- normalizer patch_same_format_request 对 codex 变为 no-op
- 更新相关测试适配新的架构
This commit is contained in:
fawney19
2026-03-18 12:35:57 +08:00
parent d026398bab
commit 1af3067303
15 changed files with 79 additions and 560 deletions

View File

@@ -51,7 +51,6 @@ class _DummyCliStreamHandler(CliStreamMixin):
return out
def prepare_provider_request_body(self, request_body: dict[str, Any]) -> dict[str, Any]:
request_body.pop("_aether_compact", None)
request_body["input"][0]["content"][0]["text"] = "prepared"
return request_body
@@ -116,7 +115,6 @@ async def test_execute_stream_request_does_not_mutate_original_request_body(
original_request_body = {
"model": "gpt-test",
"_aether_compact": True,
"input": [
{
"role": "user",
@@ -141,6 +139,5 @@ async def test_execute_stream_request_does_not_mutate_original_request_body(
assert original_request_body == snapshot
assert handler._request_builder.request_body is not None
assert "_aether_compact" not in handler._request_builder.request_body
assert handler._request_builder.request_body["input"][0]["content"][0]["text"] == "prepared"
assert handler._request_builder.request_body["input"][0]["content"][-1]["text"] == "finalized"