Skip to content

feat(proxy): report websocket cleanup phase - #1726

Open
kevinsslin wants to merge 2 commits into
Soju06:mainfrom
kevinsslin:codex/websocket-cleanup-phase
Open

feat(proxy): report websocket cleanup phase#1726
kevinsslin wants to merge 2 commits into
Soju06:mainfrom
kevinsslin:codex/websocket-cleanup-phase

Conversation

@kevinsslin

Copy link
Copy Markdown

Summary

Adds low-cardinality phase attribution to the existing WebSocket scope cleanup timeout warning, so operators can tell whether cleanup is blocked in upstream close, reader observation, request finalization, or lease release without enabling noisy per-step logs.

Type of change

  • fix: — bug fix (no behavior change beyond the bug)
  • feat: — new user-facing feature or capability
  • refactor: — internal refactor (no behavior change, no API change)
  • docs: — documentation only
  • chore: / ci: / build: — tooling, CI, packaging
  • test: — test-only change
  • Breaking change

Linked issue: Closes #1724

OpenSpec

  • This PR includes / updates an OpenSpec change
  • Not applicable — bug fix that matches the existing spec
  • Not applicable — docs / CI / chore only
  • This PR touches a codex-faithful path and preserves upstream-equivalent behavior

Change directory: openspec/changes/attribute-websocket-scope-cleanup-phase/

Changes

  • Tracks the currently awaited finalization operation with a fixed local phase value.
  • Adds cleanup_phase=<phase> to the existing cleanup-budget warning.
  • Adds a route-level regression proving blocked pending-request finalization reports pending_requests while remaining background-drain-owned.
  • Preserves cleanup order, timeout budgets, retries, task ownership, APIs, and settings.

Simplicity

  • Works with zero config and adds no setting or setup step.
  • No README, .env.example, dashboard navigation, or default changes.

Test plan

uv run pytest tests/unit/test_websocket_terminal_cancellation.py -q
# 26 passed

uv run pytest tests/integration/test_proxy_websocket_responses.py -q
uv run pytest tests/integration/test_graceful_websocket_process_shutdown.py -q
# passed

PATH="$PWD/.venv/bin:$PATH" make lint
# proxy architecture, ruff check, and format passed

make typecheck
# ty passed

npx --yes @fission-ai/openspec@latest validate attribute-websocket-scope-cleanup-phase --strict
# valid

The full local-ci parity hook reached the PostgreSQL target after its frontend/backend gates, then failed during migration-test collection because no PostgreSQL server was listening on local 127.0.0.1:5432. This PR changes no DB or migration files; the required GitHub PostgreSQL jobs remain authoritative for that environment-backed gate.

Screenshots / output

Before:

Websocket scope cleanup exceeded its remaining drain budget timeout_seconds=0.100 background_cleanup_tasks=1

After:

Websocket scope cleanup exceeded its remaining drain budget timeout_seconds=0.100 cleanup_phase=pending_requests background_cleanup_tasks=1

The phase is a fixed low-cardinality value and does not contain request IDs, account IDs, payloads, credentials, or exception content.

Checklist

  • Title is in Conventional Commits format.
  • Linked the related issue.
  • Added tests covering the change and confirmed the regression fails before the implementation.
  • Ran relevant local lint, type, unit, integration, and strict OpenSpec checks.
  • Documented the environment-only PostgreSQL limitation of the full local gate.
  • Simplicity gates reviewed.
  • CHANGELOG is not edited by hand.

@kevinsslin
kevinsslin marked this pull request as ready for review August 14, 2026 04:10
kevinsslin added a commit to kevinsslin/codex-lb that referenced this pull request Aug 14, 2026
Integrates the reviewed transport reliability fixes from upstream PRs Soju06#1723, Soju06#1726, and Soju06#1736 into the production fork main after combined local validation.
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.

feat(proxy): report blocked websocket scope cleanup phase

2 participants