Skip to content

Delete the session stream; poll entries instead - #210

Merged
jinxi97 merged 3 commits into
mainfrom
jinxi97/remove-session-stream-v1
Oct 27, 2026
Merged

jinxi97 merged 3 commits into
mainfrom
jinxi97/remove-session-stream-v1

Conversation

@jinxi97

@jinxi97 jinxi97 commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Deletes GET /v1/sessions/:id/stream and its pacing config (FUNKY_STREAM_POLL_MS, FUNKY_STREAM_HEARTBEAT_MS). Clients follow a session by polling GET /v1/sessions/:id/entries?after=<seq>, which returns the same entry objects in seq order. Behind Cloud Run's HTTP/1.1, a client hang-up never reaches the container: every abandoned stream kept polling the store and held a request slot for up to an hour, reconnecting clients filled every slot, and the api stopped answering. Funky runs deferrable batch work, which does not need push.

  • Console: useEntries polls once a second while the session can still change, one request at a time, and not while the tab is hidden. After 10 polls in a row fail it stops, and the session head shows "Disconnected" with a Reconnect button that re-reads the log and starts polling again.
  • README: the quick start follows the log with a curl loop, which stops and prints the answer if it is not a list of entries.
  • Tests: the stream tests are gone. /entries gets the foreign-namespace 404 test the stream had. The stack e2e follows the log by polling, and each request is bounded by the poll's deadline.

Full pnpm test, typecheck and prettier pass. The stack e2e did not run (it needs a database URL and real Anthropic and E2B keys), and the console's Disconnected state has not been looked at in a browser.

🤖 Generated with Claude Code

jinxi97 and others added 3 commits October 26, 2026 15:43
GET /v1/sessions/:id/stream is gone, with its pacing config
(FUNKY_STREAM_POLL_MS, FUNKY_STREAM_HEARTBEAT_MS). Clients follow a
session by polling GET /v1/sessions/:id/entries?after=<seq>, which
returns the same entry objects in seq order: the console's useEntries
polls it once a second while the session can still change, the stack
e2e follows the log the same way, and the README's quick start shows a
curl loop.

Behind Cloud Run's HTTP/1.1 a client hang-up never reaches the
container, so every abandoned stream kept polling the store and held a
request slot for up to an hour; reconnecting clients filled every slot
and the api stopped answering. Funky runs deferrable batch work, which
does not need push.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The console's tail now gives up after ten polls in a row fail, rather
than asking a refusing api once a second forever; the session head shows
"Disconnected" with a Reconnect button, which re-reads the log and starts
the tail again.

GET /entries gets the foreign-namespace 404 test the deleted stream had.
The stack e2e bounds each poll request by its deadline, so an api that
never answers fails with the poll's own timeout rather than vitest's.
The README's follow loop stops on an answer that isn't a list of entries
instead of printing the error as rows.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…n-stream-v1

# Conflicts:
#	apps/api/test/sessions.test.ts
@jinxi97
jinxi97 merged commit b3703e0 into main Oct 27, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant