Repository navigation
fix(workspace): key the transcript snapshot guard by the stream directory - #825
Merged
Ishaan Gangwani (ishaan1124) merged 2 commits intoSep 29, 2026
Conversation
ANIRUDDHA ADAK (aniruddhaadak80)
requested review from
Aayam Bansal (aayambansal) and
Ishaan Gangwani (ishaan1124)
as code owners
September 29, 2026 03:19
|
ANIRUDDHA ADAK (@aniruddhaadak80) is attempting to deploy a commit to the InkVell Team on Vercel. A member of the Team first needs to authorize it. |
…tory loadMessages read the SSE change ledger with the route scope, but the ledger is written under the physical directory the event stream publishes. A project is opened with a projectID, so the two differ and the guard never saw a change, letting a pre-stream snapshot overwrite live text. Thread the stream directory alongside the store key.
ANIRUDDHA ADAK (aniruddhaadak80)
force-pushed
the
fix/transcript-hydration-key
branch
from
September 29, 2026 04:45
9f34144 to
7a00189
Compare
Prettier requires a blank line between a markdown heading and the list that follows it, and the entry landed directly under `### Fixed`. The Format job failed on this file; the source change and its test are unaffected. Refs synthetic-sciences#824
Ishaan Gangwani (ishaan1124)
merged commit Sep 29, 2026
b5dec20
into
synthetic-sciences:main
6 of 7 checks passed
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.
Summary
Entering a session could rewind a running conversation's text and resurrect messages the event stream had already deleted. The guard meant to prevent that read its change ledger under the wrong key, so it was permanently inert for any session opened with a
projectID. This threads the event stream's physical directory through to the ledger lookup.Root cause
loadMessagesinfrontend/workspace/src/context/sync.tsxguards against an in-flight HTTP snapshot overwriting newer streamed state:input.directoryis the route scope. Both call sites set it fromsdk.scope, andsdk.tsx:17defines that as:But the ledger is written under the physical directory the event stream publishes.
global-sync.tsx:1065takesconst directory = e.nameoff the SSE event andmarkTranscriptMutation(directory, ...)keys the ledger with it, andtranscriptKeyis a raw join with no folding:So the read key and the write key live in different namespaces whenever a
projectIDis present — the normal way a project session is opened.revisionis permanently0andchangesSincepermanently returns empty sets, so the guard never sees a change. With emptypreferCached/removed,mergeHydratedMessagesthen lets the older HTTP snapshot overwrite the newer streamed state and resurrect messages SSE deleted.The reconnect path in the same file (
global-sync.tsx:994,997) already uses the same physical key asmarkTranscriptMutationand is correct — only the hydration call site was mis-keyed.sync.tsx:23usesglobalSync.child(sdk.directory, …), so events do reach the store correctly; it was purely the ledger lookup.Changes
frontend/workspace/src/context/sync.tsxloadMessagestakes an additionalstreamDirectoryinput and uses it for bothrevision(...)andchangesSince(...), leavinginput.directoryto key the inflight map and the store as before.streamDirectory: sdk.directory.frontend/workspace/src/context/transcript-hydration.test.ts(new)GET /session/{id}/messageopen, pushes amessage.part.updatedframe while the request is in flight, then releases an older snapshot. Asserts the streamed text survives.CHANGELOG.mdUnreleased→Fixed, as the repo requires for user-visible behaviour changes.Testing
Confirmed the regression test fails without the fix. Restoring the pre-fix
sync.tsxand keeping the new test:With the fix restored:
The neighbouring suite in the touched area passes in isolation:
Full workspace suite (
bun run test:workspace, 188 files):The 8 failures are 5 s per-test timeouts that appear only under full-suite load, not regressions from this change. Four are named above (
files pane×2,project bootstrap,local notebook documents); running the bootstrap file alone gives 9 pass / 0 fail, including the two tests closest to this change. The rest are infiles pane/local notebook documents/volumeareas untouched by this diff, and were not investigated further — I could not get a clean full-suite baseline on this machine because the working tree also carries an unrelated in-progress rebase on another branch.Fixes #824