perf(server): avoid rereading unchanged files in review previews - #13395
Conversation
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: pingdotgg/t3code/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthrough
ChangesReview index timestamp handling
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to Preview tests cover both avoiding unnecessary reads of unchanged files and preserving edited tracked files at the timestamp boundary. No merge-blocking preview risk is evident. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 1 system. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a small, test-covered adjustment to temporary Git index timestamps that avoids rereading unchanged files during review previews while preserving racy-edit detection and the real index. It introduces no product-default, schema, sensitive-code, or static-analysis configuration changes. No code changes detected at You can add or adjust custom eligibility rules. Learn more. |
## What's Changed * feat(usage): read cursor, opencode, and antigravity history by @maria-rcks in pingdotgg/t3code#10409 * fix(sqlite): retry failed statement preparations by @yashranaway in pingdotgg/t3code#10584 * fix(mobile): scale Android controls with appearance text size by @none23 in pingdotgg/t3code#13356 * fix(web): return focus to the composer after saving a citation note by @mackinleysmith in pingdotgg/t3code#13450 * feat(observability): honor the standard OTLP endpoint, headers, and protocol variables by @yordis in pingdotgg/t3code#13492 * fix(terminal): settling a thread closes its idle shells by @t3dotgg in pingdotgg/t3code#13673 * fix(server): load Cursor keyring with createRequire by @Yash-Singh1 in pingdotgg/t3code#13678 * perf(server): avoid rereading unchanged files in review previews by @shivamhwp in pingdotgg/t3code#13395 **Full Changelog**: pingdotgg/t3code@v0.0.43-nightly.20260925.2251...v0.0.43-nightly.20260925.2269 Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.43-nightly.20260925.2269
Review previews can reread thousands of unchanged files from the preceding second when Git's index timestamp falls on a whole second. In a constructed 30,000-file repository, this reduces median preview time from 1,305 ms to 167 ms, about 7.8× faster. It preserves the missing-edit fix from #12613. This is a timestamp-boundary improvement, not a general 7.8× speedup for every repository.
Remove the extra one-millisecond subtraction when setting the temporary index timestamp. The existing Node FileSystem service already reads bigint stats and truncates to whole milliseconds before constructing its Date; flooring that Date preserves the source second. There is no new native import, diagnostic suppression, or error-handling path. Regular- and split-index tests verify that unchanged preceding-second files do not run their clean filter and that the real index stays unchanged.
Validation
Updated with main on September 25 at
9c41485408623e339b799e417be8e7e6f52999e8. Reran all 104 focused tests, server typecheck, formatting, and 32 live API requests on this integration commit; all passed. Targeted lint still has the same preexisting warning.Detailed matrix and benchmark head:
4a0fd4fcb165dc61eaa088e4e23d30a50b64e57f. Baseline:b2b43bef73447c483ceae486890cb79f01c369cb, main immediately after #12613. No uncommitted code was included.USE_NSEC. The latter uses system Git helpers for submodule commands.Performance
Linux, 30,000 files / 469 MiB, warm filesystem cache, forced timestamps. Times are medians of complete WebSocket requests; correctness and original-index preservation were asserted throughout.
The short benchmark used baseline/PR/PR/baseline order with one warmup per batch. The longer run used baseline/PR/PR/baseline/PR/baseline/baseline/PR with five warmups and 20 measurements per batch. Small ordinary-case differences change direction between runs, including variation in the bypass control. The earlier 163 → 182 ms slowdown is not a stable result; these measurements do not prove zero overhead. Files that actually need checking still cost about 1.3 seconds in this fixture.
Why the existing timestamp is precise enough
The pinned
@effect/platform-node-sharedadapter callsfs.stat(path, { bigint: true })and returns itsmtimeDate. Node's BigIntStats computesmtimeMs = mtimeNs / 1000000nbefore constructing that Date. Ordinary non-bigint stats can round across a second; this bigint-backed path does not. We verified the installed adapter, Node 22/24 runtime behavior, and exact final-nanosecond fixtures. See Node 22.16 BigIntStats.The previous revision added a separate native stat call unnecessarily. This revision keeps the existing service and its error handling. The existing fractional-timestamp regression tests protect this dependency on the Node adapter's conversion behavior.
Raw test and benchmark results
Limits
Timestamps within the first second after the Unix epoch still reproduce a missed edit with both baseline and PR, because a zero-second index disables Git's racy check. This PR fixes the baseline failure at exactly epoch second 1, but does not claim to repair all epoch-zero behavior. Missing-index behavior is also inherited.
Windows, macOS, controlled cold-disk tests, concurrent external index rewrites, and real-world frequency remain unmeasured. Both T3 Browser status and open report no automation host, so the requested before/after UI recording could not be captured. No frontend, provider, or wire-contract code changes are included.
Implemented and tested with GPT-6 in the Codex harness. Claude Opus 5.5 reviewed the earlier native-stat version; the simplification was verified separately in this pass.
Summary by CodeRabbit