Repository navigation
fix(llm-client): fall back when an upstream connect times out - #854
ting-hong-shieh wants to merge 2 commits into
Conversation
Signed-off-by: Ting-Hong Shieh <shiehharry@gmail.com>
Signed-off-by: Ting-Hong Shieh <shiehharry@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (4)
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review. WalkthroughConnect errors, including connect timeouts, are classified as ChangesLLM candidate fallback
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~12 minutes Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The change permits fallback for connection failures while preserving request-wide timeout behavior. No concrete merge-blocking issue is established. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Linked Issues checkExplanation [ Resolution Update the retry/deadline handling so repeated connection-refused failures in the
A rabbit heard the first call fail, Comment |
What
Classify an upstream connect timeout as
Transport, so completion routing can try the next candidate after retries are exhausted.Why
Closes #853. Reqwest reports connect timeouts as both
is_connect()andis_timeout(). Checking timeout first producesTimeout, which stops candidate fallback. Checking connect first treats the failed connection like other connection failures.Notes for reviewers
Start with
convert_reqwest_errorincrates/libsy-llm-client/src/client.rs.timeout_ms, including expiry during a connect, remainTimeoutand stop completion candidate fallback.upstream_errorinstead of 504upstream_timeout.fail_openpolicy; this PR adds no judge recovery policy. As with other transport failures, a redirected request may already have reached an earlier endpoint before a later connection fails.The Linux connect-timeout regression fills a listener's accept queue and uses a 100 ms connect timeout. It checks that the source is a reqwest error with both connect and timeout flags, classified as
Transport. Reverting the classification to timeout-first makes it fail withTimeout. The refused-connection routing test checks the existing fallback path and passes on main as well.The branch includes current main, and the fallback fixture explicitly disables failure cooldown.
Validation
At
ad10acc0:cargo fmt --all --check: passed.cargo clippy --workspace --all-targets --locked -- -D warnings: passed.cargo test --workspace --locked: 925 passed, 1 ignored (external handoff fixture).cargo clippy -p switchyard-server --all-targets --features prefill-router --locked -- -D warnings: passed.cargo test -p switchyard-runner --features prefill-router --locked: 68 passed.maturin develop --locked --uv: passed with Python 3.14.uv run --no-sync ruff check .anduv run --no-sync mypy switchyard: passed.uv run --no-sync pytest tests/ -v -m "not integration": 187 passed, 2 deselected, 2 subtests passed.uv run --no-sync mkdocs build --strict: passed with the locked docs dependency group.No live provider call was made.
Summary by CodeRabbit