Skip to content

fix: route HttpProxySink timeouts through spool fallback#3647

Open
atimothee wants to merge 1 commit into
openai:mainfrom
atimothee:atimothee/fix-http-proxy-sink-timeout-spool
Open

fix: route HttpProxySink timeouts through spool fallback#3647
atimothee wants to merge 1 commit into
openai:mainfrom
atimothee:atimothee/fix-http-proxy-sink-timeout-spool

Conversation

@atimothee

Copy link
Copy Markdown

Summary

HttpProxySink._post() only caught HTTPError and URLError, so a TimeoutError (for example a socket-level connect timeout, or any other low-level OSError such as ConnectionRefusedError) bypassed the configured spool_path fallback and surfaced the raw exception to callers instead of the sink's RuntimeError wrapper.

This change catches TimeoutError and OSError alongside the existing URL errors so the spool write and the sink's RuntimeError wrapper are exercised consistently for every delivery failure, restoring the configured fallback behavior. A short comment documents why the wider exception list is intentional.

Test plan

  • Added a parametrized regression test (tests/sandbox/test_session_sinks.py::test_http_proxy_sink_writes_spool_on_timeout_or_oserror) that patches urllib.request.urlopen in the sinks module to raise TimeoutError and OSError in turn, asserts the sink raises RuntimeError with the expected message, and asserts the spool file contains the serialized event line.
  • Ran uv run pytest tests/sandbox/test_session_sinks.py -v -k test_http_proxy_sink_writes_spool_on_timeout_or_oserror (both parametrized cases pass).
  • Ran uv run pytest tests/sandbox/ -q — 806 passed, 19 skipped (no regressions).
  • Ran make format and uv run ruff check/uv run mypy/uv run pyright against the changed files — all clean.

Issue number

Closes #3641

Checks

  • I've added new tests (if relevant)
  • I've added/updated the relevant documentation
  • I've run make lint and make format
  • I've made sure tests pass

Made with Cursor

`HttpProxySink._post()` only caught `HTTPError` and `URLError`, so a
`TimeoutError` (e.g. a socket-level connect timeout) bypassed the
configured spool path and surfaced the raw exception to callers.

Catch `TimeoutError` and `OSError` alongside the existing URL errors so
the spool write and the sink's `RuntimeError` wrapper are exercised
consistently for all delivery failures, and add a regression test that
patches `urlopen` to raise each error type.

Fixes openai#3641
@seratch seratch added duplicate This issue or pull request already exists feature:sandboxes labels Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists feature:sandboxes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HttpProxySink timeout failures can skip the configured spool fallback

2 participants