Repository navigation
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9de07fd7af
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| - **THEN** the service MUST fail the request with a generic 5xx bridge-forward error | ||
| - **AND** it MUST NOT attempt another owner handoff | ||
|
|
||
| #### Scenario: local restart orphan is recovered by the replacement instance |
There was a problem hiding this comment.
Add the required OpenSpec change folder
This new scenario changes the HTTP bridge restart-orphan behavior/proxy-routing contract, but the commit only edits the main spec and code/tests; AGENTS.md requires behavior/contract changes to create an OpenSpec change in openspec/changes/** first and states that for proxy-routing/compatibility changes, “Code/tests alone are not enough when OpenSpec is required.” Without the proposal/tasks change folder, the repository’s documented PR readiness gate cannot be satisfied for this behavior change.
Useful? React with 👍 / 👎.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 404ae89b6e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| request_service_tier=request_service_tier, | ||
| ) | ||
| raise | ||
| if code == "upstream_request_timeout": |
There was a problem hiding this comment.
Clear affinity when local compact attempts time out
When the per-attempt timeout added here fires, the compact transport wraps both body-read and connect aiohttp/asyncio timeouts as openai_error("upstream_unavailable", ...) in app/core/clients/proxy.py (around lines 3034 and 3115), so this upstream_request_timeout-only branch is skipped. In that scenario the request may still fail over via the generic path, but the stale compact affinity mapping is not cleared, leaving subsequent prompt/session-affinity compactions pinned back to the account that just timed out.
Useful? React with 👍 / 👎.
| response = await _call_compact( | ||
| account, | ||
| account_response_create_lease, | ||
| account_attempts_remaining=_compact_max_account_attempts() - _account_attempt, |
There was a problem hiding this comment.
Avoid splitting compact budget without another candidate
When only one account is eligible, such as a single-account deployment or an API-key/file-pinned compact request, this still passes 2 on the first attempt because it uses the configured max attempts rather than actual remaining candidates. _compact_attempt_timeout_seconds then halves the remaining request budget and installs that as the total upstream timeout, so a valid compact call that would complete within compact_request_budget_seconds can be cut off early even though there is no account to fail over to.
Useful? React with 👍 / 👎.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ae4e58e168
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| raise ProxyResponseError( | ||
| 503, | ||
| openai_error( | ||
| "compact_upstream_unavailable", | ||
| "Compact upstream is cooling down after repeated timeouts; retry shortly.", |
There was a problem hiding this comment.
Move compact cooldown into accounting path
When an internal bridge/forwarded request hits this cooldown while carrying an api_key_reservation_override, this early raise happens before the compact method's normal try/finally accounting path, while _stream_responses only releases reservations it owns. That leaves the forwarded reservation unsettled/released only by neither side and also skips compact request logging for these 503s; settle/log through the existing compact error path before returning the cooldown error.
Useful? React with 👍 / 👎.
| request_service_tier=request_service_tier, | ||
| ) | ||
| raise | ||
| if code == "upstream_request_timeout": |
There was a problem hiding this comment.
Handle timeout codes before same-account retries
When the compact upstream returns a retryable HTTP status such as 502/503/504 with an OpenAI error code of upstream_request_timeout, the core compact client marks the ProxyResponseError as retryable_same_contract, so the guard just above this parsing block retries the same account first. That bypasses the new timeout failover behavior for the first timeout, delaying the required stale-affinity clear/exclusion and letting a dead account consume the retry slice intended for another eligible account; parse and handle upstream_request_timeout before the same-contract retry guard.
Useful? React with 👍 / 👎.
077a10e to
96487ae
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 96487aee51
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return CompactResponsePayload.model_validate( | ||
| { | ||
| "object": "response.compaction", | ||
| "output": build_local_compact_fallback_output( |
There was a problem hiding this comment.
Return a compaction item from the local fallback
When this fallback is used via the terminal compaction_trigger path in _stream_responses, api._compact_response_output_item() only accepts an output item of type compaction/compaction_summary with encrypted_content; these message items make it return None, so _stream_responses turns the timeout fallback into a 502 “Compact response did not include a compaction output item” instead of letting Codex continue. Please wrap or emit a valid compaction output for this path.
Useful? React with 👍 / 👎.
| assert marker_content[0]["text"].startswith("[local compact fallback]") | ||
| assert "Remote compaction was unavailable" in marker_content[0]["text"] | ||
| assert "test outage" in marker_content[0]["text"] | ||
| assert "codex-lb" not in marker_content[0]["text"] |
There was a problem hiding this comment.
Fix the contradictory compact fallback assertion
This new test asserts that the fallback marker does not contain codex-lb, but _local_compact_fallback_marker() constructs the marker text with codex-lb in it, so tests/unit/test_openai_requests.py fails as soon as this test is run. Update the expected text or remove the assertion so CI can pass.
Useful? React with 👍 / 👎.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c1c49cf92f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if _local_compact_fallback_enabled(settings): | ||
| response = _local_compact_fallback_response( | ||
| payload, | ||
| reason="all compact upstream account attempts timed out", | ||
| max_estimated_tokens=_local_compact_fallback_token_limit(settings), | ||
| ) |
There was a problem hiding this comment.
Return a compaction item for local fallback
When a /backend-api/codex/responses request ends with compaction_trigger and all compact attempts time out, this path returns a "successful" fallback whose output is made of message items from build_local_compact_fallback_output. The streaming compaction-trigger path immediately calls _compact_response_output_item, which only accepts compaction/compaction_summary items with encrypted_content, so the fallback is converted into a 502 "Compact response did not include a compaction output item" instead of preserving continuation during the exact timeout scenario this branch is meant to handle.
Useful? React with 👍 / 👎.
|
@codex review |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 97c4ec9045
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "output": build_local_compact_fallback_output( | ||
| payload.input, | ||
| reason=reason, | ||
| max_estimated_tokens=max_estimated_tokens, | ||
| ), |
There was a problem hiding this comment.
Emit a compaction item for local fallback
When the normal /responses flow hits a terminal compaction_trigger, api.py calls _compact_response_output_item() and only accepts compaction/compaction_summary items that carry encrypted_content before it can synthesize the continuation stream. This fallback response instead fills output with plain message/trim-marker items, so any upstream timeout or cooldown that selects local fallback in that flow will be converted into Compact response did not include a compaction output item (502) rather than preserving the session. The fallback needs to produce or be adapted into the encrypted compaction item shape consumed by that path.
Useful? React with 👍 / 👎.
|
#993 has been partially folded into #875. Carried scope: the useful bridge-restart continuity anchor behavior is now part of the #875 account-bound proxy routing and continuity branch. Deliberately not carried: the older local compact fallback tail is superseded by #991's newer compact-timeout/budget path, which is also folded into #875. |
Summary
Live deploy
codex-lb:live-stack-3d63876from aggregate commit3d638765fcodex-lb-before-live-stack-3d63876-20260613T114136Z/healthand/health/readyare OK; bridge ring settled to one live memberTests
uv run pytest tests/unit/test_durable_bridge_sessions.py tests/unit/test_proxy_http_bridge.py -quv run ruff check app/modules/proxy/durable_bridge_repository.py app/modules/proxy/_service/http_bridge/owner_forwarding.py tests/unit/test_durable_bridge_sessions.py tests/unit/test_proxy_http_bridge.pyopenspec validate --specsgit diff --check origin/main..HEAD