Skip to content

Delete the session stream; poll entries instead - #209

Closed
jinxi97 wants to merge 1 commit into
mainfrom
jinxi97/remove-session-stream
Closed

jinxi97 wants to merge 1 commit into
mainfrom
jinxi97/remove-session-stream

Conversation

@jinxi97

@jinxi97 jinxi97 commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Funky is a batch engine for deferrable agent tasks, so push isn't worth what it costs. This deletes GET /v1/sessions/:id/stream; clients follow a session by polling GET /v1/sessions/:id/entries?after=<last seq>, which returns the same entry objects in seq order.

Why now: 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, and on 2026-10-26 reconnecting clients filled all 240 slots on the hosted api (3 instances × 80) until it stopped answering. Hardening the stream (h2c, #207) was the alternative; we're removing it instead.

Changes

  • api:
    • The route and its pacing config are gone (FUNKY_STREAM_POLL_MS, FUNKY_STREAM_HEARTBEAT_MS, the stream app dependency, StreamPacing). Setting the removed env vars is harmless; they're ignored.
    • /entries is unchanged, and its comment now says polling it from a cursor is how a client follows a session.
  • web console (useEntries):
    • Same public shape. After the initial read it polls readEntries(id, { after: cursor }) one request at a time, sending the next poll 1s after the previous one answers.
    • A failed poll dims the live mark ("Reconnecting…") and retries from the same cursor.
    • Polling stops when the session is archived, and pauses while the tab is hidden.
  • worker e2e: follows the log by polling /entries instead of reading SSE.
  • README: the quick start's step 4 is a curl polling loop; the SSE example and descriptions are gone.

Breaking

/v1/sessions/:id/stream now answers 404. There are no customers yet; funkyhq/cloud's console and smoke tests already poll.

Checks

pnpm format:check and pnpm typecheck are clean. api: 97 tests pass. worker: 20 pass, and the key-gated live suite is skipped. web has no tests; it typechecks and lints clean.

🤖 Generated with Claude Code

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>
@jinxi97

jinxi97 commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #210, which carries this PR's commit plus the review fixes (poll stops after 10 failures, /entries namespace test, e2e request timeout, README loop guard) and the #208 merge.

@jinxi97 jinxi97 closed this Oct 27, 2026
@jinxi97
jinxi97 deleted the jinxi97/remove-session-stream branch October 27, 2026 00:16
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