Skip to content

perf(streaming): batch main thread stream updates#4410

Open
patrick-andstar wants to merge 3 commits into
bytedance:mainfrom
patrick-andstar:codex/deerflow-stream-batching
Open

perf(streaming): batch main thread stream updates#4410
patrick-andstar wants to merge 3 commits into
bytedance:mainfrom
patrick-andstar:codex/deerflow-stream-batching

Conversation

@patrick-andstar

@patrick-andstar patrick-andstar commented Jul 23, 2026

Copy link
Copy Markdown

Related to #4409

Why

The LangGraph SDK currently receives no throttle option from the main thread stream, which makes its effective setting false and notifies React for every stream update. The SDK's numeric throttle is a trailing debounce, so it can defer a continuously active stream instead of safely coalescing it.

What changed

The main thread stream now uses the SDK's throttle: true mode. It batches updates that arrive in the same macrotask without adding a fixed debounce interval. A focused regression test pins that hook configuration.

Surface area

  • Frontend UI — page / component / setting / interaction under frontend/
  • Backend API — endpoint / SSE event / request-response shape under backend/app
  • Agents / LangGraph — agent node, graph wiring, langgraph.json, or prompt change
  • Sandboxdocker/ or sandboxed execution
  • Skills — change under skills/
  • Dependencies — new/upgraded entry in backend/pyproject.toml or frontend/package.json (say what it buys us)
  • Default behavior change — changes existing behavior without the user opting in (default model, default setting, data shape)
  • Docs / tests / CI only — no runtime behavior change

Screenshots / Recording

Not applicable; this is internal stream scheduling with no new entry point.

Bug fix verification

  • Test path that reproduces the missing configuration: frontend/tests/unit/core/threads/stream-throttle.test.ts
  • Did it go red on main and green on this branch? No. The test is new and asserts the configuration contract that was absent from main.

Validation

  • cd frontend && corepack pnpm test tests/unit/core/threads/stream-throttle.test.ts
  • cd frontend && corepack pnpm format
  • cd frontend && corepack pnpm check
  • cd frontend && corepack pnpm test
  • git diff --check

AI assistance

Tool(s) used: Codex

How you used it: Inspected the pinned LangGraph SDK implementation and types, implemented the narrow stream option change, added the regression test, and ran the listed validation and diff review.

  • I've read and understand every line of this change and take responsibility for it — it's not unreviewed AI output.

@CLAassistant

CLAassistant commented Jul 23, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions Bot added area:docs Documentation and Markdown only area:frontend Next.js frontend under frontend/ needs-validation Touches front/back contract surface; needs real-path validation risk:medium Medium risk: regular code changes size/S PR changes 20-100 lines labels Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Documentation and Markdown only area:frontend Next.js frontend under frontend/ needs-validation Touches front/back contract surface; needs real-path validation risk:medium Medium risk: regular code changes size/S PR changes 20-100 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants