No id:, and nothing anywhere in src/ reads a Last-Event-ID request header — grep -rn "last-event-id\|lastEventId" src/ returns nothing.
EventSource reconnects on its own; that is the reason to choose SSE over a raw WebSocket in the first place. When it does, it sends Last-Event-ID with the last id it saw, and a server is expected to resume from there. green-tea never sent an id, so the browser has none to send, and the route's AsyncIterable is simply constructed again from its beginning.
Everything produced during the gap is lost, and nothing on either side reports it. The client sees a healthy connection and a continuous stream; it just quietly missed events. That is worse than not reconnecting at all — a failure that announces itself gets handled, and this one does not.
retry: is not emitted either, so the reconnect delay is whatever the browser defaults to (3s in most) and a server cannot tune it.
Why it matters more than it looks
The framework's own pitch for real-time is one mental model — an AsyncIterable — and the transport is a decorator. A user who picks @Sse over @Ws for exactly the reason SSE exists gets the reconnect behaviour and none of the resumption it depends on. The transport promises delivery semantics the framework does not implement.
This is pre-existing, not a regression: the encoder has looked like this since streaming landed, so it is already in the published beta.
Scope
Resumption is not free and not always meaningful — a live sensor feed has nothing to replay, a paged event log does. So this is probably an opt-in on the route rather than a default:
emit id: when the handler supplies one, and make Last-Event-ID reachable from the handler so it can resume;
consider retry: as a route option;
if a route cannot resume, say so in the docs rather than let the transport imply it can.
The honest minimum, if the full design is too much for now, is documenting the gap in the streaming guide: EventSource will reconnect, and green-tea will restart the iterable rather than resume it.
Related
The mesh links got their reconnection in 26.8.0-beta.1 (this branch). This is the same class of bug at the other end of the framework — a reconnect that appears to work while losing what happened during the outage — and it is the one the framework cannot fix from the client side, because the client is a browser.
`@Sse` emits no `id:` field and ignores `Last-Event-ID`, so `EventSource`'s automatic reconnect silently resumes from nothing.
## What happens
`sseEncoder` (`src/encoders.ts:15`) writes one field:
```ts
encode: (item) => `data: ${JSON.stringify(item)}\n\n`,
```
No `id:`, and nothing anywhere in `src/` reads a `Last-Event-ID` request header — `grep -rn "last-event-id\|lastEventId" src/` returns nothing.
`EventSource` reconnects on its own; that is the reason to choose SSE over a raw WebSocket in the first place. When it does, it sends `Last-Event-ID` with the last id it saw, and a server is expected to resume from there. green-tea never sent an id, so the browser has none to send, and the route's `AsyncIterable` is simply constructed again from its beginning.
**Everything produced during the gap is lost, and nothing on either side reports it.** The client sees a healthy connection and a continuous stream; it just quietly missed events. That is worse than not reconnecting at all — a failure that announces itself gets handled, and this one does not.
`retry:` is not emitted either, so the reconnect delay is whatever the browser defaults to (3s in most) and a server cannot tune it.
## Why it matters more than it looks
The framework's own pitch for real-time is *one mental model — an `AsyncIterable` — and the transport is a decorator*. A user who picks `@Sse` over `@Ws` for exactly the reason SSE exists gets the reconnect behaviour and none of the resumption it depends on. The transport promises delivery semantics the framework does not implement.
This is **pre-existing**, not a regression: the encoder has looked like this since streaming landed, so it is already in the published beta.
## Scope
Resumption is not free and not always meaningful — a live sensor feed has nothing to replay, a paged event log does. So this is probably an opt-in on the route rather than a default:
- emit `id:` when the handler supplies one, and make `Last-Event-ID` reachable from the handler so it can resume;
- consider `retry:` as a route option;
- if a route cannot resume, say so in the docs rather than let the transport imply it can.
The honest minimum, if the full design is too much for now, is **documenting the gap** in the streaming guide: `EventSource` will reconnect, and green-tea will restart the iterable rather than resume it.
## Related
The mesh links got their reconnection in 26.8.0-beta.1 (this branch). This is the same class of bug at the other end of the framework — a reconnect that appears to work while losing what happened during the outage — and it is the one the framework cannot fix from the client side, because the client is a browser.
chrnx
self-assigned this 2026-08-18 15:57:12 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
@Sseemits noid:field and ignoresLast-Event-ID, soEventSource's automatic reconnect silently resumes from nothing.What happens
sseEncoder(src/encoders.ts:15) writes one field:No
id:, and nothing anywhere insrc/reads aLast-Event-IDrequest header —grep -rn "last-event-id\|lastEventId" src/returns nothing.EventSourcereconnects on its own; that is the reason to choose SSE over a raw WebSocket in the first place. When it does, it sendsLast-Event-IDwith the last id it saw, and a server is expected to resume from there. green-tea never sent an id, so the browser has none to send, and the route'sAsyncIterableis simply constructed again from its beginning.Everything produced during the gap is lost, and nothing on either side reports it. The client sees a healthy connection and a continuous stream; it just quietly missed events. That is worse than not reconnecting at all — a failure that announces itself gets handled, and this one does not.
retry:is not emitted either, so the reconnect delay is whatever the browser defaults to (3s in most) and a server cannot tune it.Why it matters more than it looks
The framework's own pitch for real-time is one mental model — an
AsyncIterable— and the transport is a decorator. A user who picks@Sseover@Wsfor exactly the reason SSE exists gets the reconnect behaviour and none of the resumption it depends on. The transport promises delivery semantics the framework does not implement.This is pre-existing, not a regression: the encoder has looked like this since streaming landed, so it is already in the published beta.
Scope
Resumption is not free and not always meaningful — a live sensor feed has nothing to replay, a paged event log does. So this is probably an opt-in on the route rather than a default:
id:when the handler supplies one, and makeLast-Event-IDreachable from the handler so it can resume;retry:as a route option;The honest minimum, if the full design is too much for now, is documenting the gap in the streaming guide:
EventSourcewill reconnect, and green-tea will restart the iterable rather than resume it.Related
The mesh links got their reconnection in 26.8.0-beta.1 (this branch). This is the same class of bug at the other end of the framework — a reconnect that appears to work while losing what happened during the outage — and it is the one the framework cannot fix from the client side, because the client is a browser.
chrnx referenced this issue2026-09-25 14:02:14 +00:00