Repository navigation
fix(search): include undated Cursor sessions in time filters - #31991
Conversation
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🔵 Low · up to
|
SQLite rounds sub-millisecond file times while Date#toISOString truncates, so repaired rows could land 1ms after the date a re-read writes. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Check cancellation before storing the sidecar-enriched… · session-scanner-parse-cache.ts:205-225
src/main/ai-vault/session-scanner-parse-cache.ts:205-225
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winCheck cancellation before storing the sidecar-enriched cache entry.
When a cached Devin transcript has a changed sidecar,
parseCachedInLaneawaits enrichment, then stores and returns the session. The Devin enrichment branch does not inspectsignal. If cancellation occurs before enrichment resolves, the aborted operation can still mutate the parse cache and return a session.Add the cancellation check immediately after enrichment and before cache storage:
Suggested fix
+import { throwIfAiVaultScanCancelled } from './ai-vault-scan-cancellation' ... const enriched = await enrichSessionFromSidecar( candidate, entry.foldSession, platform, signal ) + throwIfAiVaultScanCancelled(signal) const session = reuseUnchangedSidecarSession(entry.session, enriched.session)
ℹ️ Review info
⚙️ Run configuration
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
cae43d09-879f-4ee5-8946-fc27b354cdee
📒 Files selected for processing: 2
src/main/ai-vault-search/session-search-cursor-timestamps.test.tssrc/main/ai-vault-search/session-search-schema.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
ELI5
What was broken: Cursor's transcript files contain no timestamps, so Orca's session search index saved every Cursor session with "last updated = unknown". As a result
orca search --since ...dropped every Cursor session, and--sort newestcouldn't place them. (Timestamp part of #28255.)What changes for the user:
--sincefilters and sorts correctly by newest. Sessions that already carry a real date (from the transcript or Cursor'smeta.json) keep that date.meta.jsondate/cwd/title) that Session History already shows. Before, it stored only the raw transcript data.How
session-search-file-records.ts:updated_atfalls back tomodifiedAt(final and provisional chunk writes), only foragent = 'cursor'.session-search-schema.ts: idempotentUPDATEon every open for Cursor rows whereupdated_at IS NULL, usingfiles.mtime_mstruncated to whole ms so the result matchesDate#toISOStringexactly. It uses thesessions_agentindex and does nothing once repaired.session-transcript-reader.ts/session-scanner-parse-cache.ts: sidecar enrichment now runs beforefinishRead, so consumers commit the enriched session. The parse cache still stores the raw fold, so a later sidecar-only change still re-merges. A cancel during enrichment throws and the read does not commit.Verification
scanAiVaultSessions-> search index consumer ->SessionSearchEnginepath:main: 82 Cursor rows, 82 withupdated_atNULL,--since 2020-01-01returns 0 hits.--sincereturns hits sorted newest first (e.g.2026-06-02T07:38:43.857Z).main, then reopened it with this PR without rescanning. All 82 rows were repaired and the dates matched a fresh scan to the millisecond. A review fix was needed here: before it, SQLite rounding put repaired dates 1 ms off.pnpm test src/main/ai-vault-search src/main/ai-vault: 1944 passed, 1 skipped (the skip already exists).session-search-cursor-timestamps.test.ts: 5 of its 7 cases fail againstmain's source. The repair case also fails without the truncation fix (.876Zvs.875Z).Risks / tradeoffs
Related
updatedAt/cwd= null, so--since,--pathand--sort newestdrop or mis-sort every Cursor session #28255 (issue; this does not close it, since the cwd and title parts remain)Visual proof: n/a (main-process search index change, no UI change).