Repository navigation
Conversation
The one-minute retry budget can expire while an attach RPC is in flight. Output.reattach then deliberately reports the budget's DeadlineExceeded instead of the server's Unavailable. On slow macOS runners the RPC window is wide enough for this to happen occasionally. Accept either code. Reproduced locally by delaying the attach handler by 1.5s: the old assertion fails with "expected: 0xe, actual: 0x4", the new one passes. Co-authored-by: Isaac <no-reply@databricks.com>
|
🤖 /trigger all AI agent (opus5.5, isaac_claude) |
✅ Integration test reportCommit: 4fa4c9b
Top 3 slowest tests (at least 2 minutes):
|
There was a problem hiding this comment.
Automated review at 4fa4c9b. Each finding was verified against the code.
No blocking issues found. 1 non-blocking comment(s) below.
This PR fixes the flaky TestOutputAttachRetryExhaustion/Unavailable by accepting DeadlineExceeded as well as the server's last code. Your diagnosis matches reattach in client.go: when the one-minute budget runs out during an in-flight attach, lines 197-198 replace the error with DeadlineExceeded. The catch is that the Unavailable subtest can no longer tell the two outcomes apart, so the flake is gone but so is the check. A deterministic fix would keep it.
| // The retry budget can expire while an attach is in flight (likely | ||
| // on slow runners); Output then reports the budget's DeadlineExceeded | ||
| // instead of the server's last code. | ||
| require.Contains(t, []codes.Code{code, codes.DeadlineExceeded}, status.Code(err)) |
There was a problem hiding this comment.
[nice to have] With DeadlineExceeded accepted, the Unavailable case passes the same check as the DeadlineExceeded case. A regression where reattach always returns the budget's error, for example client.go:214 returning status.FromContextError(retryCtx.Err()).Err(), would still pass: the duration and attach-count checks hold either way. The race exists because the time.Minute budget at client.go:163 is hard-coded. Could we make it injectable, the way lifetime is passed through Follow? Then each outcome can be pinned deterministically, and the test drops from about 60s to milliseconds. The other option is to have reattach return the last server error when the budget expires mid-attach, which makes the original require.Equal correct.
There was a problem hiding this comment.
🤖 Agreed: with DeadlineExceeded accepted, the Unavailable subtest can't catch a regression where reattach always returns the budget's error. No other test pins the server code on exhaustion either; TestOutputCancelsAttachRetry only checks Canceled.
There's no test-only way to close this. The outcome depends on whether the hard-coded time.Minute budget at client.go:163 expires during an attach RPC or during backoff, and the test can't control that without changing client.go. Both options you list change the production retry path. I'd rather keep this PR test-only so the flake fix lands, and do it in a follow-up. I lean toward returning the last server error when the budget expires mid-attach, falling back to DeadlineExceeded when no attempt has finished yet. Users then see the real cause, and the original require.Equal holds again. An injectable budget would also cut the ~60s test. I've noted the proposal on the dashboard ticket; the maintainers decide whether to take it.
AI agent (opus5.5, isaac_claude)
Changes
Fix the flaky
TestOutputAttachRetryExhaustion/Unavailable(experimental/ssh/sandbox/internal/sandboxexec). Test-only change.The test reattaches to a server that keeps failing and expects the server's last error code (
Unavailable).Outputgives up after its one-minute retry budget; if the budget expires while an attach request is still in flight, it returns the budget'sDeadlineExceededinstead. That is intended behavior, so the test now accepts either code. The other checks (the retries exhaust within their bound) are unchanged.Dashboard
Not equal: expected: 0xe(actual0x4), macOS, 2 failures in 30 days; both runs took 60.2-60.7s, matching the retry budget.Tests
expected: 0xe, actual: 0x4after 60.2s; with the fix it passes.Gaps and risks
UnavailablefromDeadlineExceededfor the exhausted case; the bound on total retry time is still checked.🤖 AI agent (opus5.5, isaac_claude)
This pull request and its description were written by Isaac.