Skip to content

fix(proxy): use DEFAULT_HOME_DIR for oversized response.create dumps - #575

Merged
Soju06 merged 1 commit into
mainfrom
fix/oversized-dump-portable-path
May 10, 2026
Merged

Soju06 merged 1 commit into
mainfrom
fix/oversized-dump-portable-path

Conversation

@Soju06

@Soju06 Soju06 commented May 10, 2026

Copy link
Copy Markdown
Owner

Why

#560 (commit e42af5e, reverted in #569 / commit 9910e95) was reverted because of layering issues with its history-slimming behavior. But it also bundled an unrelated, correct fix for #556: the oversized response.create payload dump path was hardcoded to /var/lib/codex-lb/debug/response-create-dumps. That path is fine inside the container image (where DEFAULT_HOME_DIR resolves to /var/lib/codex-lb), but the #556 reporter's macOS uv tool / LaunchAgent install has no writable access to /var/lib/codex-lb, so the proxy's guarded oversized-payload dump silently fails to write.

When #560 was reverted, this portability fix was reverted with it, so #556 is currently re-opened. This PR re-lands only that one hunk on top of current main, with no other change from #560.

What changed

  • app/modules/proxy/service.py: import DEFAULT_HOME_DIR from app.core.config.settings and resolve _OVERSIZED_RESPONSE_CREATE_DUMP_DIR = DEFAULT_HOME_DIR / "debug" / "response-create-dumps" instead of the hardcoded absolute path.
  • app/modules/proxy/service.py: drop the now-unused from pathlib import Path import (it was only used by the hardcoded Path("/var/lib/...") literal).

That's the entire diff: +7 / -3, 1 file.

What this is not

  • Not the history-slimming behavior from #560. None of _slim_response_create_payload_for_upstream, _omit_historical_response_input_items_to_fit, or the omission notice items are touched.
  • Not the WebSocket bridge path. The dump fires inside _enforce_response_create_size_limit, which only runs when the proxy is guarding against an oversized request that already exceeds the upstream WebSocket frame budget. The dump is a debug artefact, not part of the request flow.
  • Not new functionality. The dump was always supposed to land somewhere writable; it just had the wrong absolute path baked in for non-container deploys.

Verification

Local on the fix branch:

$ uv run --frozen ruff check app tests             # All checks passed!
$ uv run --frozen ruff format --check app tests    # 426 files already formatted
$ uv run --frozen ty check app tests               # All checks passed!
$ uv run --frozen pytest tests/unit -q             # 1493 passed, 3 skipped, 4 warnings

Empirical verification on the rebuilt dev container:

$ docker exec codex-lb-dev-server python -c \
    "from app.core.config.settings import DEFAULT_HOME_DIR; \
     from app.modules.proxy.service import _OVERSIZED_RESPONSE_CREATE_DUMP_DIR; \
     print(DEFAULT_HOME_DIR, _OVERSIZED_RESPONSE_CREATE_DUMP_DIR)"
/var/lib/codex-lb /var/lib/codex-lb/debug/response-create-dumps

The container image's resolved path matches the previous hardcoded literal, so existing operators see no behavior change. macOS uv tool deploys now write to ~/.codex-lb/debug/response-create-dumps (or wherever DEFAULT_HOME_DIR resolves on that host) instead of failing.

Out of scope

  • The history-slimming approach from #560 stays out (see #568 / #569 for the broader design discussion). This PR is intentionally minimal: only the dump-path portability slice.

