Skip to content

fix(proxy): mask single previous response misses - #516

Merged
Soju06 merged 4 commits into
Soju06:mainfrom
Komzpa:codex/mask-single-previous-response-miss
May 13, 2026
Merged

Soju06 merged 4 commits into
Soju06:mainfrom
Komzpa:codex/mask-single-previous-response-miss

Conversation

@Komzpa

@Komzpa Komzpa commented Apr 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • mask single-request anonymous HTTP bridge previous_response_not_found as an internal continuity-loss signal instead of leaking the raw upstream 400
  • preserve the existing local previous-response rebind path by raising an internal bridge_previous_response_not_found marker only for the single anonymous HTTP bridge case
  • retry direct WebSocket full-resend follow-ups without a stale previous_response_id when upstream loses a just-completed anchor before response.created
  • sanitize direct WebSocket short continuations that hit upstream previous_response_not_found into stream_incomplete instead of replaying the same stale anchor and exposing the raw upstream 400
  • avoid false local no_plan_support_for_model 503s after partial model-registry refreshes: account selection now only applies the plan filter when the registry has an authoritative entry for the requested model, and model refresh invalidates cached selection inputs
  • mask any lower-layer public Responses or compact previous_response_not_found payload to retryable stream_incomplete so the missing response id cannot leak even if a lower recovery path misses it
  • add OpenSpec change artifacts plus HTTP bridge, WebSocket, and model-registry/load-balancer regression coverage

Root Cause

The HTTP bridge only rewrote upstream previous_response_not_found when the upstream event had a response.id or there were other pending requests. A single pending follow-up with an anonymous upstream error could therefore propagate the raw invalid-request error to Codex clients.

Live archive follow-up showed direct WebSocket Codex turns can receive response.completed for an anchor and then hit previous_response_not_found on the next turn seconds later on the same account/session. Full-resend turns can be recovered by reconnecting upstream and replaying the full payload without previous_response_id; short continuation turns cannot, because the only semantic payload is the stale anchor, so they now fail closed as a sanitized continuity-loss signal.

A DNS outage exposed a separate local-routing edge while the live container was running this PR stack: partial model registry data could make responses/compact apply a plan filter for a model the registry did not actually know yet, producing local 503 No accounts with a plan supporting model 'gpt-5.5' while adjacent responses calls on pro accounts were already succeeding.

Fresh live incident check

Checked the live raw leak with previous_response_id=resp_0bebc32c66e5a5990169f9d272ffbc8191801046ca030a311b from 2026-05-05:

  • 2026-05-05 11:20:19 UTC: upstream created resp_0beb...d272....
  • 2026-05-05 11:20:24 UTC: upstream returned response.completed for that response.
  • 2026-05-05 11:21:27 UTC: the same response stream recorded no close frame received or sent.
  • 2026-05-05 11:22:25 UTC: the next turn sent previous_response_id=resp_0beb...d272... and got raw previous_response_not_found / previous_response_id / 400 downstream.

This was not a cross-account routing miss: the created/completed response, follow-up request, and raw error all used the same account family c26b2ebf.... A new account fe2708b6... appeared nearby in the archive, but for a different parallel request.

So this PR's desired behavior is fail-closed masking: when upstream loses continuity even on the owner account, downstream gets 502 stream_incomplete, not raw previous_response_not_found or a resp_* id.

