Remote Access: improve back off behavior and error messages#31267
Open
naltatis wants to merge 4 commits into
Open
Remote Access: improve back off behavior and error messages#31267naltatis wants to merge 4 commits into
naltatis wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- In the
websocket.Dialerror handling, for status codes other than 401/403/409 you drop back towebsocket dial: %wwithout including the HTTP status; consider wrapping the error with the status code (or at least logging it) so operators can distinguish different failure modes more easily. - The backoff behavior now depends on hard-coded
configRetryIntervalandminUptimevalues; consider making these configurable (or at least derived from a shared backoff policy) so they can be tuned without code changes if operational experience shows they’re too aggressive or too conservative.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In the `websocket.Dial` error handling, for status codes other than 401/403/409 you drop back to `websocket dial: %w` without including the HTTP status; consider wrapping the error with the status code (or at least logging it) so operators can distinguish different failure modes more easily.
- The backoff behavior now depends on hard-coded `configRetryInterval` and `minUptime` values; consider making these configurable (or at least derived from a shared backoff policy) so they can be tuned without code changes if operational experience shows they’re too aggressive or too conservative.
## Individual Comments
### Comment 1
<location path="server/remote/tunnel.go" line_range="78-82" />
<code_context>
bo.Reset()
}
+ wait := bo.NextBackOff()
+ // rejected credentials will not self-heal; retry slowly
+ if errors.Is(err, errCredentialsRejected) {
+ wait = configRetryInterval
+ }
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Avoid advancing the backoff state when overriding the wait duration for credential errors.
Because `NextBackOff()` is called before checking `errCredentialsRejected`, the internal backoff state advances even when its returned duration is discarded. This will cause later retries (after the error changes) to use a later point in the backoff sequence than intended. You can avoid this by only advancing the backoff when you use its value:
```go
var wait time.Duration
if errors.Is(err, errCredentialsRejected) {
wait = configRetryInterval
} else {
wait = bo.NextBackOff()
}
```
```suggestion
var wait time.Duration
// rejected credentials will not self-heal; retry slowly
if errors.Is(err, errCredentialsRejected) {
wait = configRetryInterval
} else {
wait = bo.NextBackOff()
}
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
andig
reviewed
Jun 27, 2026
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 tunnel client treated a rejected connection as a successful connect: it reset the backoff and reconnected about once a second, causing reconnect storms against the cloud proxy.