Skip to content

feat(sdk,core,webapp): transcript storage for chat.agent - #4896

Merged
ericallam merged 1 commit into
mainfrom
feat/transcript-storage-tri-13667
Sep 9, 2026
Merged

feat(sdk,core,webapp): transcript storage for chat.agent#4896
ericallam merged 1 commit into
mainfrom
feat/transcript-storage-tri-13667

Conversation

@ericallam

@ericallam ericallam commented Sep 5, 2026

Copy link
Copy Markdown
Member

Adds a pluggable TranscriptStorage seam so a chat.agent run can own its conversation history across continuations:

  • Version 2 transcript snapshot + dual-version dashboard reader
  • The storage option, a read API, and a conformance suite
  • Run-tail recovery for every chat.agent
  • Compaction and injected-context persistence
  • A dashboard TranscriptStorage over the agent's message rows

This collapses the former 5-PR review stack (#4904, #4893, #4894, #4895) into a single PR after rebasing onto main and migrating to zod v4 (the stack was on zod v3 and conflicted with the zod v4 upgrade #4039). All prior review threads were addressed on the stack branches.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds a TranscriptStorage adapter for chat.agent, including default and custom storage, incremental changesets, transcript state, cursors, and context loading. Adds paginated transcript APIs, server and React loading helpers, and storage conformance tests. Adds dashboard-agent database persistence with migrations. Updates snapshot handling, crash recovery, injection and compaction persistence, deprecates hydrateMessages, and documents the new APIs and migration path.

Merge Risk: 🟡 Moderate · up to 3ddfb

This change adds persisted chat transcripts, loading, paging, and recovery behavior. The remaining documentation issues could cause users to implement incompatible action handling or incomplete recovery flows, so they should be corrected before merge.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 47.06% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 17 files. (2 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description accurately summarizes the feature, implementation scope, and review history, but it does not follow the repository template. It omits the issue reference, checklist, testing steps, cha… Add the required template sections. Include a Closes # reference, complete the checklist, describe the tests that were run and their results, add a short changelog entry, and include screenshots or state that they are not applicable.
✅ Passed checks (3 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly and concisely identifies the main change: adding transcript storage for chat.agent across the SDK, core, and webapp.
Full details: Docstring Coverage

Explanation

Docstring coverage is 47.06% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 17 files. (2 skipped: 2 unsupported.)

Full details: Description check

Explanation

The description accurately summarizes the feature, implementation scope, and review history, but it does not follow the repository template. It omits the issue reference, checklist, testing steps, changelog, and screenshots sections.

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/transcript-storage-tri-13667

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.

@changeset-bot

changeset-bot Bot commented Sep 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ed95a9e

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

This PR includes changesets to release 27 packages
Name Type
@trigger.dev/sdk Minor
@trigger.dev/core Minor
@trigger.dev/python Minor
@internal/dashboard-agent Patch
@trigger.dev/build Minor
trigger.dev Minor
@trigger.dev/redis-worker Minor
@trigger.dev/schema-to-json Minor
@internal/clickhouse Patch
@internal/llm-model-catalog Patch
@internal/metrics-pipeline Patch
@trigger.dev/rbac Minor
@internal/redis Patch
@internal/replication Patch
@internal/run-engine Patch
@internal/run-store Patch
@internal/schedule-engine Patch
@internal/tracing Patch
@internal/webhook-engine Patch
@internal/webhook-sources Patch
@internal/cache Patch
@trigger.dev/react-hooks Minor
@trigger.dev/rsc Minor
@trigger.dev/database Minor
@trigger.dev/otlp-importer Minor
@trigger.dev/sso Minor
@internal/testcontainers 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

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Observability map

As of ed95a9e.

19/100 over 457 measured of 475 entry points (base 19, no change)

What this PR changed

route base head now failing
/resources/preferences/chat-open-mode new 0 request-context
/api/v1/sessions/:sessionId/transcript new 50 request-context

FIX FIRST

  • /api/v1/projects/:projectRef/envvars (sensitive) - auth-boundary, request-context
  • /auth/sso (sensitive) - auth-boundary, request-context
  • /_app/orgs/:organizationSlug/settings/team (sensitive) - error-classification, auth-scope, request-context

AUDIT 3 of 50 sensitive mutations record an actor. 47 without one.
CONTEXT 23 of 457 entry points name a tenant on a failure path. 354 appear only here, 39 of them sensitive, in the JSON rather than the fix list.

What the score is made of
CHECKS
  error-classification  186 applicable, 107 pass,   0 sole, global without it 11
  auth-boundary          62 applicable,  57 pass,   0 sole, global without it 16
  auth-scope             19 applicable,  17 pass,   0 sole, global without it 19
  request-context       457 applicable,  23 pass, 249 sole, global without it 64
  audit-trail            50 applicable,   3 pass,   0 sole, not in the score

The score and findings here are report-only and never gate the merge. Separately, a required test suite keeps this tool's symbol and route lists in sync with the code they name, and can fail a pull request that renames or removes a symbol they reference, or that adds the first route with a segment they anticipate. Each failure names the list to edit. The rules and their reasons: internal-packages/observability-map/README.md.

@ericallam
ericallam force-pushed the feat/transcript-storage-gate-split-tri-13667 branch from c5e1f5d to bac2a16 Compare September 5, 2026 20:29
@ericallam
ericallam force-pushed the feat/transcript-storage-tri-13667 branch from 2b2ea99 to be72173 Compare September 5, 2026 20:29
@pkg-pr-new

pkg-pr-new Bot commented Sep 5, 2026

Copy link
Copy Markdown

Open in StackBlitz

@trigger.dev/build

npm i https://pkg.pr.new/@trigger.dev/build@ed95a9e

trigger.dev

npm i https://pkg.pr.new/trigger.dev@ed95a9e

@trigger.dev/core

npm i https://pkg.pr.new/@trigger.dev/core@ed95a9e

@trigger.dev/python

npm i https://pkg.pr.new/@trigger.dev/python@ed95a9e

@trigger.dev/react-hooks

npm i https://pkg.pr.new/@trigger.dev/react-hooks@ed95a9e

@trigger.dev/redis-worker

npm i https://pkg.pr.new/@trigger.dev/redis-worker@ed95a9e

@trigger.dev/rsc

npm i https://pkg.pr.new/@trigger.dev/rsc@ed95a9e

@trigger.dev/schema-to-json

npm i https://pkg.pr.new/@trigger.dev/schema-to-json@ed95a9e

@trigger.dev/sdk

npm i https://pkg.pr.new/@trigger.dev/sdk@ed95a9e

commit: ed95a9e

@ericallam
ericallam force-pushed the feat/transcript-storage-gate-split-tri-13667 branch from bac2a16 to bb1acb8 Compare September 5, 2026 20:38
@ericallam
ericallam force-pushed the feat/transcript-storage-tri-13667 branch from be72173 to 5dc4365 Compare September 5, 2026 20:38
@ericallam
ericallam force-pushed the feat/transcript-storage-gate-split-tri-13667 branch from bb1acb8 to 8bb1a1c Compare September 6, 2026 05:42
@ericallam
ericallam force-pushed the feat/transcript-storage-tri-13667 branch from 5dc4365 to 3bdfd45 Compare September 6, 2026 05:42
@ericallam
ericallam force-pushed the feat/transcript-storage-gate-split-tri-13667 branch from 8bb1a1c to 10a1d68 Compare September 6, 2026 05:55
@ericallam
ericallam force-pushed the feat/transcript-storage-tri-13667 branch from 3bdfd45 to db561bb Compare September 6, 2026 05:55
@ericallam
ericallam force-pushed the feat/transcript-storage-gate-split-tri-13667 branch from 10a1d68 to f2a1179 Compare September 6, 2026 06:17
@ericallam
ericallam force-pushed the feat/transcript-storage-tri-13667 branch from db561bb to 185360a Compare September 6, 2026 06:17
@ericallam
ericallam force-pushed the feat/transcript-storage-gate-split-tri-13667 branch from f2a1179 to 860969d Compare September 6, 2026 06:18
@ericallam
ericallam force-pushed the feat/transcript-storage-tri-13667 branch from 185360a to 461a6d2 Compare September 6, 2026 06:18
@ericallam
ericallam force-pushed the feat/transcript-storage-gate-split-tri-13667 branch from 860969d to 0b4aa77 Compare September 6, 2026 06:39
@ericallam
ericallam force-pushed the feat/transcript-storage-tri-13667 branch from 461a6d2 to 1a3b477 Compare September 6, 2026 06:39
@ericallam
ericallam force-pushed the feat/transcript-storage-gate-split-tri-13667 branch from 0b4aa77 to b12a0b7 Compare September 6, 2026 08:05
@ericallam
ericallam force-pushed the feat/transcript-storage-tri-13667 branch from 1a3b477 to d06408f Compare September 6, 2026 08:06
@ericallam
ericallam force-pushed the feat/transcript-storage-gate-split-tri-13667 branch from b12a0b7 to dce7b9b Compare September 6, 2026 08:43
@ericallam
ericallam force-pushed the feat/transcript-storage-tri-13667 branch from d06408f to a4f1bfe Compare September 6, 2026 08:43
@ericallam
ericallam marked this pull request as ready for review September 6, 2026 16:36
devin-ai-integration[bot]

This comment was marked as resolved.

@ericallam
ericallam force-pushed the feat/transcript-storage-tri-13667 branch 6 times, most recently from 39a00da to bf8496f Compare September 7, 2026 07:48
coderabbitai[bot]

This comment was marked as resolved.

@ericallam
ericallam force-pushed the feat/transcript-storage-gate-split-tri-13667 branch from 1e23c34 to d627683 Compare September 7, 2026 10:22
@ericallam
ericallam force-pushed the feat/transcript-storage-tri-13667 branch from 7a6c3fd to 0a10002 Compare September 7, 2026 10:22
devin-ai-integration[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@ericallam
ericallam force-pushed the feat/transcript-storage-tri-13667 branch from 3ddfb85 to bca2b92 Compare September 8, 2026 09:48
@ericallam
ericallam force-pushed the feat/transcript-storage-gate-split-tri-13667 branch from d627683 to 8292d10 Compare September 8, 2026 09:48
devin-ai-integration[bot]

This comment was marked as resolved.

@ericallam
ericallam force-pushed the feat/transcript-storage-gate-split-tri-13667 branch from 8292d10 to 70a6e1d Compare September 8, 2026 17:53
@ericallam
ericallam force-pushed the feat/transcript-storage-tri-13667 branch 2 times, most recently from af81d57 to 5f06b37 Compare September 8, 2026 18:07
@ericallam
ericallam added this pull request to the merge queue Sep 8, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue because a pull request earlier in the stack was removed Sep 8, 2026
Give chat.agent a pluggable TranscriptStorage seam so a run can own its
conversation history across continuations: the version 2 transcript snapshot
and dual-version dashboard reader, the storage option with a read API and
conformance suite, run-tail recovery, compaction and injected-context
persistence, and a dashboard TranscriptStorage over the agent's message rows.
Includes the continuation-boot recovery hardening and the compaction/injection
persistence fix. Rebased onto main and migrated to zod v4.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VG39FXXkFFU24U5EtJMwPi

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

Devin Review

@ericallam
ericallam added this pull request to the merge queue Sep 9, 2026
Merged via the queue into main with commit df6972c Sep 9, 2026
86 of 97 checks passed
@ericallam
ericallam deleted the feat/transcript-storage-tri-13667 branch September 9, 2026 06:42
pull Bot pushed a commit to erickirt/trigger.dev that referenced this pull request Sep 9, 2026
Follow-ups to the transcript storage feature (triggerdotdev#4896), surfaced by
dogfooding it in the durable-chat example.

## Changes
- **Drop the compaction prefix fingerprint.** A compacted lane is reused
while its `throughId` still exists in the transcript. A rollback that
crosses the compaction point rebuilds from the transcript; an in-place
edit of a summarized message is tolerated (unsupported by design). This
removes the implicit requirement that a custom `TranscriptStorage`
preserve exact message JSON — no more "store as TEXT not JSONB /
canonicalize keys" trap.
- **Skip persisting a content-less assistant response.** A turn that
errors before the model writes anything no longer leaves an empty
assistant bubble in the transcript or the next turn's context.
- **Non-empty error fallback.** A thrown error with no message now
surfaces a generic message instead of a blank error to the client.
- **Test harness:** `seedSessionInTail` stamps the harness `clientData`
onto seeded records (matching how production carries each record's
metadata), so recovery re-dispatch is testable for `clientDataSchema`
agents.

## Verification
- `@trigger.dev/sdk` + `@trigger.dev/core` typecheck clean
- Full `@trigger.dev/sdk` suite: 633 passing (includes new tests for the
throughId-boundary compaction behavior, the empty-response skip, and
clientData-scoped recovery re-dispatch)
- oxfmt + oxlint clean

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.

2 participants