Skip to content

test(desktop-backend): bypass proxies for loopback tests#9725

Merged
kodjima33 merged 1 commit into
BasedHardware:mainfrom
tianmind-studio:codex/windows-rust-proxy-test-waits
Jul 17, 2026
Merged

test(desktop-backend): bypass proxies for loopback tests#9725
kodjima33 merged 1 commit into
BasedHardware:mainfrom
tianmind-studio:codex/windows-rust-proxy-test-waits

Conversation

@tianmind-studio

@tianmind-studio tianmind-studio commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

What changed and why

Closes #9722.

Use a shared test-only reqwest client with system proxies disabled for the four proxy cancellation tests backed by an in-process loopback listener. This keeps production proxy behavior unchanged while making the tests deterministic on Windows hosts with a user proxy enabled.

Product invariants affected

none

How it was verified

Verified on Windows 11 with the user proxy still enabled at 127.0.0.1:7897:

  • Before the fix, the four cancellation/disconnect tests consistently failed because reqwest received a proxy-generated 502 and the loopback listener never saw the request.
  • cargo test routes::proxy::tests:: -> 87 passed
  • cargo test -> 360 passed
  • cargo fmt --check -> passed
  • cargo clippy -- -D warnings -> passed
  • scripts/pre-push fork -> passed all selected checks with PYTHONUTF8=1 and the internal-only changelog skip

The actual push used --no-verify only after the equivalent pre-push command passed because the single-flight hook wrapper currently crashes on Windows; #9724 tracks that separate issue.

Tests

The four existing loopback cancellation tests are the regression coverage. They fail on the old code when a Windows system proxy is enabled and pass with the test client isolated from host proxy settings.

Root cause and durable guard (bug fixes)

The violated contract was that an in-process loopback test server must receive the test request directly. reqwest::Client::new() honors the Windows user proxy, and that proxy can intercept 127.0.0.1 requests before they reach the test listener.

All four affected tests now obtain their client from one local_test_client() helper that calls .no_proxy(). The production Gemini clients are untouched, and future loopback cancellation coverage in this module has a single portable client factory to reuse.

Review in cubic

@tianmind-studio

Copy link
Copy Markdown
Contributor Author

This is an internal test-harness-only change, so it intentionally has no user-facing changelog fragment. Please add the no-changelog-needed label when triaging.

@Git-on-my-level

Copy link
Copy Markdown
Collaborator

Nice, well-scoped fix. The local_test_client() helper with .no_proxy() is the right pattern for loopback-backed tests — reqwest::Client::new() honoring system proxies on Windows is a real source of flakiness, and isolating the test client from host proxy settings while leaving gemini_client()/gemini_stream_client() untouched is exactly the correct separation. The shared helper also makes future loopback tests in this module more consistent.

One note on CI: the context shows a cancelled Hygiene run, but the latest Hygiene run on this head actually completed as success, and Rust Backend passed — so the flaky/cancelled check doesn't reflect the current state. Not blocking.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good; not auto-merging (over scope/size or non-bug area), landing left to maintainer.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test(desktop-backend): bypass proxies for loopback tests; CI green

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test(desktop-backend): bypass proxies for loopback tests; CI green

@kodjima33
kodjima33 merged commit 4d5db76 into BasedHardware:main Jul 17, 2026
24 of 25 checks passed
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.

Rust proxy cancellation tests fail behind a Windows system proxy

3 participants