The oversized response.create payload dump dir was hardcoded to
`/var/lib/codex-lb/debug/response-create-dumps`. That path is correct
inside the container image (where DEFAULT_HOME_DIR resolves to
/var/lib/codex-lb), but on macOS `uv tool` / LaunchAgent installs the
process has no writable access to /var/lib/codex-lb and the dump path
silently fails when the proxy tries to write a guarded oversized
payload (originally reported in #556).

Resolve the dump dir from DEFAULT_HOME_DIR so the path tracks the
deploy's data directory:
- inside the container image: `/var/lib/codex-lb/debug/response-create-dumps` (unchanged)
- macOS `uv tool` install: `~/.codex-lb/debug/response-create-dumps`

This is the dump-path slice of the reverted #560 (#569). It does not
include any of the history-slimming changes from #560 -- only the
portable dump path, which has no transport-layer interaction and only
fires when the proxy is *guarding* against an oversized request that
already exceeds the upstream WebSocket frame budget.

Verified against the dev container: DEFAULT_HOME_DIR resolves to
`/var/lib/codex-lb`, dump_dir resolves to
`/var/lib/codex-lb/debug/response-create-dumps`, smoke test on
/v1/responses returns 'OK', and the existing test suite passes
(1493 passed, 3 skipped, 4 warnings).
@Soju06

Soju06 commented May 10, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

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

@Soju06
Soju06 merged commit ad5ebf8 into main May 10, 2026
18 checks passed
Soju06 added a commit that referenced this pull request May 10, 2026
Soju06 added a commit that referenced this pull request May 10, 2026
* chore(main): release 1.16.0

* docs(changelog): mark #560 reverted, fold #574 narrowing into #571 entry, add #569/#575
xirothedev added a commit to xirothedev/codex-lb that referenced this pull request May 10, 2026
…l fetch timeouts, image rewrite)

Upstream batch v1.16.0 highlights:
- proxy: expose drain status for graceful deploys (Soju06#564)
- proxy: narrow budget-safe gate to primary usage (Soju06#561)
- proxy: handle model fetch timeouts (Soju06#541)
- proxy: inline-rewrite input_image file references (Soju06#571)
- proxy: retry transient stream timeouts (Soju06#551)
- proxy: use DEFAULT_HOME_DIR for oversized response.create dumps (Soju06#575)
- accounts: split compact quota row + recover quota status (Soju06#562, Soju06#559)
- db: size background pool for burst traffic (Soju06#563)
- upstream: drop top_p for gpt-5 (Soju06#538)

Conflict resolved:
- app/modules/proxy/service.py: kept fork's multi-line import + FailurePhase
  (used by deterministic failover at line 8294).

Merge cleanup:
- app/main.py: removed pre-existing duplicate InFlightMiddleware class +
  duplicate _is_benign_metrics_bind_failure helper that shadowed canonical
  versions and broke new upstream test (test_in_flight_middleware_does_not_count_drain_status).

Verification:
- pytest tests/unit: 1459 passed, 17 failed (all pre-existing on backup
  branch backup/pre-upstream-merge-20260511 — date-bound API key tests,
  test_db_migrate.py SQLite env, settings duplicate validators).
- openspec validate --specs: 19/19 passed.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
vitalNohj pushed a commit to vitalNohj/codex-lb that referenced this pull request Jul 17, 2026
…oju06#575)

The oversized response.create payload dump dir was hardcoded to
`/var/lib/codex-lb/debug/response-create-dumps`. That path is correct
inside the container image (where DEFAULT_HOME_DIR resolves to
/var/lib/codex-lb), but on macOS `uv tool` / LaunchAgent installs the
process has no writable access to /var/lib/codex-lb and the dump path
silently fails when the proxy tries to write a guarded oversized
payload (originally reported in Soju06#556).

Resolve the dump dir from DEFAULT_HOME_DIR so the path tracks the
deploy's data directory:
- inside the container image: `/var/lib/codex-lb/debug/response-create-dumps` (unchanged)
- macOS `uv tool` install: `~/.codex-lb/debug/response-create-dumps`

This is the dump-path slice of the reverted Soju06#560 (Soju06#569). It does not
include any of the history-slimming changes from Soju06#560 -- only the
portable dump path, which has no transport-layer interaction and only
fires when the proxy is *guarding* against an oversized request that
already exceeds the upstream WebSocket frame budget.

Verified against the dev container: DEFAULT_HOME_DIR resolves to
`/var/lib/codex-lb`, dump_dir resolves to
`/var/lib/codex-lb/debug/response-create-dumps`, smoke test on
/v1/responses returns 'OK', and the existing test suite passes
(1493 passed, 3 skipped, 4 warnings).
vitalNohj pushed a commit to vitalNohj/codex-lb that referenced this pull request Jul 17, 2026
* chore(main): release 1.16.0

* docs(changelog): mark Soju06#560 reverted, fold Soju06#574 narrowing into Soju06#571 entry, add Soju06#569/Soju06#575
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.

1 participant