Carry relay X-Error-Details on GlowNetworkError - #33
Merged
Conversation
The relay names safe-to-reveal rejection reasons (full mailbox, exceeded sender storage quota) in the X-Error-Details response header. Glow used to drop it, leaving callers just a status code — a quota rejection was indistinguishable from a broken session, and the Vault12 app reacted to both with session-reconnect storms (BETA-2351). GlowNetworkError now carries the header as `details` and includes it in the message; absent header keeps the old message shape. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds support for propagating relay-provided, safe-to-reveal rejection reasons (X-Error-Details) through GlowNetworkError, enabling callers to distinguish actionable relay rejections (e.g., quota/full mailbox) from generic failures while preserving the prior error message format when details are absent.
Changes:
- Extend
GlowNetworkErrorwith an optionaldetailsfield and include details in the error message only when present. - Capture
X-Error-Detailsfrom relay HTTP responses and pass it intoGlowNetworkErroron non-OK responses. - Add Jest specs to verify details are captured when present and message shape remains unchanged when absent; bump package version to
1.2.0.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/relay/relay.ts | Reads X-Error-Details from response headers and attaches it to thrown GlowNetworkError for relay rejections. |
| src/relay/network-error.ts | Adds optional details field and conditionally augments the error message when details exist. |
| src/relay/relay.spec.ts | Adds tests ensuring details propagation and unchanged messaging when header is absent. |
| package.json | Bumps library version to 1.2.0. |
| package-lock.json | Updates lockfile version fields to 1.2.0. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
pavlo-liapin
approved these changes
Aug 6, 2026
lomchik
approved these changes
Aug 7, 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 relay reports safe-to-reveal rejection reasons (a full destination mailbox, an exceeded per-sender storage quota) in the
X-Error-Detailsresponse header. Glow used to drop the header, so callers only got a status code. In practice that made a quota rejection indistinguishable from a broken session: a client that treats every 400 as a stale session responds with a clear-session-and-reconnect loop, burning the relay's rate-limit budget along the way.Change:
GlowNetworkErrorgets an optionaldetailsfield, filled fromX-Error-Detailswhen the relay rejects a request. The error message becomesGlowNetworkError status: 400 (Sender storage quota exceeded)when details are present and keeps the exact old shape when they are absent, so existing message-based grouping only improves where the relay actually says something.Note for the relay side: reading the header cross-origin needs
Access-Control-Expose-Headers: X-Error-Detailsfrom the relay.Tests: two new specs (details captured, absent header keeps old message); full suite 128/128, build clean.
🤖 Generated with Claude Code