Repository navigation
perf(move): a moved chat opens in about two seconds; its files arrive behind it - #2714
Merged
Merged
Conversation
AbirAbbas
added a commit
that referenced
this pull request
Nov 17, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nt object failures A take fetched missing objects one GetMany batch at a time and never retried a failed request, so a 40 KB chat cost several seconds of serial round trips and one relay 500 threw away minutes of download. The fetcher now keeps up to eight batches in flight, retries 5xx, timeouts and resets with backoff (never auth refusals or other 4xx), and keeps the objects it already stored. Co-Authored-By: Claude Opus 5.5 <[email protected]>
TakeSeen read the chat's record and Taker.Take read it again, one more serial relay round trip before the chat could open. The seen record is now passed down. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…es in behind it Continuing a chat on another computer waited for every workspace file, the vault pull, task-copy restore, git status and index rebuilds before drawing the conversation: 7-12 s for a 40 KB chat and minutes for a large folder. The take now installs the conversation records, takes the hold and opens the chat after at most three serial relay round trips; workspace files and the after-work continue in the background with a files-arriving status line. Workspace tools wait on a per-chat ready gate so nothing reads a half-arrived tree, the phase line gains shown= and files=, and CODEAF_MOVE_FILES_FIRST=1 restores the old order. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ehind it Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tinue path A real two-computer run of the first cut still waited 13 s on a warm 2,538-file chat that needed only 11 objects: the take seeded the receiver's whole older tree, hashed it for local edits, and fetched every conversation record before opening, and the launch and idle auto-continue paths skipped the early open and fetched serially. The open now fetches only the head frame and open-state records in one parallel wave, hardlinks just those into place, checks local edits by size and mtime (full hashing moves behind the open), and the idle, alt+c and agents.open paths use the same split. A realistic test (300+ conversation objects, 2,500 files, stale and cold receivers, 400 ms per request) failed at 8 and 6 rounds before and opens in 3 now. The phase line adds open_gets=, open_rounds= and open_seed=. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…o to the arriving chat Home's bottom line went blank for twelve seconds during a move, and anything typed on Home in that time went into Home's own box, where Enter started a new conversation. The line now says opening conversation with its bytes from the keypress on, and text typed during a move is held as the arriving chat's draft and never sent by itself. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…y stat alone A warm receiver already holds most of the conversation's open state and its earlier transcript chunks, so the open fetch now reuses them instead of asking the relay again, and caches every open-state object it does fetch. The stat index also records the sealed transcript's hash, so bookkeeping lines appended after a seal no longer push the local-edits check onto the slow furrow path. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… the chat opens The local reader is asked to let go at the keypress and released concurrently; the device name for the banner is looked up after the chat is shown; the kept branch is read only when there is an unshared local turn; local work overlaps the directory read. The phase line gains open_path=, and every directory request on the open path counts toward open_rounds. TestQ3 models the launch auto-continue with its real shape: 8 serial rounds before, 3 after. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…iles before they arrive The move runs in the client process while the session's tools and captures run in the engine, so the in-memory arrival gate never reached them. The arrival now also leaves a marker in the engine's local per-cell store (never inside the cell, so it is never sealed or sent), carrying its owner's PID and start time so a crashed owner never stalls a waiter. Dirty, SavedState, Restore and the vault round wait on it, which is what printed "could not keep … in the key vault" while a moved chat's files were still arriving. Co-Authored-By: Claude Opus 5.5 <[email protected]>
When Home's row, the launch walk, the resume band or the app already holds the chat's record, the open-state fetch and the lease acquire go out together and the directory re-read is skipped; a stale view is refused by the acquire and falls back to the serial path, so fencing is unchanged. A copy with no stat index (every copy written before this change) is checked cheaply before the chat opens and fully in the background before files are swapped in, keeping any local edits on a branch as before; the stat index is written after every materialize. The withheld-files policy is seeded before furrow materializes, so withheld .env files are not unlinked before the vault restores them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…m opening At launch the chat's journal can be held by a reader in another process (the launch folder's engine, a preview), and the open path waited for it to let go for up to five seconds. Only a holder that is running a turn is waited on now, so there are still never two writers; a reader is retired in the background before the workspace or journal is swapped. The restore step on the phase line is split into the sub-steps that make it up. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…raft too
When the arriving chat already had a saved draft, the text typed on Home during
the move took the box, the saved draft stayed unrestored, and quitting refused
to save either one ("this draft could not be saved"). The box now holds the
saved draft, a newline and the carried text, and quits save it as usual.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
AbirAbbas
force-pushed
the
perf/snappy-chat-move
branch
from
November 17, 2026 16:38
ddfd8e5 to
f0b366f
Compare
On a move that files the chat into a different folder (a copy, a native move back), the background stage wrote the files under the root it started with, so the filed folder had no files and the app followed an empty tree. The background stage now follows the filed root. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
AbirAbbas
marked this pull request as ready for review
November 17, 2026 17:19
AbirAbbas
marked this pull request as draft
November 17, 2026 17:23
The open-first path checks the older copy here for unsaved edits in the background, keeps them as a branch, then swaps the files in. Every error in that keep step was dropped, so a refused branch or a failed seal still replaced the folder and said nothing. The background stage now stops on any such error: the files are left as they are, the files gate stays shut, the status line says the edits could not be kept yet and offers a retry, and the set-aside copy stays for it. Setting the older copy aside now fails closed, before anything is replaced. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The open-first claim asked for the lease beside the fetch, so a fetch or stage that then failed had already fenced a live holder mid-turn. The lease is now asked for beside the fetch only when nobody holds the chat; a held chat is staged first and acquired after, as before. A refused claim never re-aims at a holder the person did not choose, a window running a turn is never asked to step aside before the take is known to proceed, and CODEAF_MOVE_FILES_FIRST=1 takes the old order entire. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The open state was rebuilt in Go from the local older copy wherever it could be, with only a length check: a same-length stale chunk became part of the new head, a file the frame did not carry kept its older local bytes, and carried task and artifact records never took the newer version. A local file is now reused only when its content hashes to the chunk the head names (BLAKE3, as the engine does); anything else is fetched, and a carried record still untouched since the take is replaced by the head's. The workspace's AGENTS.md and CLAUDE.md now ride the open wave, so a moved chat's first turn has its rules. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n every door After-work now runs behind the open, so its failures and notices have to reach the person by another road. The app's take passed no notice sink, so a failed vault pull, index rebuild or task-copy restore after an app move was dropped; each line is now filed under its own chat on the app's notice path as well as the terminal's. The look at this computer that finishes with the files raises the setup card again with what it lacks and what is uncommitted. A session opened before its workspace landed re-reads its page once the files arrive, so the project's AGENTS.md and CLAUDE.md reach the next model call. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The gate's owner check read an unsupported signal as a dead owner, so on Windows a live move's marker was deleted and tools ran on half-arrived files; each system now has its own probe, and an owner the probe cannot read counts as alive. A failed arrival now keeps refusing tools, seals and captures in every process with its reason instead of giving way after two minutes, even after its window closes; opening or taking the chat again starts a fresh fetch that replaces it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ction files The open wave put AGENTS.md and CLAUDE.md into the chat's work folder by asking the record it had just swapped in where the chat works. That record is the head's, and a head the other computer sealed as a copy says "owned", so a move back into this computer's own folder left a copy of its instruction files in codeaf's copy folder for the chat. Where the chat works is now read once, before the take, from this computer's own record. Co-Authored-By: Claude Opus 5.5 <[email protected]>
AbirAbbas
marked this pull request as ready for review
November 17, 2026 19:49
This was referenced Nov 17, 2026
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.
Why
Moving a chat to another computer ("continue here" on Home, the chat that comes over by itself at launch, or
agents.take/agents.openin the app) took 12–30 s before the conversation appeared. A 117 MB folder took minutes. Everything ran in series before the chat was drawn: three directory reads, a serial fetch of the transcript AND every workspace file, the hold, materialize, the vault pull, git status and the local-edits scan.Measured, by hand, between a Linux PC and a Mac over the hosted dev relay
Times are from the engine's own
continue <id> phasesline (shown=). On that relay one request costs 0.25–1 s.fetch11.4 s)files arriving · N KByour unsaved edits here were kept as 1 turn from mac-test; the PC's README arrived at 8.3 sThe bottom line is never blank during a move: it reads
opening conversation… N KBuntil the chat opens. Text typed on Home during a move lands in the arriving chat's box, after that chat's own saved draft if it has one. It is never sent.What changes
.cell/records), plus the hold. When the view is already in hand (Home's row, the launch walk, the resume band, the app), the fetch and the acquire go out together and the directory is not re-read. A stale view is refused by the acquire and falls back to the serial path, so fencing is unchanged.arriverun in the background. Workspace tools wait on a ready gate that holds across the client and engine processes. The gate's marker lives in the engine's local store and is never sealed or sent, and a crashed owner never stalls a waiter. The model can still answer in words meanwhile, and nothing runs on a half-arrived tree.shown=,files=,open_gets=,open_rounds=,open_seed=andopen_path=(every step before the open, with its time).CODEAF_MOVE_FILES_FIRST=1restores the old order (files before opening). The new order is the default.Fixed after a hand smoke and an independent review of this branch
your unsaved edits here could not be kept yet (…) · retry. A kept edit is said with dev'syour unsaved edits here were kept as N turns from <device>. Setting the older copy aside fails closed.CODEAF_MOVE_FILES_FIRST=1takes the old order entire.AGENTS.md/CLAUDE.mdride the open wave (bounded at 256 KB), and a session opened before its files landed re-reads its page when they arrive.No wire format changes and no relay changes. The only new on-disk files are local to one computer (
stat-index.jsonand the arrival marker in the engine's per-chat store). Builds without this change still move chats to and from this one.Validation
Every contract item has a test named after it (C1–C10, R1–R8, Q1–Q4, F1–F3, R5b–R5d). The ones that matter most:
TestR1RealisticColdAndWarmCriticalPathOpensWithinFourRounds: a chat with real shape (300+ conversation objects, 2,500 files) on a fake relay at 400 ms per request opens before its files, and the files land byte-identical.TestQ3LaunchAutoContinueRealisticShape: the launch path went from 8 serial rounds to 3 (now 2). It fails on the earlier head.TestF1*: one or two rounds from a fresh view, the stale-view fallback, and a racing second computer still refused.TestR5cReaderInSeparateProcessDoesNotDelayShown: was 3.05 s, now 25 ms.TestF2*/TestQ4*: under 150 ms of local work before the open on a warm 2,500-file copy, with or without a stat index; a real local edit is still kept.TestF3*/TestR5bCrashedArrivalOwnerDoesNotStallWaiters: nothing reads files before they arrive (this fixed acould not keep … in the key vaultline seen mid-move); the marker never travels; a dead owner is ignored at once.TestR6*/TestR5d*: the draft typed during a move is carried and kept.Local gate:
make test-quickgreen. Themake pr-readytouched-package legs are green forinternal/session,internal/syncsetup,internal/cellstore,internal/cellsync,internal/handoff,internal/blobstore,internal/celland the manual. Its first run found four regressions from this branch, all fixed here and re-run by name:TestTakeoverScreenOpensTheChatAndSaysWhatWasKeptTestAppTakeMissingWorkspaceW5TestCopyBucket_D3_TenNativeMovesKeepExistingRootsTestThreeRoundTripsBetweenTwoHomesStillOpenExpect
cmd/codeafto be red intouched packages, for reasons that are not this change. Eight factory/memory tests fail identically ondeva597fdc withexec: "bash": executable file not found in $PATH:TestFactoryWriteUsesJobBaseAcrossAttemptsTestFactoryRetryActionsDoNotReportStoppedTestFactoryStepRetryWaitsForPreviousLeaseCleanupTestFactoryCommandStepRetryAfterOutOfAttemptsTestAppFactoryPlanFilesAnswerTestMemoryPause*That puts the leg over the five-failure re-run limit. Seven more timed out only under eight-shard load and pass by name.
Not in this change, seen while testing
could not be put in this folderon every launch. This is ondevtoo.Options.Branchesis never set outside tests. This is ondevtoo.agents.openon a chat this computer still shows as held does not restart a failed arrival; the gate stays closed (fails safe) until the chat is taken again.🤖 Generated with Claude Code