Validation

  • .venv/bin/pytest -q tests/integration/test_proxy_websocket_responses.py (37 passed, 2 pre-existing aiosqlite thread warnings)
  • .venv/bin/pytest -q tests/integration/test_proxy_websocket_responses.py::test_v1_responses_websocket_masks_short_previous_response_not_found_without_retry tests/integration/test_proxy_websocket_responses.py::test_backend_responses_websocket_masks_short_previous_response_not_found_without_retry tests/integration/test_proxy_websocket_responses.py::test_backend_responses_websocket_masks_previous_response_not_found_when_message_omits_response_id tests/integration/test_proxy_websocket_responses.py::test_v1_responses_websocket_retries_full_resend_previous_response_miss_without_anchor (4 passed)
  • .venv/bin/pytest -q tests/unit/test_proxy_load_balancer_refresh.py tests/unit/test_graceful_degradation.py (42 passed, 3 skipped)
  • .venv/bin/ruff check app/modules/proxy/service.py tests/integration/test_proxy_websocket_responses.py
  • .venv/bin/ruff check app/modules/proxy/load_balancer.py app/core/openai/model_refresh_scheduler.py tests/unit/test_proxy_load_balancer_refresh.py
  • .venv/bin/ruff format --check app/modules/proxy/service.py tests/integration/test_proxy_websocket_responses.py
  • .venv/bin/ruff format --check app/modules/proxy/load_balancer.py app/core/openai/model_refresh_scheduler.py tests/unit/test_proxy_load_balancer_refresh.py
  • npx --yes @fission-ai/openspec validate --specs (19 passed)
  • git diff --check
  • /home/kom/proj/codex-lb/.venv/bin/python -m pytest -q tests/unit/test_proxy_api_websocket_auth.py::test_public_previous_response_not_found_error_is_masked_to_stream_incomplete tests/unit/test_proxy_api_websocket_auth.py::test_public_previous_response_invalid_request_param_is_masked_to_stream_incomplete tests/integration/test_proxy_websocket_responses.py tests/integration/test_http_responses_bridge.py::test_v1_responses_http_bridge_rebinds_after_upstream_previous_response_not_found tests/integration/test_http_responses_bridge.py::test_v1_responses_http_bridge_masks_anonymous_previous_response_not_found_with_inflight_request (41 passed, rerun on 2026-05-05)
  • /home/kom/proj/codex-lb/.venv/bin/ruff check app/modules/proxy/service.py tests/unit/test_proxy_api_websocket_auth.py tests/integration/test_proxy_websocket_responses.py tests/integration/test_http_responses_bridge.py (rerun on 2026-05-05)
  • git diff --check (rerun on 2026-05-05)

GitHub CI for this PR head is green: 18/18 checks passed.

Notes

  • make -f src/Makefile precommit is not available in this repository; that Makefile belongs to the surrounding OpenClaw workspace.
  • .venv/bin/ty check app/modules/proxy/service.py tests/integration/test_proxy_websocket_responses.py still reports the pre-existing service.py:9018..9029 diagnostics that are handled by neighboring PR fix(types): clear existing ty diagnostics #517.

Related issues

@Komzpa
Komzpa force-pushed the codex/mask-single-previous-response-miss branch from 9d9ebc2 to 1fe5fe6 Compare April 29, 2026 09:47
@Komzpa
Komzpa marked this pull request as ready for review April 29, 2026 09:48
@Komzpa
Komzpa force-pushed the codex/mask-single-previous-response-miss branch 4 times, most recently from 14449fe to f37065d Compare April 30, 2026 07:21
@mgwals

mgwals commented May 1, 2026

Copy link
Copy Markdown

I validated this branch against a fresh local incident capture from codex-cli 0.128.0 using a local codex-lb:1.15.0-ws-retry container.

Observed in request_logs over a 6h window:

  • 1634 successes, 3 errors
  • all 3 errors were status=error, error_code=stream_incomplete, transport=http
  • message: Upstream websocket closed before response.completed: no close frame received or sent
  • models/efforts: gpt-5.5 with high/xhigh
  • no raw account ids included here; account ids were only hashed in the local capture

This branch matches the mitigation I would want for the continuity-loss class: mask previous_response_not_found, retry only when the request is still safely replayable, and avoid blind retry once a semantic continuation depends only on a stale anchor.

Local validation on this PR branch:

  • uv run pytest -q tests/unit/test_proxy_api_websocket_auth.py::test_public_previous_response_not_found_error_is_masked_to_stream_incomplete tests/unit/test_proxy_api_websocket_auth.py::test_public_previous_response_invalid_request_param_is_masked_to_stream_incomplete tests/integration/test_proxy_websocket_responses.py::test_v1_responses_websocket_masks_short_previous_response_not_found_without_retry tests/integration/test_proxy_websocket_responses.py::test_backend_responses_websocket_masks_short_previous_response_not_found_without_retry tests/integration/test_proxy_websocket_responses.py::test_backend_responses_websocket_masks_previous_response_not_found_when_message_omits_response_id tests/integration/test_proxy_websocket_responses.py::test_v1_responses_websocket_retries_full_resend_previous_response_miss_without_anchor tests/integration/test_http_responses_bridge.py::test_v1_responses_http_bridge_rebinds_after_upstream_previous_response_not_found tests/integration/test_http_responses_bridge.py::test_v1_responses_http_bridge_masks_anonymous_previous_response_not_found_with_inflight_request -> 8 passed
  • uv run openspec validate --specs -> 19 passed, 0 failed
  • uv run ruff check ... on changed proxy/test files -> passed
  • uv run ruff format --check ... wanted to reformat app/modules/proxy/service.py locally with the current lockfile/tooling

