Skip to content

Conversation

@ericallam
Copy link
Member

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Nov 12, 2025

⚠️ No Changeset found

Latest commit: 2943832

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 12, 2025

Walkthrough

This pull request adds a new Realtime Streams (Streams v2) documentation page at /tasks/streams and updates multiple docs to reference and align with Streams v2. Changes include promoting the new useRealtimeStream hook (SDK 4.1.0+), reworking backend streaming docs to emphasize reading/consuming streams with typed APIs, adding examples for piping, abort/cancellation, retries, and batching, and updating migration guidance from metadata.stream() to streams.pipe()/streams.define(). Navigation and overview pages were reflowed to multi-line arrays and now include the new tasks/streams entry.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45-75 minutes

  • docs/tasks/streams.mdx — new, large, example-rich page: verify accuracy, code samples, limits, and enablement instructions.
  • docs/realtime/backend/streams.mdx — major rewrite with new APIs (read(), withStreams(), options, abort/retry): check code correctness and consistency.
  • docs/realtime/react-hooks/streams.mdx — significant reorganization promoting useRealtimeStream: verify examples, option names (throttleInMs), and compatibility notes.
  • docs/runs/metadata.mdx — migration guidance updates: ensure examples and deprecation wording are correct.
  • docs/docs.json and overview files — navigation changes and anchors: validate links and anchor targets (e.g., /tasks/streams, #userealtimerunwithstreams).

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is entirely missing; no content was provided despite the repository having a clear template with required sections like Testing, Changelog, and Checklist. Add a complete pull request description following the repository template, including the Checklist, Testing section, and Changelog describing the documentation changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'docs: realtime streams v2' clearly and concisely summarizes the main change: comprehensive documentation for Realtime Streams v2, which is the primary focus of all file updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ea-branch-98

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d5e9dd5 and 2943832.

📒 Files selected for processing (8)
  • docs/docs.json (12 hunks)
  • docs/guides/example-projects/batch-llm-evaluator.mdx (1 hunks)
  • docs/realtime/backend/overview.mdx (1 hunks)
  • docs/realtime/backend/streams.mdx (1 hunks)
  • docs/realtime/overview.mdx (1 hunks)
  • docs/realtime/react-hooks/streams.mdx (5 hunks)
  • docs/runs/metadata.mdx (2 hunks)
  • docs/tasks/streams.mdx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • docs/guides/example-projects/batch-llm-evaluator.mdx
  • docs/realtime/overview.mdx
  • docs/runs/metadata.mdx
  • docs/tasks/streams.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (12)
docs/realtime/backend/overview.mdx (1)

17-21: Documentation wording and link placement look good.

The shift from "Emit and consume" to "Read and consume" clearly aligns with the backend's read/consume role. The Note correctly directs users to the comprehensive Realtime Streams documentation at /tasks/streams.

docs/docs.json (1)

76-76: New navigation entry placement is logical.

The "tasks/streams" entry correctly sits under the "Writing tasks" group alongside runs/metadata (line 75) and before run-usage (line 77), which is a sensible position for documentation about emitting and defining streams.

docs/realtime/backend/streams.mdx (6)

4-4: Intro and links are well-structured.

The description and introductory text clearly establish the stream-reading focus. The Note appropriately guides users to /tasks/streams for emitting guidance and /realtime/react-hooks/streams for frontend patterns.

Also applies to: 7-7, 10-10


15-36: Example pattern is clear; anchor reference should be verified.

The "Using defined streams" example demonstrates the recommended pattern well (type-safe import, .read(), for-await iteration). However, verify that the anchor reference to /tasks/streams#defining-typed-streams-recommended (line 17) exists in the new Streams v2 documentation.


38-70: Direct stream reading examples are consistent.

Both "Direct stream reading" and "Reading from default stream" clearly show the API difference (keyed vs. default), maintaining consistency in the for-await pattern. Examples are easy to follow.


72-187: Stream options are well-documented with comprehensive examples.

Timeout, start index, and abort signal options each have clear examples with error handling. The combined options example (lines 156-187) shows practical real-world usage. However, verify that the error names (error.name === "TimeoutError" and error.name === "AbortError") match the actual SDK error types.


306-352: Retry logic example is well-structured; verify error filtering.

The retry pattern with exponential backoff (line 346: 1000 * Math.pow(2, attempt)) is clear. However, the catch block (lines 336-347) retries on all errors. Consider documenting whether certain errors (like AbortError or stream completion) should skip the retry loop, or if the current behavior is intentional. This affects user experience for cancellations or timeouts.


390-413: Backward-compatibility guidance is clear.

The section appropriately explains that runs.subscribeToRun().withStreams() is available but recommends streams.read() for most cases, with clear rationale. This helps users migrate to the newer API.

docs/realtime/react-hooks/streams.mdx (4)

14-21: SDK version requirement and positioning are clear.

The useRealtimeStream hook is well-positioned as "Recommended" with SDK 4.1.0+ requirement explicitly noted. The link to defined streams documentation is consistent with backend guidance.


129-142: Options documentation is comprehensive; verify throttleInMs defaults.

The options section clearly documents all parameters including throttleInMs (line 139 lists default: 16ms). This default value should be verified against actual SDK behavior to ensure documentation accuracy.


231-264: TextStreamPart handling is well-documented; verify type import.

The TextStreamPart example (lines 231-264) shows practical type filtering for stream-delta and tool results. However, verify that the import on line 234 (import type { TextStreamPart } from "ai") correctly references the AI SDK package and version used by Trigger.dev.


337-368: Throttling options are clearly documented for both hooks.

The throttling section appropriately documents experimental_throttleInMs for useRealtimeRunWithStreams and correctly notes (line 369) that useRealtimeStream uses throttleInMs instead. This clarity prevents user confusion between the two APIs.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
docs/tasks/streams.mdx (1)

154-154: Minor: Self-referential link may cause confusion. Line 154 links to /tasks/streams while already on that page. Consider either removing this line (since readers are already on this documentation) or linking to a specific section like #defining-typed-streams-recommended.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a70ab10 and d5e9dd5.

📒 Files selected for processing (8)
  • docs/docs.json (12 hunks)
  • docs/guides/example-projects/batch-llm-evaluator.mdx (1 hunks)
  • docs/realtime/backend/overview.mdx (1 hunks)
  • docs/realtime/backend/streams.mdx (1 hunks)
  • docs/realtime/overview.mdx (1 hunks)
  • docs/realtime/react-hooks/streams.mdx (5 hunks)
  • docs/runs/metadata.mdx (2 hunks)
  • docs/tasks/streams.mdx (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-08-18T10:07:17.368Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-08-18T10:07:17.368Z
Learning: For Realtime subscriptions or React hooks, provide a Public Access Token and scope it appropriately (e.g., via TriggerAuthContext)

Applied to files:

  • docs/realtime/overview.mdx
  • docs/realtime/react-hooks/streams.mdx
📚 Learning: 2025-08-18T10:07:17.368Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-08-18T10:07:17.368Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Define tasks using task({ id, run, ... }) with a unique id per project

Applied to files:

  • docs/realtime/react-hooks/streams.mdx
📚 Learning: 2025-08-18T10:07:17.368Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-08-18T10:07:17.368Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Import Trigger.dev APIs from "trigger.dev/sdk/v3" when writing tasks or related utilities

Applied to files:

  • docs/realtime/react-hooks/streams.mdx
📚 Learning: 2025-08-18T10:07:17.368Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2025-08-18T10:07:17.368Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use metadata API (metadata.current/get/set/append/stream, etc.) only inside run functions or lifecycle hooks

Applied to files:

  • docs/runs/metadata.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (11)
docs/guides/example-projects/batch-llm-evaluator.mdx (1)

47-51: Good deprecation guidance. The anchor link and migration note clearly guide users toward the newer useRealtimeStream hook (SDK 4.1.0+). The positioning right after the old hook mention is helpful.

docs/realtime/backend/overview.mdx (1)

17-21: Clear backend-focused framing. The shift from "emit and consume" to "read and consume" correctly frames the backend's primary role. The note directing to /tasks/streams helps users understand the full context of stream definitions.

docs/realtime/overview.mdx (1)

21-21: Cohesive Streams v2 overview. The updated bullet header, description, and tri-part links (Learn more, React hooks, Backend) provide clear navigation to the new Streams documentation while emphasizing relevant use cases (AI/LLM outputs, progress).

docs/docs.json (1)

13-76: Appropriate navigation structure. The addition of tasks/streams in the "Writing tasks" group is well-positioned alongside metadata and before general task utilities. The multi-line array formatting improves readability and diff clarity.

docs/runs/metadata.mdx (2)

267-274: Clear backward-compatible deprecation. The note clearly positions metadata.stream() as superseded by Streams v2 while preserving examples for existing code. The link to /tasks/streams provides the migration path.


445-445: Helpful migration hints. The inline comments guide developers to the v4.1+ alternative without removing working code, balancing clarity with backward compatibility.

Also applies to: 452-452

docs/tasks/streams.mdx (2)

160-164: Verify option completeness in read() documentation. The example shows timeoutInSeconds and startIndex, but docs/realtime/backend/streams.mdx additionally documents a signal option for AbortController support. Confirm whether this is intentional (different feature sets) or a documentation gap that should be addressed.


1-250: Excellent foundational documentation for Streams v2. The comprehensive structure—from enabling through migration—provides clear guidance. The "recommended" vs "direct" pattern distinction and emphasis on defined streams for type safety aligns well with SDK v4.1.0+ improvements. Multiple realistic examples (AI streaming, batching, retry logic) will help developers adopt the new API.

docs/realtime/react-hooks/streams.mdx (2)

14-154: Strong promotion of useRealtimeStream as primary hook. The new section with comprehensive examples (basic, defined streams, AI responses) and full options documentation provides excellent guidance for new projects. The positioning before useRealtimeRunWithStreams clearly signals the recommended path.


158-162: Clear migration path for existing implementations. The note appropriately signals that useRealtimeRunWithStreams is supported but useRealtimeStream is recommended, helping developers make informed choices without forcing a rewrite.

docs/realtime/backend/streams.mdx (1)

1-413: Comprehensive backend reading patterns. The restructured documentation clearly prioritizes defined streams for type safety, provides thorough options documentation (including AbortController signals), and includes practical examples covering SSE, retries, and batch processing. This positions backend developers to consume Streams v2 effectively.

@ericallam ericallam merged commit bb5cefa into main Nov 14, 2025
7 checks passed
@ericallam ericallam deleted the ea-branch-98 branch November 14, 2025 09:42
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.

3 participants