Skip to content

fix(think): preserve active transcript during repair - #2121

Open
ben-reitz wants to merge 1 commit into
fix/think-regeneration-contextfrom
fix/think-regeneration-transcript-repair
Open

fix(think): preserve active transcript during repair#2121
ben-reitz wants to merge 1 commit into
fix/think-regeneration-contextfrom
fix/think-regeneration-transcript-repair

Conversation

@ben-reitz

@ben-reitz ben-reitz commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Stacked on #2038.

Problem

Think can repair provider-normalized messages for a selected model branch. That repair path also replaced _cachedMessages with the selected branch, even when it was not the active client-visible transcript. Regenerating from an older branch could therefore make connected clients lose or switch away from their live branch.

Fix

  • persist provider-normalized rows for the selected model history
  • patch matching rows in the active Session cache
  • never install arbitrary branch history as the client-visible transcript
  • keep WebSocket broadcasts scoped to the active transcript

Testing

  • 88 client-tools tests
  • regression forces provider repair during sibling regeneration and verifies the repaired row, active transcript, WebSocket broadcast, and previous sibling

Stack

  1. fix(agents): keep session compactions branch-local #2120 — Session branch-local compaction
  2. fix(think): preserve regeneration branch context #2038 — Think regeneration context
  3. This PR — transcript repair ownership
  4. fix(think): preserve branches during recovery #2122 — branch-aware recovery
  5. fix(think): preserve regeneration branches after restart #2057 — restart durability

@changeset-bot

changeset-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f550e0f

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

This PR includes changesets to release 2 packages
Name Type
@cloudflare/think Patch
@cloudflare/agent-think 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

@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: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@pkg-pr-new

pkg-pr-new Bot commented Aug 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

agents

npm i https://pkg.pr.new/agents@2121

@cloudflare/ai-chat

npm i https://pkg.pr.new/@cloudflare/ai-chat@2121

@cloudflare/codemode

npm i https://pkg.pr.new/@cloudflare/codemode@2121

hono-agents

npm i https://pkg.pr.new/hono-agents@2121

@cloudflare/shell

npm i https://pkg.pr.new/@cloudflare/shell@2121

@cloudflare/think

npm i https://pkg.pr.new/@cloudflare/think@2121

@cloudflare/voice

npm i https://pkg.pr.new/@cloudflare/voice@2121

@cloudflare/worker-bundler

npm i https://pkg.pr.new/@cloudflare/worker-bundler@2121

commit: 2112f98

@ben-reitz
ben-reitz force-pushed the fix/think-regeneration-transcript-repair branch from 33051bb to 16eb0ea Compare August 17, 2026 09:42
@ben-reitz
ben-reitz force-pushed the fix/think-regeneration-transcript-repair branch from 16eb0ea to 55495dd Compare August 18, 2026 08:49
@ben-reitz
ben-reitz force-pushed the fix/think-regeneration-transcript-repair branch from 55495dd to ca2179b Compare August 18, 2026 09:17
@ben-reitz
ben-reitz force-pushed the fix/think-regeneration-transcript-repair branch 2 times, most recently from a0c57c0 to 565ac07 Compare August 18, 2026 10:25
@ben-reitz
ben-reitz force-pushed the fix/think-regeneration-transcript-repair branch from 565ac07 to 7a62faf Compare August 18, 2026 10:35
@ben-reitz
ben-reitz force-pushed the fix/think-regeneration-transcript-repair branch from 7a62faf to 343c6fb Compare August 18, 2026 13:13
@ben-reitz
ben-reitz force-pushed the fix/think-regeneration-transcript-repair branch from 343c6fb to 2112f98 Compare August 18, 2026 13:17
@ben-reitz
ben-reitz force-pushed the fix/think-regeneration-transcript-repair branch from 2112f98 to f550e0f Compare August 19, 2026 09:15
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