fix: context deadline/cancelled issues#2258
Conversation
ⓘ You are approaching your monthly quota for Qodo. Upgrade your plan Review Summary by QodoFix context cancellation misclassification and make relay timeout configurable
WalkthroughsDescription• Skip ConnectionRefusals and MarkUnhealthy on client-side context cancellation - Guard both connection and relay paths to check ctx.Err() before attributing errors to provider • Make minimum relay timeout configurable via --min-relay-timeout flag - Convert hardcoded MinimumTimePerRelayDelay from 1s to configurable variable - Add ValidateAndCapMinRelayTimeout() to prevent misconfiguration by capping to 50% of DefaultTimeout • Add comprehensive test coverage for timeout validation and GetTimePerCu behavior Diagramflowchart LR
A["Client Context Cancellation"] -->|Previously Treated As| B["Provider Failure"]
A -->|Now Skipped| C["ConnectionRefusals & MarkUnhealthy"]
D["Hardcoded MinimumTimePerRelayDelay 1s"] -->|Converted To| E["Configurable --min-relay-timeout"]
E -->|Validated By| F["ValidateAndCapMinRelayTimeout"]
F -->|Capped To| G["50% of DefaultTimeout if >= DefaultTimeout"]
File Changes1. protocol/common/cobra_common.go
|
Code Review by Qodo
1. Missing newline in timeout_test.go
|
42e1f76 to
b3a506f
Compare
0d34291 to
1ecc17b
Compare
3f19d07 to
3180255
Compare
3180255 to
3447f3c
Compare
b04db2f to
baa663a
Compare
- Skip ConnectionRefusals and MarkUnhealthy on client-side context cancellation (relay race losers / client disconnects) — these are not provider faults. Also skip backoff since the client is gone. - Add --min-relay-timeout flag to configure minimum relay timeout floor (default 1s), with validation against --default-processing-timeout. - Increase chain tracker fetch timeout from hardcoded 3s to max(10s, MinimumTimePerRelayDelay) to prevent spurious deadline errors on nodes behind CDNs like Cloudflare. - Extract classifyHTTPStatus helper to deduplicate status code classification logic between classifyRelayError and inline handling. - Add debug logging for non-HTTP errors marked unhealthy in logRelayErrorClassification. - Fix double call to LocalNodeTimePerCu in GetTimePerCu. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
baa663a to
26fd64e
Compare
Description
Closes: #XXXX
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!in the type prefix if API or client breaking changemainbranchReviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...