Separate live smoke against the existing container, without deploying this PR: 60 small streamed /v1/responses requests (20 each for low/high/xhigh) all reached response.completed, and no new error rows appeared after the smoke start.

@Komzpa
Komzpa force-pushed the codex/mask-single-previous-response-miss branch 3 times, most recently from 54fe916 to 368e287 Compare May 3, 2026 13:57
@Komzpa

Komzpa commented May 5, 2026

Copy link
Copy Markdown
Collaborator Author

Cross-link note: #535 is a narrower overlapping PR for direct WebSocket previous_response_not_found masking.

This PR (#516) is the broader owned branch and should be treated as the canonical fix for our live incident class: HTTP bridge, direct WebSocket, compact/public masking, and the model-registry edge are all covered here.

Live deployment note: the current local container image is codex-lb:weekly-recovery-safe-25770b8, built from the live composite branch at 25770b8. That stack includes this PR's proxy masking patch as commit 6e4cbc3; its stable patch-id matches this PR head 368e287, so the deployed proxy masking behavior corresponds to #516 even though the live commit hash differs due to the composite stack.

@jumski

jumski commented May 8, 2026

Copy link
Copy Markdown

Tested - resolves the 503 no_plan_support_for_model false positives with opencode + codex-lb.

To test locally:

git clone https://github.com/Komzpa/codex-lb.git /tmp/codex-lb-pr516
git -C /tmp/codex-lb-pr516 checkout codex/mask-single-previous-response-miss
DOCKER_BUILDKIT=1 docker build -t codex-lb:pr516 /tmp/codex-lb-pr516

Point compose.yaml at codex-lb:pr516 and restart.

Works well. Would love to see this merged.

@Soju06

Soju06 commented May 12, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6854f57dc3

ℹ️ 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".

Comment on lines +6236 to +6238
if not (
request_state.fresh_upstream_request_is_retry_safe and request_state.fresh_upstream_request_text
):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve direct WebSocket retries for safe full-resend misses

This new guard drops all previous_response_not_found retries unless fresh_upstream_request_is_retry_safe is true, but that flag is only set on the HTTP-bridge preparation path (not the direct WebSocket request path). As a result, direct WebSocket follow-ups that include a safe full-resend payload now fall through to a terminal stream_incomplete instead of reconnecting and replaying without previous_response_id, which regresses the recovery behavior this change intends to keep for full-resend requests.

Useful? React with 👍 / 👎.

@Soju06

Soju06 commented May 12, 2026

Copy link
Copy Markdown
Owner

Thanks @Komzpa -- the live-archive trace, fail-closed framing for short continuations, and the orthogonal model-registry / plan-filter hardening are all in good shape. Codex review came back with one P1 that needs a fix before merging.

P1 -- direct WebSocket safe full-resend retries are now skipped

The new guard in _process_upstream_websocket_text:

# app/modules/proxy/service.py:6238
if retry_is_previous_response_not_found:
    if not (
        request_state.fresh_upstream_request_is_retry_safe
        and request_state.fresh_upstream_request_text
    ):
        # short continuation: anchor lost, no safe replay payload
        retry_error_code = None
    else:
        # full-resend retry path
        upstream_control.reconnect_requested = True
        request_state.request_text = request_state.fresh_upstream_request_text
        request_state.previous_response_id = None
        ...

fresh_upstream_request_is_retry_safe / fresh_upstream_request_text are only populated on the HTTP bridge preparation path. The direct WebSocket request path never sets them, so direct WebSocket follow-ups -- including safe full-resend payloads that this PR explicitly says it wants to keep recovering by reconnecting and replaying without previous_response_id -- now fall into the retry_error_code = None branch and surface stream_incomplete instead of being transparently retried.

This regresses one of the recovery cases this PR is trying to preserve, and contradicts the test name added in the same change (test_v1_responses_websocket_retries_full_resend_previous_response_miss_without_anchor), which I expect was authored against the HTTP-bridge-prepared full-resend variant rather than the direct WebSocket variant.

Suggested fix

Populate the same retry-safety metadata on the direct WebSocket request path so the new guard treats full-resend variants identically across paths. Concretely:

  1. Where the direct WebSocket path constructs the upstream request text (the _prepare_responses_websocket_request / equivalent site that already knows whether the payload is a full-resend, i.e. does not depend on the upstream anchor for semantics), set:

    request_state.fresh_upstream_request_text = full_resend_text
    request_state.fresh_upstream_request_is_retry_safe = True

    for full-resend cases, and leave both unset (or explicitly False) for short continuations.

  2. Keep the line 6238 guard as written.

  3. Add a direct-WebSocket regression test mirroring the HTTP bridge one:

    async def test_backend_responses_websocket_retries_full_resend_previous_response_miss_without_anchor():
        # full-resend payload via direct websocket
        # upstream emits previous_response_not_found
        # assert: reconnect + replay without previous_response_id
        # assert: downstream sees the second-attempt response.completed, not stream_incomplete

    And a sanity test confirming a direct-WebSocket short continuation (no full-resend payload) still ends with stream_incomplete:

    async def test_backend_responses_websocket_short_continuation_previous_response_miss_returns_stream_incomplete():
        # direct websocket, short continuation (no fresh_upstream_request_text)
        # upstream emits previous_response_not_found
        # assert: downstream sees stream_incomplete, no retry

If the direct WebSocket path also has cases that legitimately can't be classified as retry-safe at request-preparation time (because retry-safety depends on what upstream just sent), an alternative is to track retry-safety on the request state at receive time rather than relying on a flag set at request prep time -- but the simpler path is to propagate the existing flag.

Notes on scope

  • HTTP bridge mask, the lower-layer public Responses / compact previous_response_not_found -> stream_incomplete guard, and the registry plan-filter no_plan_support_for_model 503 fix all read cleanly.
  • The model registry plan-filter change is well-scoped: only apply the filter when the registry has an authoritative entry, and invalidate cached selection inputs on refresh. The fact that it's bundled with the previous-response masking is justified in your PR body (same live incident window), so I won't push to split it.
  • OpenSpec change folder is in place.

Once the P1 fix lands I'll re-run @codex review and queue for merge.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

@JeffKandt

Copy link
Copy Markdown

I let a local mitigation soak for several days and wanted to share the result because it may be useful for this PR.

Context: I initially staged PR #516 at the earlier head 368e287 and cut it over to live Codex Desktop traffic. That was necessary, but not sufficient in my local environment: I still saw raw downstream previous_response_not_found errors interrupt Desktop sessions. In at least one incident, request_logs had already normalized the request to stream_incomplete, while the raw upstream JSON still reached the client.

My local follow-up added a last-chance downstream WebSocket send / error-serializer sanitizer: if any outbound WebSocket payload still contains upstream previous_response_not_found, it is rewritten to fail closed as 502 stream_incomplete before reaching the client.

After several days of normal use:

  • request_logs has 0 raw previous_response_not_found / Previous response with id ... not found rows since the final local patch
  • I have not seen the user-visible Desktop interruption recur
  • the service still logs internal fail-closed catches for this class; I see 18 continuity_fail_closed ... previous_response_not_found events with hashed response ids, which suggests upstream still occasionally produces the miss but the downstream boundary prevents it leaking to the client
  • remaining client-visible failures are masked shapes such as stream_incomplete, not raw missing-response-id errors

I have not yet validated the current PR head 6854f57 directly, and I see the maintainer P1 about direct WebSocket full-resend retries. I just wanted to pass along the local soak finding: in addition to the request-state / retry-path fixes, a final downstream WebSocket send/serializer mask appears valuable as a belt-and-suspenders guard, because the raw upstream payload can otherwise survive past request-log normalization.

Komzpa added 2 commits May 12, 2026 19:42
(cherry picked from commit 443feae6f9ea19c9b28c91eb95dd2268bd194b03)
(cherry picked from commit 6854f57dc32c37a9fd6b4f59a14ae0774e406fcc)
@Komzpa
Komzpa force-pushed the codex/mask-single-previous-response-miss branch from 6854f57 to a36b80e Compare May 12, 2026 15:43
Addresses codex-review P1 on the prior revision: a direct WebSocket
turn whose semantic payload does not depend on the upstream anchor
(no client-supplied `previous_response_id` and no proxy-injected
anchor) was falling through to `stream_incomplete` after a
`previous_response_not_found` error, instead of being transparently
retried on a fresh upstream.

The retry path in `_process_upstream_websocket_text` only attempts a
reconnect-and-replay for a request flagged
`fresh_upstream_request_is_retry_safe` with a populated
`fresh_upstream_request_text`. The HTTP-bridge prep path already
sets those flags; the direct WebSocket prep path
(`_prepare_websocket_response_create_request`) did not, so every
direct-WebSocket recovery short-circuited into the fail-closed
branch -- including full-resend / fresh-turn variants that this PR
explicitly wants to keep recovering.

Mirror the classification in the direct WebSocket prep path: when a
turn has no client-supplied `previous_response_id` and no
proxy-injected anchor, populate both fields so the masking path
treats both transport variants identically.

Tests:

- New integration test
  `test_v1_responses_websocket_marks_fresh_turn_as_retry_safe_at_prep_time`
  pins that connecting an upstream for a fresh-turn direct
  WebSocket request observes
  `fresh_upstream_request_is_retry_safe=True` and a populated
  `fresh_upstream_request_text` at prep time.
- Updated `test_process_upstream_websocket_text_retries_precreated_previous_response_not_found`
  in `tests/unit/test_proxy_utils.py` to drive the retry path with
  the new retry-safety contract: `fresh_upstream_request_text` and
  `fresh_upstream_request_is_retry_safe=True` on the pending request
  state, and asserts the retry strips the stale
  `previous_response_id`, uses the fresh text, and consumes the
  retry-safety flag.
- Full direct-WebSocket integration suite (38 tests) and
  proxy_utils / proxy_http_bridge / proxy_load_balancer_refresh
  unit suite (346 passing, 3 pre-existing skips) green.
@Soju06

Soju06 commented May 13, 2026

Copy link
Copy Markdown
Owner

Pushed 713ef42 to address codex review's P1 (direct WebSocket fresh-turn retry must not fall through to stream_incomplete).

What the fix does

The retry path in _process_upstream_websocket_text only attempts a reconnect-and-replay for a request flagged fresh_upstream_request_is_retry_safe with a populated fresh_upstream_request_text. The HTTP-bridge prep path already sets those flags. The direct WebSocket prep path (_prepare_websocket_response_create_request) did not, so every direct-WebSocket recovery short-circuited into retry_error_code = None -- including the full-resend / fresh-turn variants this PR explicitly wants to keep recovering. That's the regression codex review flagged.

Mirror the classification in the direct WebSocket prep path: when a turn has no client-supplied previous_response_id and no proxy-injected anchor, populate both fresh_upstream_request_text and fresh_upstream_request_is_retry_safe = True so the masking path treats both transport variants identically.

Why the classification is safe

The two conditions that gate the new flag — payload.previous_response_id is None and not request_state.proxy_injected_previous_response_id — together rule out the only path that could make a replay re-surface the same stale anchor:

  • payload.previous_response_id is None => the client did not pin a specific upstream response, so a fresh upstream turn carries no previous_response_id.
  • not proxy_injected_previous_response_id => codex-lb did not inject one either (the HTTP-bridge path is the only place that does, and it manages its own retry-safety classification).

Anything else (short continuation, anchored follow-up, proxy-injected anchor) leaves the flag at its default False, so the existing retry_error_code = None fail-closed path still applies.

Tests

New integration (tests/integration/test_proxy_websocket_responses.py):
test_v1_responses_websocket_marks_fresh_turn_as_retry_safe_at_prep_time pins that connecting an upstream for a fresh-turn direct WebSocket request observes fresh_upstream_request_is_retry_safe=True and a populated fresh_upstream_request_text at prep time.

Updated unit (tests/unit/test_proxy_utils.py):
test_process_upstream_websocket_text_retries_precreated_previous_response_not_found now drives the retry path with the new retry-safety contract on the pending request state and asserts:

  • The retry strips the stale previous_response_id (pending_request.previous_response_id is None).
  • The retry uses the prepared retry-safe text (pending_request.request_text == fresh_request_payload).
  • The retry-safety flag is consumed (fresh_upstream_request_is_retry_safe is False).
  • replay_count is incremented, upstream_control.replay_request_state is pending_request, and reconnect_requested is True.

Verification on this head

uv run ruff check app/modules/proxy/service.py tests/integration/test_proxy_websocket_responses.py tests/unit/test_proxy_utils.py     # clean
uv run ruff format --check app/modules/proxy/service.py tests/integration/test_proxy_websocket_responses.py tests/unit/test_proxy_utils.py  # clean
uv run ty check app/modules/proxy/service.py                                                                                                  # clean
uv run pytest tests/integration/test_proxy_websocket_responses.py -q                                                                          # 38 passed
uv run pytest tests/unit/test_proxy_utils.py tests/unit/test_proxy_http_bridge.py tests/unit/test_proxy_load_balancer_refresh.py -q          # 346 passed, 3 skipped

Re-triggering @codex review.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

ℹ️ 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".

- E501: wrap long docstring referencing the inverse test name
- F841: drop unused `downstream_text` assignment

No behavior change.
@Soju06

Soju06 commented May 13, 2026

Copy link
Copy Markdown
Owner

Pushed 93043c6 to fix the ruff Lint failure on the new direct-WebSocket retry-safe test in tests/unit/test_proxy_utils.py:

  • E501: wrapped the long docstring referencing the inverse test name.
  • F841: dropped the unused downstream_text assignment (the test only asserts on upstream_control / pending_request state).

No behavior change; the test still passes locally (pytest -q tests/unit/test_proxy_utils.py -k retries_precreated_previous_response_not_found).

CI is now rerunning against the new head.

@Soju06
Soju06 merged commit 67cc11f into Soju06:main May 13, 2026
18 checks passed
@Soju06

Soju06 commented May 13, 2026

Copy link
Copy Markdown
Owner

@all-contributors please add @Komzpa for code, test, doc

@allcontributors

Copy link
Copy Markdown
Contributor

@Soju06

@Komzpa already contributed before to code, test, doc

@Soju06

Soju06 commented May 13, 2026

Copy link
Copy Markdown
Owner

@all-contributors please add @Komzpa for code, bug

@allcontributors

Copy link
Copy Markdown
Contributor

@Soju06

I've put up a pull request to add @Komzpa! 🎉

@Soju06

Soju06 commented May 13, 2026

Copy link
Copy Markdown
Owner

@all-contributors please add @mgwals for test, review

@Soju06

Soju06 commented May 13, 2026

Copy link
Copy Markdown
Owner

@all-contributors please add @jumski for test

@Soju06

Soju06 commented May 13, 2026

Copy link
Copy Markdown
Owner

@all-contributors please add @JeffKandt for test, review

@allcontributors

Copy link
Copy Markdown
Contributor

@Soju06

I've put up a pull request to add @mgwals! 🎉

@allcontributors

Copy link
Copy Markdown
Contributor

@Soju06

I've put up a pull request to add @jumski! 🎉

@allcontributors

Copy link
Copy Markdown
Contributor

@Soju06

I've put up a pull request to add @JeffKandt! 🎉

Soju06 added a commit that referenced this pull request May 17, 2026
Release 1.18.0 — v1.17.0 → main, 27 PR.

## Pre-merge verification (release-gate e2e)

- ✅ CI 18/18 (mergeStateStatus CLEAN)
- ✅ baseline release-gate-smoke: 10/10 (`v1.models`, chat non-stream/stream/tool_call, responses non-stream/stream, unknown-msg-key drop, transient codes, dashboard 72-byte, alembic index)
- ✅ per-PR e2e extra: 14/14 (#658 strict tool × chat valid/invalid/type-omitted + responses invalid, #650-652 trim replay markers, #516 prev-resp miss mask, #558 prolite plan, #600 token_expired, #635 device poll, #647 frontend 72B, #594 account selection, #640 alembic head, #653/#654 conv archive, #655/#656 weekly pace)
- ✅ pytest 562 passed / 3 PG-only skip (unit + integration suite)
- ✅ SDK e2e 20/20 (`tests/e2e/test_openai_sdk_compat.py` + `tests/e2e/test_v1_responses_openai_sdk.py`)
- ✅ `scripts/verify_v1_responses_openai_sdk.py` 5/5 against live container with real account
- ✅ ruff check + ruff format --check + uv run ty check — All clean
- ✅ prod parity probe: #637 (unknown-key drop) + #658 (strict tool 400) both confirmed fixed vs prod 1.17.0

## Behavior change to note in announcements

- **#658**: `strict: true` function tool schemas missing `additionalProperties: false` (or other strict-mode requirements) now return a local **400 `invalid_function_parameters`** with `param=tools[N].function.parameters` (chat) / `tools[N].parameters` (responses). Pre-1.18.0 these were silently forwarded upstream; 1.18.0 enforces OpenAI's documented strict-mode contract locally before forwarding.

OpenSpec changes shipped in this release (to be archived after tag publish):
- deactivate-on-token-expired (#600)
- drop-unknown-message-fields (#637)
- mask-single-http-previous-response-miss (#516)
- normalize-v1-responses-openai-sdk-stream (#639)
- start-device-oauth-polling (#635)
- support-prolite-plan-capacity (#558)
- treat-upstream-overloaded-as-retryable (#601)
- validate-password-length (#598)
- validate-strict-function-tool-schema (#658)
Soju06 added a commit that referenced this pull request May 17, 2026
Archive changes shipped in v1.18.0 and v1.18.1 per AGENTS.md
"release 이후 archive" workflow. All 12 changes verified shipped in
production at 10.0.0.113 (image 1.18.1, sha256:0431a474432d).

1.18.0 (9 changes):
- deactivate-on-token-expired (#600)
- drop-unknown-message-fields (#637)
- mask-single-http-previous-response-miss (#516)
- normalize-v1-responses-openai-sdk-stream (#639)
- start-device-oauth-polling (#635) [delta header fixed: MODIFIED -> ADDED]
- support-prolite-plan-capacity (#558) [delta header fixed: MODIFIED -> ADDED]
- treat-upstream-overloaded-as-retryable (#601)
- validate-password-length (#598)
- validate-strict-function-tool-schema (#658)

1.18.1 (3 changes):
- harden-long-codex-websocket-turns (#586)
- suppress-duplicate-side-effect-tool-calls (#586)
- hotfix-db-pool-pre-ping-and-firewall-cache-ttl (#679)

Specs updated: 9 capabilities (admin-auth, api-firewall, chat-completions-compat,
chat-completions-extensions, database-backends, frontend-architecture,
responses-api-compat, usage-refresh-policy).

openspec validate --specs: 19/19 passed.

Co-authored-by: Hermes Agent <[email protected]>
vitalNohj pushed a commit to vitalNohj/codex-lb that referenced this pull request Jul 17, 2026
* fix(proxy): mask single previous response misses

(cherry picked from commit 443feae6f9ea19c9b28c91eb95dd2268bd194b03)

* fix(proxy): fail closed for direct websocket anchor misses

(cherry picked from commit 6854f57dc32c37a9fd6b4f59a14ae0774e406fcc)

* fix(proxy): classify direct WebSocket fresh turns as retry-safe

Addresses codex-review P1 on the prior revision: a direct WebSocket
turn whose semantic payload does not depend on the upstream anchor
(no client-supplied `previous_response_id` and no proxy-injected
anchor) was falling through to `stream_incomplete` after a
`previous_response_not_found` error, instead of being transparently
retried on a fresh upstream.

The retry path in `_process_upstream_websocket_text` only attempts a
reconnect-and-replay for a request flagged
`fresh_upstream_request_is_retry_safe` with a populated
`fresh_upstream_request_text`. The HTTP-bridge prep path already
sets those flags; the direct WebSocket prep path
(`_prepare_websocket_response_create_request`) did not, so every
direct-WebSocket recovery short-circuited into the fail-closed
branch -- including full-resend / fresh-turn variants that this PR
explicitly wants to keep recovering.

Mirror the classification in the direct WebSocket prep path: when a
turn has no client-supplied `previous_response_id` and no
proxy-injected anchor, populate both fields so the masking path
treats both transport variants identically.

Tests:

- New integration test
  `test_v1_responses_websocket_marks_fresh_turn_as_retry_safe_at_prep_time`
  pins that connecting an upstream for a fresh-turn direct
  WebSocket request observes
  `fresh_upstream_request_is_retry_safe=True` and a populated
  `fresh_upstream_request_text` at prep time.
- Updated `test_process_upstream_websocket_text_retries_precreated_previous_response_not_found`
  in `tests/unit/test_proxy_utils.py` to drive the retry path with
  the new retry-safety contract: `fresh_upstream_request_text` and
  `fresh_upstream_request_is_retry_safe=True` on the pending request
  state, and asserts the retry strips the stale
  `previous_response_id`, uses the fresh text, and consumes the
  retry-safety flag.
- Full direct-WebSocket integration suite (38 tests) and
  proxy_utils / proxy_http_bridge / proxy_load_balancer_refresh
  unit suite (346 passing, 3 pre-existing skips) green.

* style(tests): fix ruff lint on direct WebSocket retry-safe test

- E501: wrap long docstring referencing the inverse test name
- F841: drop unused `downstream_text` assignment

No behavior change.

---------

Co-authored-by: Soju06 <[email protected]>
vitalNohj pushed a commit to vitalNohj/codex-lb that referenced this pull request Jul 17, 2026
Release 1.18.0 — v1.17.0 → main, 27 PR.

## Pre-merge verification (release-gate e2e)

- ✅ CI 18/18 (mergeStateStatus CLEAN)
- ✅ baseline release-gate-smoke: 10/10 (`v1.models`, chat non-stream/stream/tool_call, responses non-stream/stream, unknown-msg-key drop, transient codes, dashboard 72-byte, alembic index)
- ✅ per-PR e2e extra: 14/14 (Soju06#658 strict tool × chat valid/invalid/type-omitted + responses invalid, Soju06#650-652 trim replay markers, Soju06#516 prev-resp miss mask, Soju06#558 prolite plan, Soju06#600 token_expired, Soju06#635 device poll, Soju06#647 frontend 72B, Soju06#594 account selection, Soju06#640 alembic head, Soju06#653/Soju06#654 conv archive, Soju06#655/Soju06#656 weekly pace)
- ✅ pytest 562 passed / 3 PG-only skip (unit + integration suite)
- ✅ SDK e2e 20/20 (`tests/e2e/test_openai_sdk_compat.py` + `tests/e2e/test_v1_responses_openai_sdk.py`)
- ✅ `scripts/verify_v1_responses_openai_sdk.py` 5/5 against live container with real account
- ✅ ruff check + ruff format --check + uv run ty check — All clean
- ✅ prod parity probe: Soju06#637 (unknown-key drop) + Soju06#658 (strict tool 400) both confirmed fixed vs prod 1.17.0

## Behavior change to note in announcements

- **Soju06#658**: `strict: true` function tool schemas missing `additionalProperties: false` (or other strict-mode requirements) now return a local **400 `invalid_function_parameters`** with `param=tools[N].function.parameters` (chat) / `tools[N].parameters` (responses). Pre-1.18.0 these were silently forwarded upstream; 1.18.0 enforces OpenAI's documented strict-mode contract locally before forwarding.

OpenSpec changes shipped in this release (to be archived after tag publish):
- deactivate-on-token-expired (Soju06#600)
- drop-unknown-message-fields (Soju06#637)
- mask-single-http-previous-response-miss (Soju06#516)
- normalize-v1-responses-openai-sdk-stream (Soju06#639)
- start-device-oauth-polling (Soju06#635)
- support-prolite-plan-capacity (Soju06#558)
- treat-upstream-overloaded-as-retryable (Soju06#601)
- validate-password-length (Soju06#598)
- validate-strict-function-tool-schema (Soju06#658)
vitalNohj pushed a commit to vitalNohj/codex-lb that referenced this pull request Jul 17, 2026
…u06#682)

Archive changes shipped in v1.18.0 and v1.18.1 per AGENTS.md
"release 이후 archive" workflow. All 12 changes verified shipped in
production at 10.0.0.113 (image 1.18.1, sha256:0431a474432d).

1.18.0 (9 changes):
- deactivate-on-token-expired (Soju06#600)
- drop-unknown-message-fields (Soju06#637)
- mask-single-http-previous-response-miss (Soju06#516)
- normalize-v1-responses-openai-sdk-stream (Soju06#639)
- start-device-oauth-polling (Soju06#635) [delta header fixed: MODIFIED -> ADDED]
- support-prolite-plan-capacity (Soju06#558) [delta header fixed: MODIFIED -> ADDED]
- treat-upstream-overloaded-as-retryable (Soju06#601)
- validate-password-length (Soju06#598)
- validate-strict-function-tool-schema (Soju06#658)

1.18.1 (3 changes):
- harden-long-codex-websocket-turns (Soju06#586)
- suppress-duplicate-side-effect-tool-calls (Soju06#586)
- hotfix-db-pool-pre-ping-and-firewall-cache-ttl (Soju06#679)

Specs updated: 9 capabilities (admin-auth, api-firewall, chat-completions-compat,
chat-completions-extensions, database-backends, frontend-architecture,
responses-api-compat, usage-refresh-policy).

openspec validate --specs: 19/19 passed.

Co-authored-by: Hermes Agent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants