GeezerVison is showing github.com — fix(usage): skip unchanged Antigravity databases on repeat scans by derektrimm · Pull Request #13902 · pingdotgg/t3code
Conversation
derektrimm
commented
Sep 27, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
What Changed
Antigravity databases are decoded once and reused on later usage scans while the database and its -wal sidecar keep the same size, mtime and ctime. Aliases still merge across every database before the date window is applied, as before.
Why
Refs #13852. Every getUsageSummary decoded every Antigravity .db on the server thread, so a large history stalled the event loop for seconds on each request and the desktop showed the machine as reconnecting. The file cache the other providers use never applied to this reader.
The key includes the WAL because new rows land there while the main file keeps its size and mtime until a checkpoint. A key on the main file alone would hide new usage. ctime is included because it moves on any content write, even one that restores size and mtime.
On a synthetic corpus of 40 databases and 20,000 records, a repeat scan drops from about 150 ms to 7 ms, and the cache holds about 5 MB. The first scan after a server start still decodes everything; moving that read off the main thread, the second step in the triage, is not in this PR.
Verified with vp test run src/usage/ (114 passed), the server typecheck, and lint on the changed files. Each new test fails when the WAL or ctime is dropped from the key, or the cache is bypassed.
Checklist
- This PR is small and focused
- I explained what changed and why
Summary by CodeRabbit
- Improvements
- Antigravity usage scans reuse results while the underlying data remains unchanged, helping avoid unnecessary rereads. Results refresh when the data changes, including updates recorded in the database’s write-ahead log.
- OpenCode usage is still checked live on each scan, so its results reflect the latest available data. The different refresh behavior helps balance efficient Antigravity scans with up-to-date OpenCode usage.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Every usage summary decoded every Antigravity conversation database again, blocking the server long enough for clients to drop the connection. Memoise each database's parsed candidates by the (size, mtime) of the file and its WAL sidecar, and keep merging aliases before the date filter.
Uh oh!
There was an error while loading. Please reload this page.
Approvability
Verdict: Not approved
Macroscope's review found this PR not approvable — The change adds a process-level cache that conditionally skips Antigravity database decoding on repeat production usage scans while preserving WAL and rewrite detection through filesystem fingerprints. Its focused tests reduce risk, but the new gate changes when substantial usage-processing work occurs and merits human review.
Notes:
- No code objects were reviewed. Approvability was decided on eligibility alone.
You can add or adjust custom eligibility rules. Learn more.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Sep 27, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
🧰 Additional context used
📚 Code guidelines (1)
docs/internals/effect-services.md — auto-discovered
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
- Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
- Review profile: CHILL
- Plan: Advanced
- Run ID:
ad999758-d333-4c3b-b3b2-9e5508531f93
📥 Commits
Reviewing files that changed from the base of the PR and between c993d62 and f1246e3.
📒 Files selected for processing (1)
apps/server/src/usage/usageTranscriptReader.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
Walkthrough
Antigravity usage scans now reuse parsed database candidates when the database and WAL metadata match a cached snapshot. UsageService creates and passes the cache to the reader. Tests cover cache reuse, database changes, and WAL updates.
Changes
Antigravity usage database caching
| Layer / File(s) |
Summary |
Reader cache behavior apps/server/src/usage/antigravityUsageReader.ts, apps/server/src/usage/usageTranscriptReader.test.ts |
The reader accepts an optional cache keyed by canonical database path. It reuses parsed candidates when database and WAL size, mtime, and ctime match. Otherwise, it rereads the database and updates the cache. It removes entries for paths not visited. Tests cover cached results after a locked read fails, rewritten database contents, and WAL-only changes. |
UsageService cache wiring apps/server/src/usage/UsageService.ts |
UsageService creates a cache and passes it to the Antigravity reader. Its documentation distinguishes OpenCode live database reads from Antigravity cache reuse. |
Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers: maria-rcks
Merge Risk: 🔵 Low · up to f1246
On filesystems with coarse timestamps, a rapid database rewrite can leave repeat scans reporting outdated usage. The risk is narrow and timing-dependent.
Architecture Summary
Architecture risk: 🔵 Low · up to f1246
The change affects 1 system.
Changed systems: apps/server
Architecture concerns
No architecture-level concerns identified.
Review details
Systems and components
- observed — apps/server (service) was modified; 3 changed files map to changed impact.
Before / after behavior
- observed — Modified behavior in apps/server/src/usage/UsageService.ts: The comment now distinguishes OpenCode’s live database reads from Antigravity’s in-memory memoization, which applies while the database and WAL retain the same
(size, mtime, ctime). It replaces the generic statement that SQLite readers query live databases.
- observed — Modified behavior in apps/server/src/usage/UsageService.ts: The import now includes
makeAntigravityUsageCache alongside readAntigravityUsage.
- observed — Modified behavior in apps/server/src/usage/UsageService.ts:
make now creates an Antigravity usage cache for the service instance.
- observed — Modified behavior in apps/server/src/usage/UsageService.ts: The Antigravity reader call now receives the service’s cache as a third argument.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
| Check name |
Status |
Explanation |
Resolution |
| Docstring Coverage |
⚠️ Warning |
Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. |
Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (4 passed)
| Check name |
Status |
Explanation |
| Title check |
✅ Passed |
The title clearly and concisely describes the main change: skipping repeat reads of unchanged Antigravity databases. |
| Description check |
✅ Passed |
The description explains the problem, change, and verification in detail under headings that differ from the template. It references issue #13852 but does not state maintainer approval or explain why … |
| Linked Issues check |
✅ Passed |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
✅ Passed |
Check skipped because no linked issues were found for this pull request. |
- Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
A rewrite that restores size and mtime still moves ctime, so the cache no longer serves stale candidates in that case. The reuse test now proves a cache hit with an exclusive lock instead of a forged rewrite, and the forged rewrite gets its own test that expects a fresh read.
On kernels with coarse timestamps a write in the same tick as the cached read keeps the same ctime, so the test repeats the rewrite until ctime moves, as any real rewrite does.
|
Checked against current main after #15149: this merges cleanly, and the usage tests (145) and server typecheck pass on the merged tree. #15149 speeds up the transcript scan; readAntigravityUsage is still called without a cache on main, which is the part this covers.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Note Grok responding on behalf of Julius.
Thanks @derektrimm! This landed via the takeover in #17139, rebased onto current main with your commits and authorship kept, so I'm closing this one as superseded.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Oct 9, 2026
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
macroscope-review
Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews
size:M
30-99 changed lines (additions + deletions).
vouch:unvouched
Author is not yet trusted in the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|