Skip to content

testproxy: forward upstream failures instead of retrying them - #8172

Merged
denik merged 2 commits into
mainfrom
denik/testproxy-no-retry
Nov 30, 2026
Merged

denik merged 2 commits into
mainfrom
denik/testproxy-no-retry

Conversation

@denik

@denik denik commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Changes

The acceptance test proxy (libs/testproxy) no longer retries. It forwards what upstream answered, failures included:

  • 429/503/504 are passed to the client after one attempt.
  • If the upstream connection fails before a response, the proxy resets the client's connection.
  • If the upstream response body is cut short, the client's body is cut short too.

The request recorder treats a response it never got (status 0) as transient, so the CLI's retry is dropped from out.requests.txt as it already is for 5xx.

Why

The proxy forwards through an SDK ApiClient, which retries 429, 503, some 504s and connection errors itself. Those failures never reached the CLI under test, so a Proxy = true test or a cloud recording run could not show whether the CLI handles them. This came up in #8133, where an injected fault hidden by the proxy would count as a pass.

The SDK retries some connection errors by message no matter what ErrorRetriable returns, so the proxy's transport replaces their message. Go's net/http still repeats an idempotent request that fails on a reused connection, as it does without the proxy.

Tests

New unit tests in libs/testproxy: retriable statuses, a connection reset and a truncated body each reach the client after exactly one upstream call. acceptance/selftest passes locally. Not run on cloud.

🤖 AI agent (opus5.5, isaac_claude)

This pull request and its description were written by Isaac.

Co-authored-by: Isaac <no-reply@databricks.com>
@github-actions github-actions Bot added the test-only-fix PRs that update failing of flaky tests without changing CLI code. label Nov 29, 2026
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: df324a7

Run: 46402052861

Env ✅​pass 🙈​skip Time
✅​ aws linux-2core-8gb 174 17 2:23
✅​ aws-windows-latest-4core-16gb 174 17 2:58
✅​ azure linux-2core-8gb 173 17 2:43
✅​ azure-windows-latest-4core-16gb 173 17 3:01
✅​ gcp linux-2core-8gb 174 17 2:48
✅​ gcp-windows-latest-4core-16gb 174 17 3:11
Top 3 slowest tests (at least 2 minutes):
duration env testname
3:09 gcp-windows-latest-4core-16gb TestAccept
2:59 azure-windows-latest-4core-16gb TestAccept
2:57 aws-windows-latest-4core-16gb TestAccept

@denik
denik marked this pull request as ready for review November 30, 2026 10:19
@denik
denik requested a review from a team as a code owner November 30, 2026 10:19

@pietern pietern left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we use a regular HTTP roundtripper with the SDK's authentication hook instead of patching ApiClient to make it not retry?

@review-oss-bot review-oss-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated review at c569ea3. Each finding was verified against the code.

No blocking issues found. 5 non-blocking comment(s) below.

This PR stops the test proxy from retrying, so 429/503/504, connection failures and cut-short bodies reach the CLI, and the recorder treats status 0 as transient. The retriable-status path looks right. The connection-failure paths sort errors in ways that don't match what happens on HTTP/2 cloud runs. A stream reset before headers turns into a TCP reset, which the CLI's SDK retries blindly, and body failures mid-read on HTTP/2 aren't detected at all. A few smaller points cover the fake 200 status, the dropped upstream error, and the hijack fallbacks.

Comment thread libs/testproxy/server.go Resolved
Comment thread libs/testproxy/server.go Resolved
Comment thread libs/testproxy/server.go Resolved
Comment thread libs/testproxy/server.go Resolved
Comment thread libs/testproxy/server.go Resolved
…t bodies

Errors other than connection failures, such as an HTTP/2 stream error before headers, now reach the client as a 500 with their text, as they do without the proxy. Before, the client got a connection reset and the SDK retried a create that recovery would have looked up. A body that upstream cuts short is truncated for the client with the upstream status, and both branches log the upstream error.

Co-authored-by: Isaac <no-reply@databricks.com>
@denik

denik commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

Re the review comment on the proxy's ApiClient (pietern): not changing this in this PR. A plain RoundTripper with the SDK's Authenticate hook would have to take over the error decoding the proxy relies on (it forwards APIError.ResponseWrapper bytes verbatim), plus the header handling that the ApiClient visitors do. That is a larger rewrite than this change. The no-retry behavior comes from ErrorRetriable, TransientErrors and the transport wrapper, and the fixes for the bot's review are in df324a7b8. If you still prefer the round tripper, I can do it as a follow-up. Leaving this for your call.

@denik
denik added this pull request to the merge queue Nov 30, 2026
Merged via the queue into main with commit b03a3f2 Nov 30, 2026
27 checks passed
@denik
denik deleted the denik/testproxy-no-retry branch November 30, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test-only-fix PRs that update failing of flaky tests without changing CLI code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants