Repository navigation
fix(sessions): share the change-feed mirror between hosts (#2205) - #2404
Merged
threepointone merged 1 commit intoSep 28, 2026
Merged
Conversation
🦋 Changeset detectedLatest commit: 0cb19a6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
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 |
threepointone
added this pull request to stack #2407
September 28, 2026 14:47
threepointone
marked this pull request as ready for review
September 28, 2026 14:50
threepointone
force-pushed
the
fix/2205-session-mirror
branch
from
September 28, 2026 15:46
4941ace to
21ca00e
Compare
Contributor
🔴 agents import sizes: 1 entry point over threshold
Changed exports (2)
How this worksEach runtime export is bundled on its own, minified, and gzipped. Changes smaller than 100 B, or smaller than 1% and 1 KiB, are ignored. Growth over 10% or 5 KiB is marked 🔴. This report is informational and does not fail CI. The workflow artifact contains every measurement. Compared |
Adds session.mirror(), the one reduction AIChatAgent and Think each carried a copy of. Think keeps its branch, compaction and prompt-refresh handling through the intercept and onApplied hooks. Co-authored-by: Cursor <cursoragent@cursor.com>
threepointone
force-pushed
the
fix/2205-session-mirror
branch
from
September 28, 2026 16:54
21ca00e to
0cb19a6
Compare
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2205.
Problem
AIChatAgentandThinkeach carried their own copy of the reduction that keeps an in-memory transcript in step with the Sessions change feed. That covers upserting on append and update, filtering on delete, and emptying on clear. The two copies had already drifted in small ways.Fix
A new
session.mirror({ get, set, transform?, intercept?, onApplied? })applies the shared reduction for one session:get()is read on every event, so a host that reassigns its array is followed rather than shadowed.interceptlets a host handle an event itself.onAppliedreports each write together with the entry it replaced.AIChatAgentuses the plain form.Thinkkeeps its own behavior exactly through the hooks: branch appends resync, imports mark the cache stale, compaction resyncs and refreshes the prompt, and linear appends still drive growth accounting and media-eviction bookkeeping.Tests
mirrortests intests/sessions/capability.test.tscover the reduction, reassignment, theonAppliedlog,intercept, other sessions, and unsubscribe.