fix(http): bump read/write timeout to 10s and reword timeout error#1344
Merged
Conversation
The shared httpx.AsyncClient was constructed with a flat `timeout=5.0`,
which httpx applies to every phase. GitHub's PR create/update regularly
takes longer than 5s under load, so transient slowdowns abort
`mergify stack push` mid-stack with `httpx.ReadTimeout` even though the
request was already sent and likely accepted server side.
Switch to `httpx.Timeout(5.0, read=10.0, write=10.0)`: 10s absorbs
common hiccups while staying snappy enough for an interactive CLI to
fail fast on real outages — and `discover_changes`' `head:` search
makes re-running the push safe (already-created PRs are detected).
Also reword the friendly `httpx.RequestError` handler in `main()`: name
the upstream ("GitHub did not respond in time. The request was aborted
— please retry.") instead of pasting the raw URL and suggesting a
network check, which conflates a slow upstream with a broken network.
Change-Id: Iac0f395e9f207d1c997d30dacdf385ecfdfb6fd0
Contributor
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 🤖 Continuous IntegrationWonderful, this rule succeeded.
🟢 👀 Review RequirementsWonderful, this rule succeeded.
🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 🔎 ReviewsWonderful, this rule succeeded.
🟢 📕 PR descriptionWonderful, this rule succeeded.
|
There was a problem hiding this comment.
Pull request overview
Adjusts the shared httpx.AsyncClient timeout policy and refreshes CLI transport-error messaging so interactive commands are less likely to fail on transient slow GitHub responses.
Changes:
- Replaced the flat 5s HTTP timeout with structured
httpx.Timeout(..., read=10.0, write=10.0). - Added a utility test that locks in the new connect/pool/read/write timeout values.
- Reworded CLI request-error output and updated CLI tests to match the new user-facing messages.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
mergify_cli/utils.py |
Changes the default async HTTP client timeout configuration used across the CLI. |
mergify_cli/tests/test_utils.py |
Adds regression coverage for the structured timeout settings. |
mergify_cli/tests/test_cli.py |
Updates CLI tests for the revised timeout/network error wording. |
mergify_cli/cli.py |
Refactors request-error handling to derive service name/exit code and emit new messages. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jd
approved these changes
May 4, 2026
kozlek
reviewed
May 5, 2026
kozlek
approved these changes
May 5, 2026
Contributor
Author
|
This pull request is part of a Mergify stack:
|
Contributor
Merge Queue Status
This pull request spent 1 minute 26 seconds in the queue, including 1 second running CI. Required conditions to merge
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The shared httpx.AsyncClient was constructed with a flat
timeout=5.0,which httpx applies to every phase. GitHub's PR create/update regularly
takes longer than 5s under load, so transient slowdowns abort
mergify stack pushmid-stack withhttpx.ReadTimeouteven though therequest was already sent and likely accepted server side.
Switch to
httpx.Timeout(5.0, read=10.0, write=10.0): 10s absorbscommon hiccups while staying snappy enough for an interactive CLI to
fail fast on real outages — and
discover_changes'head:searchmakes re-running the push safe (already-created PRs are detected).
Also reword the friendly
httpx.RequestErrorhandler inmain(): namethe upstream ("GitHub did not respond in time. The request was aborted
— please retry.") instead of pasting the raw URL and suggesting a
network check, which conflates a slow upstream with a broken network.