feat(providers): share Responses backend with Codex WebSocket continuation (#6096)

* feat(codex): continue sessions over Responses WebSocket

* fix(codex): retain API errors with repeated handshake headers

* test(codex): assert attachment paths before JSON escaping

* refactor(providers): share Responses transport and state backend

* fix(grok): update subscription client version

* docs: keep Codex configuration focused on user settings
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-08 11:54:23 +08:00
1 parent 59b89a834c
commit 5be1e589f2
39 files changed
+1690 -801

No files matched your search

+16
View File
@@ -1850,6 +1850,22 @@ class TestGetDefaultModel:
assert fb.get_default_model() == "primary/model"
async def test_fallback_closes_temporary_provider_and_owns_primary_shutdown() -> None:
primary = _FakeProvider("primary", _error_response())
fallback = _FakeProvider("fallback", _make_response("fallback ok"))
primary.aclose = AsyncMock()
fallback.aclose = AsyncMock()
wrapper = FallbackProvider(primary, [_fallback("backup")], MagicMock(return_value=fallback))
result = await wrapper.chat(messages=[{"role": "user", "content": "hi"}])
assert result.content == "fallback ok"
fallback.aclose.assert_awaited_once()
primary.aclose.assert_not_awaited()
await wrapper.aclose()
primary.aclose.assert_awaited_once()
class TestCircuitBreaker:
@pytest.mark.asyncio
async def test_skips_primary_after_three_failures(self) -> None: