fix(relay): handle dead connections and preserve usage on refresh failure
Use received frames for peer liveness and reject new requests after terminal relay failures. Keep authoritative usage snapshots separate from refresh errors, bound request lifetime, and guard concurrent refreshes and runtime switches. Add regression coverage for relay liveness, terminal rejections, quota failures, cancellation and request deadlines. Validated with 51 focused tests, workspace type-check and lint, web build and mobile assets.
This commit is contained in:
@@ -135,6 +135,13 @@ The E2EE and framing logic exists twice: TypeScript in `packages/ui/src/lib/rela
|
||||
|
||||
## Runtime integration (client)
|
||||
|
||||
Client keepalive liveness comes from received frames only. Outbound HTTP retries
|
||||
cannot suppress a probe of a silent peer. Any valid inbound traffic, including a
|
||||
Pong, clears the probe deadline. Terminal relay close codes retain their error
|
||||
for the lifetime of that client: subsequent HTTP requests and WS opens fail
|
||||
immediately rather than waiting for a reconnect that will never be scheduled.
|
||||
Transient failures still use the existing reconnect/backoff path.
|
||||
|
||||
Relay mode plugs into the existing client transport layer rather than a parallel path: `runtime-switch` activates the tunnel singleton, `runtime-fetch` routes runtime requests through it, `runtime-url`/`runtime-socket` yield tunnel-backed URLs and sockets, and `runtime-auth` mints the URL-scoped token through the tunnel. Direct-URL connections and the Electron realtime-proxy path are unaffected.
|
||||
|
||||
## Design invariants (do not regress)
|
||||
|
||||
Reference in New Issue
Block a user