You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 33ddf2a
Browse filesBrowse the repository at this point in the historyBrowse files
fix(relaycore): a timeout next to a refused connection is always the 504; pin the new statuses in relay_end (MAG-4481)
A refused connection and a timeout both ranked as "no upstream answered", so the majority pick
broke the one-to-one tie at random: the same failure came back 502 on about 33 runs in 40 and
504 on the rest. A timeout now ranks above the other transport failures, and both still lose to
any other error.
relay_end gains golden cases for the statuses this PR introduced: a node's 503 forwarded, every
attempt throttled (429) and a node that never answers (504).
Notes brought up to date: relay_end's has_reply and no_answer rows (an upstream's error status
is a no_answer with that status), the fully capped chain in RATE-LIMIT-HOLDOFF (the node's 429,
no longer a router 503), the REST 5xx section of ERROR-REGISTRY-DESIGN, and the 504 timeout,
which names the request's budget rather than the time the attempt took.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/RELAY-END-EVENT.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,7 +61,7 @@ the router (an HTTP 405, for one); the router's own health and probe relays.
61
61
|`stop_reason`| string | always | Why there was no further attempt: `Success`, `Stateful`, `CrossValidation`, `NonRetryableNodeError`, `PermanentProtocolError`, `UnlistedMethodRefused`, `MaxRetriesReached`, `BatchDisabled`, `ErrorToleranceExceeded`, `AllProvidersExhausted`, `FirstMessageFailed`, `BatchSendFailed`, `ProcessingTimeout` (the budget ran out), `CallerGone` (a WebSocket or gRPC client hung up), `CrossValidationGroupsQuiet`. `""` when the relay ended before its state machine named a reason: `selection` is `""`, the cross-validation capacity check refused the request, or a `router_error` stopped it; always `""` for a subscription request. |
62
62
|`served_by`| string | always | The upstream whose reply reached the client; `"Cached"` for a cache hit, as the provider-address reply header says. For a subscription request, the upstream its subscription lives on. `""` when the client got an error, and for a subscription request the router answered itself. |
63
63
|`status`| number | always | The HTTP status on the router's result. When every attempt failed with a protocol error, it is the status the client gets: the upstream's own status when an upstream answered (a `429` included), `504` when no upstream answered in time (a connect timeout, the request's deadline, or a hung upstream that never answered), and `502` when every attempt failed in transport otherwise (MAG-4218, MAG-4481). `0` when the router returned no result or one without a status; the listener then answers with its own status. A router built with masked errors answers a no-answer failure with `500` while this field keeps `502` or `504`. A `write_unknown` is always `500`, the status the client gets. `0` for a subscription request. |
64
-
|`has_reply`| boolean | always |`true` exactly when `outcome` is `ok` or `node_error`: the client got an upstream's or the cache's reply, or, to a subscription request, the router's own answer. |
64
+
|`has_reply`| boolean | always |`true` exactly when `outcome` is `ok` or `node_error`: the client got an upstream's or the cache's reply, or, to a subscription request, the router's own answer. `false` on a `no_answer` whose client was sent an upstream's error status and body as is (a `503`, a `429`): the relay failed, and `status` is that upstream's status (MAG-4481). |
65
65
|`error_code`| string | always | The error registry name (`protocol/common/error_codes.go`) of why the relay did not end `ok`; see [error_code](#error_code). `""` on `ok`. |
66
66
|`error`| string | always |`node_error`: the node's error message. `write_unknown`: the message the client gets ("transaction status unclear: …"). Any other failure: the error the relay ended with. `""` on `ok`. |
67
67
|`latency_ms`| number | always | Milliseconds from the router taking the request to the event. A request that parses is timed from `SendParsedRelay` (the parse is not counted); one that does not, from `SendRelay`; a WebSocket frame that does not parse, from its parse. |
@@ -117,7 +117,7 @@ On Cosmos the fields are read, as `tx_code` is, only on a write the spec marks s
117
117
|`ok`| An upstream's or the cache's reply that is not a node error |`SendParsedRelay` returns a reply and no error: the first success (stateless, stateful), the quorum winner (cross-validation), or a cache hit |
118
118
|`node_error`| A node's error reply, passed through |`SendParsedRelay` returns a node error with no error: `processNonCrossValidationResult` when nothing succeeded, or a cached node error. A node's rate-limit reply is one too. |
119
119
|`write_unknown`| "transaction status unclear", HTTP 500 |`SendParsedRelay` returns `errUnknownWriteOutcome` (`writeOutcomeIsUnknown`): a stateful relay where no upstream accepted, and one was still silent when the budget ran out or its connection died after the request went out |
120
-
|`no_answer`| An error, after at least one upstream was asked |`SendParsedRelay` returns an error with a dispatched attempt: every attempt failed in transport, timed out or was rate limited, or cross-validation found no quorum |
120
+
|`no_answer`| An error, after at least one upstream was asked |`SendParsedRelay` returns an error with a dispatched attempt: every attempt failed in transport, timed out, was rate limited or answered an HTTP error status, or cross-validation found no quorum. When an upstream answered, the client gets its status and body as is, and `status` says which (MAG-4481)|
121
121
|`rejected_before_dispatch`| An error; no upstream was asked |`SendRelay` or the WebSocket manager: the request does not parse (unsupported shape, refused batch). `SendParsedRelay` with nothing dispatched: invalid cross-validation headers, the cross-validation capacity check, an empty provider pool, an unavailable pinned provider (the select-provider directive), every endpoint failing consistency pre-validation, or the deadline expiring before dispatch |
122
122
|`router_error`| An error, or nothing usable | The router's own machinery failed (`routerFault`): its task loop could not start, the task channel closed without a final instruction, or a relay had no request data. Also `SendParsedRelay` returning neither a reply nor an error, which includes a panic inside it |
0 commit comments