Repository navigation
Conversation
isomorphic-git treats an index it fails to read as empty, so one failed read during staging or a commit could publish a tree that drops every other entry.
Stage each checkpoint in one index update, and roll a failed one back without resetting unchanged outputs, so accumulated tool outputs do not cause repeated full-index rewrites. A symlinked tool-output directory is rejected because the checkpoint tree must carry the outputs themselves.
resetIndex reads HEAD and its tree again for every path and treats a failed read as a deletion, so one transient fault during a rollback could drop committed entries without an error. Writing the oid and mode the walk already read also keeps executable and symlink entries intact.
FarinM
marked this pull request as ready for review
October 14, 2026 18:17
FarinM
deleted the
intr-656-reduce-conversation-checkpoint-latency-as-tool-outputs
branch
October 14, 2026 22:08
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.
Conversation checkpoints staged every stored tool-output file with its own
git.addcall. Each call reads, updates and rewrites the whole Git index, including for outputs that did not change, so a checkpoint wrote the index once per output and got slower as outputs accumulated, even when the conversation change was one small file. A failed checkpoint was worse: the rollback reset every staged path withresetIndex, which rewrote the index once more per output.This stages each checkpoint in one index update and makes the rollback touch only what changed:
tool-outputdirectory in a singlegit.add, withparallel: falseso output files are still read one at a time.Index writes per checkpoint drop from one per output plus one to a single write, and a failed checkpoint drops from two per output plus two to three. Measurements are medians of 7 checkpoints per case on macOS arm64 with Bun 1.4.3, comparing the branch's base (
e68038756) with54e4be038. Each repository holds the given number of small tool-output files, and each checkpoint appends one turn toturns.jsonlwhile the outputs stay unchanged. The failed checkpoint fails at its first flush and includes the rollback. Every output is still read and hashed on each checkpoint, so the remaining cost still grows with the output count; the gain comes from writing the index once instead of once per output.It also fixes cases where a single failed read silently lost data. The first three already exist on main; the last two are hazards the new staging and rollback would otherwise introduce:
git.addorgit.commitcould publish a tree without every other entry. The git file client now turns a failed or empty index read into an error and logs the real cause. A missing index still reads as empty, so new repositories work as before. This covers every isomorphic-git call in the package.resetIndex, which reads HEAD and its tree again and treats a failed read as a deletion. One failed read could empty the conversation from the index, and the next audit or error commit would publish a tree without it. Repairs now write the oid and mode the walk already read withgit.updateIndex, and report any failure.resetIndexalso wrote executable and symlink entries back as regular files. Repairs keep HEAD's file mode.tool-outputas one directory could drop new outputs without an error. A listing failure now fails the checkpoint and names the directory.A
tool-outputpath that is a symlink or a file is now rejected when writing or reading a spill and at checkpoint time, sincegit.addwould stage a symlinked directory as a link without its outputs. The storage format and caller API are unchanged. INTR-661 tracks the same rollback problem in audit, error and mail commits, which still useresetIndex.Validation:
make lint,make buildandmake test-unitpass (9,205 tests). The storage-isogit suite has 227 tests, including fault injection for each failure above.