Skip to content

feat(sdk): route chat session streaming to the realtime host by default#3856

Draft
ericallam wants to merge 1 commit into
mainfrom
feat/chat-realtime-stream-host
Draft

feat(sdk): route chat session streaming to the realtime host by default#3856
ericallam wants to merge 1 commit into
mainfrom
feat/chat-realtime-stream-host

Conversation

@ericallam
Copy link
Copy Markdown
Member

Summary

On Trigger.dev Cloud, chat session streaming (the out SSE and in input appends) now goes to the dedicated realtime host (realtime.trigger.dev) instead of the API service. This isolates long-lived chat streaming from regular API request traffic, so a streaming-backend hiccup no longer surfaces as API errors (and vice versa).

Custom and self-hosted base URLs are left unchanged (they serve realtime on the same origin), and passing a baseURL resolver function opts out entirely. The change is gradual: it takes effect for a client once it upgrades the SDK.

If you gate chat traffic behind a CSP or network allowlist, add realtime.trigger.dev.

Verified end-to-end against a live environment: the realtime in/out endpoints hit the realtime host with working cross-origin CORS, and streaming completed normally.

Chat clients now send realtime session reads and input appends to the dedicated realtime host on Trigger.dev Cloud instead of the API service, isolating long-lived chat streaming from regular API traffic. Custom and self-hosted base URLs are unchanged; the change takes effect as clients upgrade.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 6, 2026

🦋 Changeset detected

Latest commit: e4fd87e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 25 packages
Name Type
@trigger.dev/sdk Patch
@trigger.dev/python Patch
@internal/sdk-compat-tests Patch
@trigger.dev/build Patch
@trigger.dev/core Patch
@trigger.dev/plugins Patch
@trigger.dev/react-hooks Patch
@trigger.dev/redis-worker Patch
@trigger.dev/rsc Patch
@trigger.dev/schema-to-json Patch
@trigger.dev/database Patch
@trigger.dev/otlp-importer Patch
@trigger.dev/rbac Patch
trigger.dev Patch
@internal/cache Patch
@internal/clickhouse Patch
@internal/llm-model-catalog Patch
@internal/redis Patch
@internal/replication Patch
@internal/run-engine Patch
@internal/schedule-engine Patch
@internal/testcontainers Patch
@internal/tracing Patch
@internal/tsql Patch
@internal/zod-worker Patch

Not sure what this means? Click here to learn what changesets are.

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 6, 2026

Review Change Stack

Walkthrough

This PR routes Trigger.dev Cloud chat realtime streaming to a dedicated host (realtime.trigger.dev). Constants and a routing helper map the default Cloud API host to the realtime host. AgentChat and TriggerChatTransport integrate the helper to route their session endpoints accordingly. Custom or self-hosted baseURL values and resolver functions bypass this behavior. Tests verify routing under default Cloud, custom host, and non-prod Trigger.dev scenarios. A changeset documents the change and notes CSP/allowlist considerations.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description provided covers the change summary, impact, scope limitations, and verification. However, it does not follow the repository's template structure with required sections like Testing, Changelog, and the checklist. Restructure the description to match the template: add the issue reference, include the checklist, separate Testing and Changelog sections, and maintain the custom summary content within that structure.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: routing chat session streaming to a dedicated realtime host by default, which is the core objective of this PR.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/chat-realtime-stream-host

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
Copy Markdown
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.

🧹 Nitpick comments (1)
packages/trigger-sdk/src/v3/ai-shared.ts (1)

45-47: ⚡ Quick win

Return the normalized base URL consistently.

When baseURL doesn't match the Cloud API host, the function returns the original baseURL (potentially with a trailing slash), while the Cloud case returns CLOUD_STREAM_BASE_URL (no trailing slash). This creates inconsistent output: one code path strips the slash via the comparison, the other preserves it.

The downstream callers handle this via their own .replace(/\/$/, ""), but the function itself should normalize consistently:

export function resolveChatStreamBaseURL(baseURL: string): string {
  const trimmed = baseURL.replace(/\/$/, "");
  return trimmed === CLOUD_API_BASE_URL ? CLOUD_STREAM_BASE_URL : trimmed;
}

This makes the behavior more predictable and easier to reason about.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: bfec998e-1068-4c2c-b1f1-5fb6468b3cd2

📥 Commits

Reviewing files that changed from the base of the PR and between 97036fb and e4fd87e.

📒 Files selected for processing (5)
  • .changeset/chat-realtime-stream-host.md
  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
  • packages/trigger-sdk/src/v3/chat.test.ts
  • packages/trigger-sdk/src/v3/chat.ts
