Repository navigation
Bound standalone urllib responses by wall clock - #1837
Conversation
Architecture-Review: unchanged; existing main-thread urllib consumers keep their transport and failure mapping, with a per-attempt deadline. Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero primary review by claude on f10d43ca92ac1d0b14145f3f403e41b8c5c517d3, 62.9s: approve (0 critical, 0 important, 2 suggestion)
Settings per native call (launch configuration and CLI claims, not backend attestation):
- Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)
Native Claude output is retained in the restricted local review receipt.
| assert home_lock_entries == [".codex-sync.lock"] * 2 | ||
|
|
||
|
|
||
| def test_provider_deadline_covers_http_error_body(helper, monkeypatch): |
There was a problem hiding this comment.
suggestion: ai-accounts deadline test covers only the error body and never checks that alarm state is restored
The new ai-accounts test only covers an HTTPError body read that times out. It never checks that the SIGALRM handler and ITIMER_REAL are restored afterwards. It also doesn't cover the headers phase, the success-body phase, or an alarm that fires during the cleanup finally (setitimer(0) raising before the handler is restored). Those are exactly the paths the acceptance criteria name ('interrupted cleanup restores the caller's handler'). The Mergify test covers them for _open, but _http has its own separate implementation. Smallest fix: parametrize the test like test_request_deadline (headers/body/cleanup), and after each case assert signal.getsignal(SIGALRM) is original and getitimer(ITIMER_REAL) == (0, 0).
| def expire(_signum, _frame): | ||
| raise _RequestDeadline() | ||
|
|
||
| if signal.getitimer(signal.ITIMER_REAL) != (0, 0): |
There was a problem hiding this comment.
suggestion: The two copies of the deadline guard check different preconditions
ai-accounts _http refuses to start when timeout <= 0 or a timer is already armed. Mergify _open only checks for an armed timer. With timeout=0, setitimer(ITIMER_REAL, 0) disarms the timer, so the request runs without a wall-clock bound. Today the only caller uses the default of 30, so this isn't a live bug. Keeping two copies is justified because the ai-accounts script runs standalone, but they should check the same things. Add the timeout <= 0 guard to _open, or drop the parameter.
|
@Mergifyio queue |
✅ Merged into
|
|
No description provided. |
Bound standalone urllib responses by wall clock
Context and goal
Supersedes #1776. Closes #1666.
Acceptance
Validation
Recorded for
f10d43ca92acuv run --group dev ruff check src tests: exit 0uv run --group dev tach check: exit 0uv run --python 3.14 python scripts/check_architecture_docs.py: exit 0scripts/size_budget.sh: exit 0uv run --group dev pytest -q: exit 0Review
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.