Repository navigation
perf(sessions): batch untracked diffs and reuse unchanged reads - #177195
Merged
steipete merged 2 commits intoOct 19, 2026
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
steipete
marked this pull request as ready for review
October 19, 2026 09:25
Contributor
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Replace per-file no-index processes with a private intent-to-add index and bounded patch capture. Preserve native conversion, partial results, and checkout index state. Reuse unchanged results through the existing read cache with bounded filesystem revision checks and installation-aware Git dependencies.
steipete
force-pushed
the
steipete/perf-micro-diff-untracked-no-index-fanout-20260919
branch
from
October 19, 2026 09:33
ef14c7f to
e577d61
Compare
steipete
deleted the
steipete/perf-micro-diff-untracked-no-index-fanout-20260919
branch
October 19, 2026 09:47
steipete
added a commit
that referenced
this pull request
Oct 19, 2026
Model the documented standalone benchmark from #177195 as a production Knip entry. Remove the unused TTS test-support alias left by #177175; production Talk continues to use the canonical speech-text fallback directly. Validated 58 focused tests, CLI help, targeted typecheck and lint, formatting, and P2 review. All three deadcode scans ran: unused files are clean; full-tree dependencies and exports retain only the unrelated BroadcastFrame type introduced by #177219.
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Oct 20, 2026
…claw#177195) * perf(sessions): batch untracked diffs and reuse unchanged reads Replace per-file no-index processes with a private intent-to-add index and bounded patch capture. Preserve native conversion, partial results, and checkout index state. Reuse unchanged results through the existing read cache with bounded filesystem revision checks and installation-aware Git dependencies. * test(sessions): restore stubbed environment in shared cleanup
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Oct 20, 2026
Model the documented standalone benchmark from openclaw#177195 as a production Knip entry. Remove the unused TTS test-support alias left by openclaw#177175; production Talk continues to use the canonical speech-text fallback directly. Validated 58 focused tests, CLI help, targeted typecheck and lint, formatting, and P2 review. All three deadcode scans ran: unused files are clean; full-tree dependencies and exports retain only the unrelated BroadcastFrame type introduced by openclaw#177219.
This was referenced Oct 20, 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.
What Problem This Solves
Session diff polling starts a separate Git process for every readable untracked file, even for a summary-only request. With U readable untracked files, the measured scope=all path takes 5+U commands for counts and 6+U for full previews; tracked changes are already batched. A 100-untracked-file fixture (99 readable files plus one symlink) therefore takes 104/105 commands.
User Impact
Diff summaries and full previews use 8 and 9 Git commands respectively on that fixture, independent of file count. Eligible unchanged checkouts reuse the result with zero Git commands. Native patch bytes, binary handling, symlink/hardlink restrictions, ignored files, file caps, and preview budgets remain intact. No configuration or migration is required.
Why This Change Was Made
An empty private index with intent-to-add entries lets Git calculate all untracked changes in one call while preserving attributes and content conversions. Starting empty matches the former no-index behavior, which does not load tracked index-backed attributes. Its object writes are private, the native alternates file preserves access to original and inherited object stores, and split-index writes are disabled so the original index and its backing files stay untouched. Full reads retain a bounded prefix for each patch, so a large file cannot hide later previews or force duplicate conversions.
The existing Git read cache owns reuse and lifecycle. A bounded filesystem revision observes the checkout, index, refs, ignore/attribute/config metadata, and relevant environment. Git reports its actual system config/attribute paths once per worker and installation/environment identity (two cold discovery commands); binary replacement, PATH or environment changes retire that discovery. Unsupported layouts (including trees exceeding 10,000 metadata entries, Windows, nested repositories, external filters/config includes, indirect Git metadata, or older Git without path discovery) keep the previous refresh behavior. Required-filter failures retain partial results through error-only per-file retries; only failed batches can fan out.
The old successful per-file no-index path is removed. Runtime code grows by 392 lines because byte fidelity requires native Git conversion and bounded patch capture, while externally edited checkouts need a complete bounded invalidation check. The reusable benchmark adds 241 lines; regression tests add 221 net lines. No new cache owner, filesystem watcher, or dependency is introduced.
Evidence
Acceptance recorded before measurement: 100 untracked files plus three tracked changes; summary/full worker reads and unchanged read-owner polls; two concurrent baseline/candidate pairs with swapped 16-core allocations. Require O(1) commands, identical normalized response hashes, and paired p50/p99 improvement or no regression beyond noise. Unchanged eligible checkouts must issue zero Git commands after the former summary TTL too.
Final concurrent A/B results (CPU halves swapped in pair 2):
All durations are milliseconds. Differences are B minus A within the same concurrent pair.
256/256 measured response SHA-256 comparisons matched; only each fixture’s absolute root field was removed. All file metadata and patch bytes were preserved. This includes binary, large, empty, symlink, and ignored-file behavior.
Fixture: 100 untracked paths (99 eligible regular files plus one symlink), three changed tracked files, and one excluded ignored file. Baseline: 73f67dc. Git 2.53.0, Node v26.8.2.
All pairs ran concurrently under the shared exclusive measurement lock, A on CPUs 96–111 and B on 112–127 in pair 1, swapped in pair 2. Preparation used CPUs 64–95. Outside load was recorded with per-scenario mpstat logs; paired deltas above determine the result. Warmup is excluded; trace2 command-count overhead is included on both sides. No Gateway, network client, model, or production data was used. These measure the real Git worker/read owners, not end-to-end RPC latency.
The cache pairs use the final revision owner and were retained across the subsequent cold untracked-collection repair; the measured cache-hit path was unchanged. Worker pairs were rerun after that repair. Each source state was recorded in a manifest.
Final source manifest (309 files, verified remotely):
bf7e8531423c2acf1eebc74c9471877eb5b13da82bb0d71ad46d851b81272193.Cache-pair source manifest:
4bc1f6a695ca55febaafd554f5ded25ea8309cd607a74caafe1f51c75f2b9f4f.For eight samples, the reported p99 is the observed maximum. The committed driver is
scripts/perf/checkout-diff-measure.ts; its README documents fixture creation, commands, and interpretation.Validation: the complete session-diff file passes all 36 cases; all 14 read-cache tests pass, including byte comparisons for binary/large/empty/symlink/ignored fixtures, sparse/split-index preservation, failed required filters, cache reuse and edit/index/ignore invalidation. The custom-installation cache regression is red on the prior hardcoded-path candidate: a newly created system config left an ignored file visible. The count regression is red on the base: 49 full / 48 summary commands against cold bounds of 11 / 10 (including two one-time installation probes). One
pnpm tsgo:corerun passed on the earlier candidate; final-head type validation is left to PR CI under the local compute limit. Export collision guard and both import-closure files passed (22 tests). Changed-file format/lint passed; independent Codex review is clean at P0–P2; PR CI owns broader validation. No Testbox/Crabbox lease was used.CI follow-up: the first run caught three test cleanup callbacks returning
VitestUtilsinstead ofvoid. Environment restoration now belongs to the existingafterEach, removing the duplicate callbacks. The entire 36-case session-diff file and changed-file lint pass after the repair; an independent review of the test-only delta is clean. Production code and benchmark inputs are unchanged.Final validation: CI run 39231026877 passed on
e577d6182c5233ac1ec23bc2ea8006b25da9fce7, including all production/test type checks and selected test/check jobs. Both required CI gates passed before the exact-head squash merge.