📜 Review details
⏰ 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). (27)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (8, 8)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (5, 8)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (2, 8)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (4, 8)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (7, 8)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (3, 8)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (7, 8)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (3, 8)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (6, 8)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (1, 8)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (6, 8)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (8, 8)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (5, 8)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (1, 8)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (2, 8)
  • GitHub Check: internal / 🧪 Unit Tests: Internal (4, 8)
  • GitHub Check: sdk-compat / Node.js 20.20 (ubuntu-latest)
  • GitHub Check: sdk-compat / Cloudflare Workers
  • GitHub Check: sdk-compat / Node.js 22.12 (ubuntu-latest)
  • GitHub Check: sdk-compat / Bun Runtime
  • GitHub Check: sdk-compat / Deno Runtime
  • GitHub Check: packages / 🧪 Unit Tests: Packages (1, 1)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: e2e-webapp / 🧪 E2E Tests: Webapp
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (actions)
  • GitHub Check: Build and publish previews
🧰 Additional context used
📓 Path-based instructions (9)
packages/trigger-sdk/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

In the Trigger.dev SDK (packages/trigger-sdk), prefer isomorphic code like fetch and ReadableStream instead of Node.js-specific code

Files:

  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
  • packages/trigger-sdk/src/v3/chat.test.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Use types over interfaces for TypeScript
Avoid using enums; prefer string unions or const objects instead

Import from @trigger.dev/sdk when writing Trigger.dev tasks. Never use @trigger.dev/sdk/v3 or deprecated client.defineJob

Files:

  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
  • packages/trigger-sdk/src/v3/chat.test.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use function declarations instead of default exports

**/*.{ts,tsx,js,jsx}: Prefer static imports over dynamic imports. Only use dynamic import() when circular dependencies cannot be resolved, code splitting is needed for performance, or the module must be loaded conditionally at runtime
Import subpaths only from packages/core (@trigger.dev/core), never import from the root

Files:

  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
  • packages/trigger-sdk/src/v3/chat.test.ts
**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/otel-metrics.mdc)

**/*.ts: When creating or editing OTEL metrics (counters, histograms, gauges), ensure metric attributes have low cardinality by using only enums, booleans, bounded error codes, or bounded shard IDs
Do not use high-cardinality attributes in OTEL metrics such as UUIDs/IDs (envId, userId, runId, projectId, organizationId), unbounded integers (itemCount, batchSize, retryCount), timestamps (createdAt, startTime), or free-form strings (errorMessage, taskName, queueName)
When exporting OTEL metrics via OTLP to Prometheus, be aware that the exporter automatically adds unit suffixes to metric names (e.g., 'my_duration_ms' becomes 'my_duration_ms_milliseconds', 'my_counter' becomes 'my_counter_total'). Account for these transformations when writing Grafana dashboards or Prometheus queries

Files:

  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
  • packages/trigger-sdk/src/v3/chat.test.ts
packages/trigger-sdk/**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (packages/trigger-sdk/CLAUDE.md)

Always import from @trigger.dev/sdk. Never use @trigger.dev/sdk/v3 (deprecated path alias)

Files:

  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
  • packages/trigger-sdk/src/v3/chat.test.ts
**/*.{js,ts,tsx,jsx,css,json,md}

📄 CodeRabbit inference engine (AGENTS.md)

Use Prettier for code formatting and run pnpm run format before committing

Files:

  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
  • packages/trigger-sdk/src/v3/chat.test.ts
**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use vitest for all tests in the Trigger.dev repository

Files:

  • packages/trigger-sdk/src/v3/chat.test.ts
