fix: tolerate gateways without image profiles

This commit is contained in:
2026-07-10 07:29:01 +08:00
parent f67cbbda65
commit c79e85e635
4 changed files with 36 additions and 7 deletions
+18
View File
@@ -121,6 +121,24 @@ class CodexRetryGatewayTUITests(unittest.TestCase):
self.assertEqual(mod.request_updated_elapsed(row), "1.0s")
self.assertEqual(mod.request_chunk_progress(row), "7 / 4.1KB")
def test_optional_image_profiles_endpoint_can_be_absent_on_older_gateway(self) -> None:
mod = load_module()
missing_endpoint = mod.urllib.error.HTTPError(
"http://127.0.0.1:4610/__codex_retry_gateway/api/image-profiles",
404,
"Not Found",
{},
None,
)
with mock.patch.object(mod, "fetch_payload", side_effect=missing_endpoint):
payload, error = mod.fetch_optional_payload(
"http://127.0.0.1:4610/__codex_retry_gateway/api/image-profiles",
5,
allow_not_found=True,
)
self.assertEqual(payload, {})
self.assertEqual(error, "")
def test_request_usage_summary_shows_cached_ratio(self) -> None:
mod = load_module()
row = {