**/*.test.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.test.{ts,tsx}: Never mock anything in tests - use testcontainers instead
Test files should be placed next to source files (e.g., MyService.ts -> MyService.test.ts)

Files:

  • packages/trigger-sdk/src/v3/chat.test.ts
**/*.test.{js,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.test.{js,ts,tsx}: Test files should live beside the files under test and use descriptive describe and it blocks
Use vitest for unit testing
Tests should avoid mocks or stubs and use helpers from @internal/testcontainers when Redis or Postgres are needed

Files:

  • packages/trigger-sdk/src/v3/chat.test.ts
🧠 Learnings (40)
📓 Common learnings
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3655
File: packages/trigger-sdk/src/v3/ai.ts:8667-8731
Timestamp: 2026-05-18T14:20:00.606Z
Learning: Repo: triggerdotdev/trigger.dev — When issuing raw fetches to Trigger API in the SDK (e.g., createChatStartSessionAction override path), include the same headers as ApiClient: Content-Type, Authorization, x-trigger-source: "sdk", and forward the preview branch via x-trigger-branch using apiClientManager.branchName. Prefer using the shared overrideRequestHeaders(accessToken) helper to ensure correct routing to preview environments.
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3833
File: .changeset/ai-sdk-7-support.md:5-5
Timestamp: 2026-06-04T15:28:19.931Z
Learning: In triggerdotdev/trigger.dev, the `ai-sdk/otel` auto-registration caveats (skip-if-already-registered behaviour and the `TRIGGER_AI_SDK_OTEL_AUTOREGISTER=0` opt-out) are intentionally omitted from changeset copy to keep it concise. Full documentation lives in the AI Chat compatibility reference (docs PR `#3835`). Do not flag the changeset text as incomplete on this topic in future reviews.
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3671
File: packages/trigger-sdk/src/v3/ai.ts:724-769
Timestamp: 2026-05-19T21:04:52.902Z
Learning: Repo: triggerdotdev/trigger.dev — In packages/trigger-sdk/src/v3/ai.ts, recovery now preserves per-message clientData: replaySessionInTail returns { message, metadata, seqNum } for each session.in record, and the recovery boot queue maps metadata by message.id to reconstruct recovered turns. For messages without a matching record (e.g., hook-synthesized), it intentionally falls back to the current boot payload’s metadata. Do not flag “lost metadata on recovered turns” in future reviews when this path is in use.
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3644
File: packages/trigger-sdk/src/v3/ai.ts:8695-8746
Timestamp: 2026-05-17T08:08:20.822Z
Learning: triggerdotdev/trigger.dev: Session resume now uses sequence cursors. Each turn-complete control record on session.out includes a `session-in-event-id` header carrying the committed-consume cursor (session.in.lastDispatchedSeqNum). On boot, the runtime scans session.out for the latest turn-complete, reads that header, and seeds the sessionStreams manager for `.in` with both lastSeqNum and lastDispatchedSeqNum so already-processed user messages don’t replay. Timestamps (setMinTimestamp/lastOutTimestamp) are no longer used.
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3545
File: .server-changes/agent-view-sessions.md:10-10
Timestamp: 2026-05-14T14:54:43.318Z
Learning: In the `trigger.dev` repository, `.server-changes/*.md` files use mixed dot/slash notation for route paths intentionally (e.g., `resources.orgs.../runs.$runParam/realtime/v1/sessions/$sessionId/$io`). These files are consumed verbatim into the changelog, so notation style should not be flagged as inconsistent.
📚 Learning: 2026-06-04T15:28:19.931Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3833
File: .changeset/ai-sdk-7-support.md:5-5
Timestamp: 2026-06-04T15:28:19.931Z
Learning: In triggerdotdev/trigger.dev, the `ai-sdk/otel` auto-registration caveats (skip-if-already-registered behaviour and the `TRIGGER_AI_SDK_OTEL_AUTOREGISTER=0` opt-out) are intentionally omitted from changeset copy to keep it concise. Full documentation lives in the AI Chat compatibility reference (docs PR `#3835`). Do not flag the changeset text as incomplete on this topic in future reviews.

Applied to files:

  • .changeset/chat-realtime-stream-host.md
  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
  • packages/trigger-sdk/src/v3/chat.test.ts
📚 Learning: 2026-05-18T14:20:00.606Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3655
File: packages/trigger-sdk/src/v3/ai.ts:8667-8731
Timestamp: 2026-05-18T14:20:00.606Z
Learning: Repo: triggerdotdev/trigger.dev — When issuing raw fetches to Trigger API in the SDK (e.g., createChatStartSessionAction override path), include the same headers as ApiClient: Content-Type, Authorization, x-trigger-source: "sdk", and forward the preview branch via x-trigger-branch using apiClientManager.branchName. Prefer using the shared overrideRequestHeaders(accessToken) helper to ensure correct routing to preview environments.

Applied to files:

  • .changeset/chat-realtime-stream-host.md
📚 Learning: 2026-03-06T14:44:55.489Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3173
File: packages/trigger-sdk/src/v3/chat.test.ts:103-104
Timestamp: 2026-03-06T14:44:55.489Z
Learning: In `packages/trigger-sdk/src/v3/chat.test.ts`, mocking `global.fetch` with `vi.fn()` is acceptable and intentional. `TriggerChatTransport` is a browser-facing SSE/HTTP client, and using testcontainers for these tests is not required. This file is an explicit exception to the repo's general no-mocks policy.

Applied to files:

  • .changeset/chat-realtime-stream-host.md
  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
  • packages/trigger-sdk/src/v3/chat.test.ts
📚 Learning: 2026-05-17T08:07:36.624Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3644
File: packages/core/src/v3/apiClient/runStream.ts:385-426
Timestamp: 2026-05-17T08:07:36.624Z
Learning: In triggerdotdev/trigger.dev, do not flag missing per-element Zod validation for S2 v2 batch SSE records (e.g., in `packages/core/src/v3/apiClient/runStream.ts` and `apps/webapp/app/services/realtime/s2realtimeStreams.server.ts`). S2 batch records come from a trusted documented upstream wire protocol; a throw on a malformed field (e.g., `seq_num.toString()`) is intentional behavior to surface wire-protocol violations rather than silently skipping them. Only the container-level guard (`Array.isArray(data.records)`) is expected.

Applied to files:

  • .changeset/chat-realtime-stream-host.md
  • packages/trigger-sdk/src/v3/chat.test.ts
📚 Learning: 2026-03-02T12:43:37.906Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: packages/core/CLAUDE.md:0-0
Timestamp: 2026-03-02T12:43:37.906Z
Learning: Exercise caution with changes to trigger.dev/core as they affect both the customer-facing SDK and server-side webapp - breaking changes can impact deployed user tasks and the platform simultaneously

Applied to files:

  • .changeset/chat-realtime-stream-host.md
📚 Learning: 2026-05-12T21:04:01.335Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3542
File: apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.sessions._index/route.tsx:78-78
Timestamp: 2026-05-12T21:04:01.335Z
Learning: In the triggerdotdev/trigger.dev codebase, the Sessions feature (routes under `sessions._index` and `sessions.$sessionParam`) intentionally uses `docsPath("/ai-chat/overview")` for its docs link. Sessions documentation lives under the AI chat overview as part of the chat.agent feature surface. Do not flag this as a mismatched link text/path.

Applied to files:

  • .changeset/chat-realtime-stream-host.md
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat.test.ts
📚 Learning: 2026-05-14T15:57:39.487Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3545
File: apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.playground.realtime.v1.sessions.$session.$io.ts:3-3
Timestamp: 2026-05-14T15:57:39.487Z
Learning: In triggerdotdev/trigger.dev, the playground and session SSE subscribe routes (e.g., `resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.playground.realtime.v1.sessions.$session.$io.ts` and sibling endpoints) intentionally use `$replica` for session lookups, including immediately after session creation. The session write and SSE subscribe occur within the same request lifecycle, replica lag on their production infrastructure is sub-millisecond, and the pattern is consistent across all sibling session-resolving endpoints. Do not flag `$replica` usage on these paths as a potential replica-lag/transient-404 risk.

Applied to files:

  • .changeset/chat-realtime-stream-host.md
  • packages/trigger-sdk/src/v3/chat.test.ts
📚 Learning: 2026-05-14T14:54:43.318Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3545
File: .server-changes/agent-view-sessions.md:10-10
Timestamp: 2026-05-14T14:54:43.318Z
Learning: In the `trigger.dev` repository, `.server-changes/*.md` files use mixed dot/slash notation for route paths intentionally (e.g., `resources.orgs.../runs.$runParam/realtime/v1/sessions/$sessionId/$io`). These files are consumed verbatim into the changelog, so notation style should not be flagged as inconsistent.

Applied to files:

  • .changeset/chat-realtime-stream-host.md
📚 Learning: 2026-03-25T15:29:25.889Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2026-03-25T15:29:25.889Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use `metadata.stream()` to stream data in realtime from inside tasks

Applied to files:

  • .changeset/chat-realtime-stream-host.md
  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
📚 Learning: 2026-05-19T21:04:52.902Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3671
File: packages/trigger-sdk/src/v3/ai.ts:724-769
Timestamp: 2026-05-19T21:04:52.902Z
Learning: Repo: triggerdotdev/trigger.dev — In packages/trigger-sdk/src/v3/ai.ts, recovery now preserves per-message clientData: replaySessionInTail returns { message, metadata, seqNum } for each session.in record, and the recovery boot queue maps metadata by message.id to reconstruct recovered turns. For messages without a matching record (e.g., hook-synthesized), it intentionally falls back to the current boot payload’s metadata. Do not flag “lost metadata on recovered turns” in future reviews when this path is in use.

Applied to files:

  • .changeset/chat-realtime-stream-host.md
  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
  • packages/trigger-sdk/src/v3/chat.test.ts
📚 Learning: 2026-06-01T15:50:21.405Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3790
File: packages/trigger-sdk/src/v3/ai.ts:0-0
Timestamp: 2026-06-01T15:50:21.405Z
Learning: In `packages/trigger-sdk/src/v3/ai.ts` in the Trigger.dev `chat.agent` tool-resolution flow, function-form `tools` should be resolved at boot using the run/continuation payload's parsed `clientData` before converting restored `accumulatedUIMessages` with `toModelMessages`, so tool `toModelOutput` is re-applied to prior persisted tool results on resumed chats. This boot-time resolution is intentionally fail-open because it only re-renders saved history; per-turn `resolveTurnTools()` remains fail-closed because reusing stale tools could leak capabilities.

Applied to files:

  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
  • packages/trigger-sdk/src/v3/chat.test.ts
📚 Learning: 2025-11-27T16:26:37.432Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T16:26:37.432Z
Learning: Applies to packages/trigger-sdk/**/*.{ts,tsx} : In the Trigger.dev SDK (packages/trigger-sdk), prefer isomorphic code like fetch and ReadableStream instead of Node.js-specific code

Applied to files:

  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
📚 Learning: 2026-06-02T21:20:48.921Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: packages/trigger-sdk/CLAUDE.md:0-0
Timestamp: 2026-06-02T21:20:48.921Z
Learning: Applies to packages/trigger-sdk/**/*.{js,ts,jsx,tsx} : Always import from `trigger.dev/sdk`. Never use `trigger.dev/sdk/v3` (deprecated path alias)

Applied to files:

  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
📚 Learning: 2026-05-23T09:12:50.004Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3719
File: packages/trigger-sdk/src/v3/ai.ts:2154-2215
Timestamp: 2026-05-23T09:12:50.004Z
Learning: In triggerdotdev/trigger.dev, packages/trigger-sdk/src/v3/ai.ts mergeIncomingIntoHydrated must treat "output-denied" as a terminal tool state (alongside "output-available" and "output-error") and include a same-state early-return to deduplicate replay/retry wire arrivals, ensuring stale "approval-responded" parts never regress a hydrated denial.

Applied to files:

  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
📚 Learning: 2026-05-18T14:19:56.437Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3655
File: packages/trigger-sdk/src/v3/ai.ts:8667-8731
Timestamp: 2026-05-18T14:19:56.437Z
Learning: In the Trigger SDK (v3) when making raw `fetch` calls to the Trigger API (including override paths such as `createChatStartSessionAction`), set the request headers to match `ApiClient`: `Content-Type`, `Authorization`, and `x-trigger-source: "sdk"`. Also forward the current preview branch by setting `x-trigger-branch` to `apiClientManager.branchName`. Prefer using the shared `overrideRequestHeaders(accessToken)` helper instead of manually constructing headers, so requests route correctly to preview environments.

Applied to files:

  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
  • packages/trigger-sdk/src/v3/chat.test.ts
📚 Learning: 2026-03-25T15:29:25.889Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2026-03-25T15:29:25.889Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Import from `trigger.dev/sdk` (NEVER from `trigger.dev/sdk/v3`)

Applied to files:

  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
📚 Learning: 2026-06-02T21:20:43.541Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-06-02T21:20:43.541Z
Learning: Applies to **/*.{ts,tsx} : Import from `trigger.dev/sdk` when writing Trigger.dev tasks. Never use `trigger.dev/sdk/v3` or deprecated `client.defineJob`

Applied to files:

  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
📚 Learning: 2026-03-25T15:29:25.889Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2026-03-25T15:29:25.889Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use `schemaTask()` from `trigger.dev/sdk` with a Zod schema for payload validation

Applied to files:

  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
📚 Learning: 2025-11-27T16:26:37.432Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T16:26:37.432Z
Learning: The SDK at packages/trigger-sdk is an isomorphic TypeScript SDK

Applied to files:

  • packages/trigger-sdk/src/v3/ai-shared.ts
📚 Learning: 2026-05-22T15:14:11.190Z
Learnt from: myftija
Repo: triggerdotdev/trigger.dev PR: 3705
File: apps/webapp/server.ts:24-25
Timestamp: 2026-05-22T15:14:11.190Z
Learning: In `apps/webapp/server.ts` (triggerdotdev/trigger.dev), direct `process.env` reads are the established pattern for top-level server bootstrap constants (e.g. `ENABLE_CLUSTER`, `WEB_CONCURRENCY`, `CLUSTER_WORKERS`, `HTTP_KEEPALIVE_TIMEOUT_MS`). Do not flag these as violations of the "use env.server.ts" guideline — `server.ts` is a pre-Remix-bootstrap entry point where `env.server.ts` is not yet initialised.

Applied to files:

  • packages/trigger-sdk/src/v3/ai-shared.ts
📚 Learning: 2026-03-22T13:26:12.060Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3244
File: apps/webapp/app/components/code/TextEditor.tsx:81-86
Timestamp: 2026-03-22T13:26:12.060Z
Learning: In the triggerdotdev/trigger.dev codebase, do not flag `navigator.clipboard.writeText(...)` calls for `missing-await`/`unhandled-promise` issues. These clipboard writes are intentionally invoked without `await` and without `catch` handlers across the project; keep that behavior consistent when reviewing TypeScript/TSX files (e.g., usages like in `apps/webapp/app/components/code/TextEditor.tsx`).

Applied to files:

  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
  • packages/trigger-sdk/src/v3/chat.test.ts
📚 Learning: 2026-03-22T19:24:14.403Z
Learnt from: matt-aitken
Repo: triggerdotdev/trigger.dev PR: 3187
File: apps/webapp/app/v3/services/alerts/deliverErrorGroupAlert.server.ts:200-204
Timestamp: 2026-03-22T19:24:14.403Z
Learning: In the triggerdotdev/trigger.dev codebase, webhook URLs are not expected to contain embedded credentials/secrets (e.g., fields like `ProjectAlertWebhookProperties` should only hold credential-free webhook endpoints). During code review, if you see logging or inclusion of raw webhook URLs in error messages, do not automatically treat it as a credential-leak/secrets-in-logs issue by default—first verify the URL does not contain embedded credentials (for example, no username/password in the URL, no obvious secret/token query params or fragments). If the URL is credential-free per this project’s conventions, allow the logging.

Applied to files:

  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
  • packages/trigger-sdk/src/v3/chat.test.ts
📚 Learning: 2026-05-18T08:21:27.694Z
Learnt from: d-cs
Repo: triggerdotdev/trigger.dev PR: 3632
File: apps/webapp/sentry.server.ts:4-21
Timestamp: 2026-05-18T08:21:27.694Z
Learning: When handling Prisma error P1001 ("Can't reach database server") in TypeScript, don’t assume a single error shape. Prisma can surface P1001 via two different error classes/fields: `PrismaClientKnownRequestError` exposes it as `err.code === "P1001"` (common during mid-query connection drops), while `PrismaClientInitializationError` exposes it as `err.errorCode === "P1001"` (common on client startup failure). Therefore, predicates should use `err.code === "P1001" || err.errorCode === "P1001"`. Do not flag `err.code === "P1001"` as “unreachable/never matches,” as it is expected in production.

Applied to files:

  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
  • packages/trigger-sdk/src/v3/chat.test.ts
📚 Learning: 2026-05-18T08:21:27.694Z
Learnt from: d-cs
Repo: triggerdotdev/trigger.dev PR: 3632
File: apps/webapp/sentry.server.ts:4-21
Timestamp: 2026-05-18T08:21:27.694Z
Learning: When handling Prisma errors for P1001 ("Can't reach database server"), do not assume it only appears under a single property name. Prisma may surface P1001 via either `PrismaClientKnownRequestError` (`err.code === "P1001"`, e.g., mid-query connection drops) or `PrismaClientInitializationError` (`err.errorCode === "P1001"`, e.g., client startup connection failure). To reliably detect the condition, check `err.code === "P1001" || err.errorCode === "P1001"`, and avoid review rules that would incorrectly flag `err.code === "P1001"` as unreachable/never-matching.

Applied to files:

  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
  • packages/trigger-sdk/src/v3/chat.test.ts
📚 Learning: 2026-03-31T21:37:27.212Z
Learnt from: isshaddad
Repo: triggerdotdev/trigger.dev PR: 3283
File: docs/migration-n8n.mdx:19-21
Timestamp: 2026-03-31T21:37:27.212Z
Learning: When reviewing code in `packages/trigger-sdk/src/v3`, treat `tasks.triggerAndWait()` and `tasks.batchTriggerAndWait()` as real exported APIs. They are defined in `shared.ts` and re-exported via the `tasks` object in `tasks.ts`, and they take the task ID string as their first argument (not a task instance). This is distinct from the instance methods `yourTask.triggerAndWait()` and `yourTask.batchTriggerAndWait()`. Do not flag calls to `tasks.triggerAndWait()` or `tasks.batchTriggerAndWait()` as non-existent or incorrectly invoked.

Applied to files:

  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
  • packages/trigger-sdk/src/v3/chat.test.ts
📚 Learning: 2026-05-17T08:08:12.370Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3644
File: packages/trigger-sdk/src/v3/ai.ts:8695-8746
Timestamp: 2026-05-17T08:08:12.370Z
Learning: In the Trigger v3 session resume/streams logic, ensure session resumption uses sequence cursors rather than timestamps. Specifically: for each turn-complete control record written to `session.out`, include a `session-in-event-id` header whose value is the committed-consume cursor (`session.in.lastDispatchedSeqNum`). On boot/resume, scan `session.out` for the latest turn-complete record, read the `session-in-event-id` header, and seed the `sessionStreams` manager for `.in` using both `lastSeqNum` and `lastDispatchedSeqNum` so previously processed user messages are not replayed. Do not use `setMinTimestamp`/`lastOutTimestamp` for resume ordering in this flow.

Applied to files:

  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
  • packages/trigger-sdk/src/v3/chat.test.ts
📚 Learning: 2026-05-19T22:37:47.286Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3671
File: packages/trigger-sdk/test/recovery-boot.test.ts:456-457
Timestamp: 2026-05-19T22:37:47.286Z
Learning: In `packages/trigger-sdk` (Trigger.dev SDK), `logger.warn` (and other SDK logger methods) should route to the Trigger.dev structured logger sink, not to `console.warn`. In SDK tests, `vi.spyOn(console, "warn")` (or similar console spies) should only be used to suppress stray console output; reviewers should not suggest asserting on `console.warn` spies to verify SDK-internal warning/fallback log behavior. Use the SDK’s structured-logger outputs/capture approach instead of console spies.

Applied to files:

  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
  • packages/trigger-sdk/src/v3/chat.test.ts
📚 Learning: 2026-06-04T18:16:35.386Z
Learnt from: nicktrn
Repo: triggerdotdev/trigger.dev PR: 3836
File: apps/supervisor/src/backpressure/backpressureMonitor.ts:3-5
Timestamp: 2026-06-04T18:16:35.386Z
Learning: When reviewing TypeScript in this repo, apply the rule “prefer type aliases over interfaces” only to data/object shapes and union/intersection type modeling. If an interface is being used as a behavioral contract for collaborators to implement (e.g., method-shape interfaces that define required behavior, such as `BackpressureLogger` / `BackpressureSignalSource` in `apps/supervisor/src/backpressure/backpressureMonitor.ts`), keep it as an `interface` and do not flag it as a type-alias-vs-interface violation.

Applied to files:

  • packages/trigger-sdk/src/v3/ai-shared.ts
  • packages/trigger-sdk/src/v3/chat.ts
  • packages/trigger-sdk/src/v3/chat-client.ts
  • packages/trigger-sdk/src/v3/chat.test.ts
📚 Learning: 2026-04-15T15:39:31.575Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/webapp.mdc:0-0
Timestamp: 2026-04-15T15:39:31.575Z
Learning: Applies to apps/webapp/**/*.{ts,tsx} : Use subpath exports from `trigger.dev/core` package instead of importing from the root `trigger.dev/core` path

Applied to files:

  • packages/trigger-sdk/src/v3/chat.ts
📚 Learning: 2026-03-25T15:29:25.889Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: .cursor/rules/writing-tasks.mdc:0-0
Timestamp: 2026-03-25T15:29:25.889Z
Learning: Applies to **/trigger/**/*.{ts,tsx,js,jsx} : Use `task()` from `trigger.dev/sdk` for basic task definitions with `id` and `run` properties

Applied to files:

  • packages/trigger-sdk/src/v3/chat-client.ts
📚 Learning: 2026-05-23T15:25:28.060Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3719
File: packages/trigger-sdk/src/v3/ai.ts:6233-6256
Timestamp: 2026-05-23T15:25:28.060Z
Learning: Repo: triggerdotdev/trigger.dev
File: packages/trigger-sdk/src/v3/ai.ts (hydrateMessages path, ~Lines 6160–6170)
Learning: When `hydrateMessages` is used, dedupe for `onTurnComplete.newUIMessages`/`newMessages` must compare the incoming message id against the pre-hydration chain (the `accumulatedUIMessages` captured BEFORE `hydrateMessages` runs), not the post-hydration `hydrated` array. The canonical hydrate pattern persists and returns the fresh user message, so checking against `hydrated` would incorrectly drop that user turn from `newUIMessages`. Implement by snapshotting a `previouslyKnownMessageIds` Set from the pre-hydration chain and using it for the `matchedExisting` test.

Applied to files:

  • packages/trigger-sdk/src/v3/chat-client.ts
  • packages/trigger-sdk/src/v3/chat.test.ts
📚 Learning: 2026-05-18T14:40:02.173Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3658
File: packages/core/src/v3/realtimeStreams/manager.test.ts:1-147
Timestamp: 2026-05-18T14:40:02.173Z
Learning: In this repo’s trigger.dev codebase, the “never mock — use testcontainers” guideline should only be applied to integration tests that talk to real external services (e.g., Redis, Postgres, S2). For unit tests that validate in-memory logic (e.g., deduplication/cache behavior in StandardRealtimeStreamsManager and similar module-boundary call counting), it is allowed to use Vitest mocks like `vi.fn()` and to stub/mock `ApiClient` objects to count calls or simulate in-process collaborators. Do not flag `vi.fn()`-based mocks as policy violations in these unit-test scenarios; reserve the rule for true external-service integration tests.

Applied to files:

  • packages/trigger-sdk/src/v3/chat.test.ts
📚 Learning: 2026-05-04T19:14:44.097Z
Learnt from: matt-aitken
Repo: triggerdotdev/trigger.dev PR: 3499
File: apps/webapp/test/auth-api.e2e.full.test.ts:205-227
Timestamp: 2026-05-04T19:14:44.097Z
Learning: In triggerdotdev/trigger.dev's e2e auth test suite (`apps/webapp/test/auth-api.e2e.full.test.ts` and related `*.e2e.full.test.ts` files), loose negative assertions like `expect(res.status).not.toBe(200)` are intentional. External infrastructure (e.g. ClickHouse) is unreachable in the e2e test environment, so a 5xx from the route handler after auth passes is an expected and acceptable outcome. Tightening these to a specific set like `[401, 403, 404]` would incorrectly exclude valid 5xx results. Do not flag these as issues during review.

Applied to files:

  • packages/trigger-sdk/src/v3/chat.test.ts
📚 Learning: 2026-05-18T14:40:02.173Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3658
File: packages/core/src/v3/realtimeStreams/manager.test.ts:1-147
Timestamp: 2026-05-18T14:40:02.173Z
Learning: In the triggerdotdev/trigger.dev repo, the policy “Never mock anything — use testcontainers instead” should only be enforced for integration tests that interact with real external services (e.g., Redis, Postgres) via actual infrastructure. For unit tests that exercise pure in-memory logic (e.g., cache semantics) it is OK to stub collaborators such as `ApiClient` using Vitest (`vi.fn()`) to assert call counts or control behavior. Do not flag `vi.fn()`-based `ApiClient` stubs in unit tests as violations of the testcontainers policy.

Applied to files:

  • packages/trigger-sdk/src/v3/chat.test.ts
📚 Learning: 2026-05-07T12:24:11.575Z
Learnt from: d-cs
Repo: triggerdotdev/trigger.dev PR: 3531
File: apps/webapp/test/sentryTraceContext.server.test.ts:1-7
Timestamp: 2026-05-07T12:24:11.575Z
Learning: In the triggerdotdev/trigger.dev `apps/webapp` package, the vitest configuration (`apps/webapp/vitest.config.ts`) sets `include: ["test/**/*.test.ts"]`. All webapp tests must live under the top-level `apps/webapp/test/` directory (46+ files follow this pattern). Co-located test files placed next to source files under `apps/webapp/app/` will NOT be discovered by vitest and will silently not run. Do not flag webapp tests for being in `test/` instead of co-located with their source.

Applied to files:

  • packages/trigger-sdk/src/v3/chat.test.ts
📚 Learning: 2026-04-07T14:12:18.946Z
Learnt from: matt-aitken
Repo: triggerdotdev/trigger.dev PR: 3331
File: apps/webapp/test/engine/batchPayloads.test.ts:5-24
Timestamp: 2026-04-07T14:12:18.946Z
Learning: In `apps/webapp/test/engine/batchPayloads.test.ts`, using `vi.mock` for `~/v3/objectStore.server` (stubbing `hasObjectStoreClient` and `uploadPacketToObjectStore`), `~/env.server` (overriding offload thresholds), and `~/v3/tracer.server` (stubbing `startActiveSpan`) is intentional and acceptable. Simulating controlled transient upload failures (e.g., fail N times then succeed) to verify `p-retry` behavior cannot be reproduced with real services or testcontainers. This file is an explicit exception to the repo's general no-mocks policy.

Applied to files:

  • packages/trigger-sdk/src/v3/chat.test.ts
📚 Learning: 2026-05-07T12:25:21.024Z
Learnt from: d-cs
Repo: triggerdotdev/trigger.dev PR: 3531
File: apps/webapp/test/sentryTraceContext.server.test.ts:9-47
Timestamp: 2026-05-07T12:25:21.024Z
Learning: In the triggerdotdev/trigger.dev webapp test suite, `createInMemoryTracing()` calls that register a `NodeTracerProvider` globally are intentionally left without `afterEach`/`afterAll` teardown. This is consistent across tests like `runsReplicationService.part1.test.ts`, `runsBackfiller.test.ts`, and `runsReplicationBenchmark.test.ts`. The "returns undefined when no OTel span is active" pattern is safe because `trace.getActiveSpan()` outside a `context.with(...)` block reads from `AsyncLocalStorage.getStore()` (undefined when no `run()` is in scope), falling back to `ROOT_CONTEXT` with no attached span — regardless of which provider is registered. Do not flag missing OTel provider teardown in webapp tests as a test-ordering risk.

Applied to files:

  • packages/trigger-sdk/src/v3/chat.test.ts
📚 Learning: 2026-04-16T13:45:22.317Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 3368
File: apps/webapp/test/engine/taskIdentifierRegistry.test.ts:3-19
Timestamp: 2026-04-16T13:45:22.317Z
Learning: In `apps/webapp/test/engine/taskIdentifierRegistry.test.ts`, the `vi.mock` calls for `~/services/taskIdentifierCache.server` (stubbing `getTaskIdentifiersFromCache` and `populateTaskIdentifierCache`), `~/models/task.server` (stubbing `getAllTaskIdentifiers`), and `~/db.server` (stubbing `prisma` and `$replica`) are intentional. The suite uses real Postgres via testcontainers for all `TaskIdentifier` DB operations, but isolates the Redis cache layer and legacy query fallback as separate concerns not exercised in this test file. Do not flag these mocks as violations of the no-mocks policy in future reviews.

Applied to files:

  • packages/trigger-sdk/src/v3/chat.test.ts
📚 Learning: 2026-05-04T19:14:58.481Z
Learnt from: matt-aitken
Repo: triggerdotdev/trigger.dev PR: 3499
File: apps/webapp/test/api-auth.e2e.test.ts:149-158
Timestamp: 2026-05-04T19:14:58.481Z
Learning: In triggerdotdev/trigger.dev (apps/webapp/test/api-auth.e2e.test.ts and apps/webapp/test/auth-api.e2e.full.test.ts), the `expect(res.status).not.toBe(401)` / `expect(res.status).not.toBe(403)` assertion shape for "auth passes" tests is intentional. The handler can return other 4xx/5xx codes due to downstream infra reasons in the test container (e.g., missing body validation, resource not found, infra errors), so pinning to a specific success code like 400 would cause false negatives. Do not flag these as needing tighter assertions.

Applied to files:

  • packages/trigger-sdk/src/v3/chat.test.ts
🔇 Additional comments (4)
packages/trigger-sdk/src/v3/chat-client.ts (1)

31-35: LGTM!

Also applies to: 335-346

packages/trigger-sdk/src/v3/chat.ts (1)

36-36: LGTM!

Also applies to: 287-290, 470-482

packages/trigger-sdk/src/v3/chat.test.ts (1)

657-752: LGTM!

.changeset/chat-realtime-stream-host.md (1)

1-18: LGTM!

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