Repository navigation
fix(sessions): avoid saved-prompt reads when list metadata is current - #149118
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 2:22 AM ET / 06:22 UTC (Revision 6). ClawSweeper reviewWhat this changesReuse current session-list metadata for selected session reads, avoiding repeated saved-prompt processing while preserving full reads and existing fallbacks. Merge readiness✅ Ready for maintainer review This remains a useful, focused optimization absent from current main. No actionable correctness or security defect was found, and the retained behavior evidence supports the unchanged patch. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway rechecks selected sessions before returning lists and sharing metadata. The session accessor reads each agent’s SQLite database and supplies current entries to those callers. flowchart TD
A[Selected session keys] --> B[Session accessor]
B --> C{Complete current metadata cache?}
C -->|Yes| D[Check row identity and copy metadata]
D --> E{Still current and canonical?}
E -->|Yes| G[Return selected entries]
C -->|No| F[Existing exact database reader]
E -->|No| F
F --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +72, Tests +333. Total +405 across 4 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep metadata reuse inside the existing cache owner, with exact reads retaining responsibility for full payloads, misses, invalid rows, and uncertain freshness. Do we have a high-confidence way to reproduce the issue? Yes: current main reprocesses selected entry payloads even after list metadata is loaded; the source path and retained large-prompt Gateway benchmark establish the trigger. This review did not execute tests or a Gateway. Is this the best way to solve the issue? Yes: the patch extends the existing cache owner and preserves the exact-reader fallback, avoiding a competing cache or a persistent-data change. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e2d3d80676f7. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
73e7bb4 to
d8ab064
Compare
19b521b to
ecd3b60
Compare
ecd3b60 to
8cb0bd6
Compare
8cb0bd6 to
ad86636
Compare
|
Merged via squash.
|
What Problem This Solves
Session lists repeatedly process large saved prompt snapshots while rechecking a page whose current metadata is already loaded.
User Impact
Listing sessions with large saved skill prompts spends less time blocking the Gateway. Full session reads still return their saved prompts, and cache misses retain the existing exact reader.
Why This Change Was Made
Reuse the existing complete metadata cache after fresh database-generation and selected-row identity checks. Copy only requested entries, preserve delivery validation and per-key failures, and recheck freshness after copying. Partial caches, transactions, missing entries, changed generations and uncertain reads use the original path. Profile aliases and membership keep their existing owners.
This adds no persistent cache, schema, migration or permission change.
Evidence
Candidate
ad8663633dd6d11c6c753555e303828d803075f5preserves the complete published four-file patch on fixed main932846b521c0a9fc0eba711f346621cd3398bcf7, containing planner repair #149726 and the Goal-read/renderer-lint repairs landed with #149697. All four feature files remain byte-identical to8cb0bd60, and the current-main audit preserves the metadata reader, identity, canonical-validation, transaction and dependency contracts.The current composition passed 88 tests across seven files on macOS arm64 / Node 26.8.2, including the original Goal edit three-read budget, exact metadata reads, identity publication, canonical validation and transcript import boundaries. Source and runtime hashes remained stable. The retained 148-case integration proof, complete selected checks and independent P2 review apply to the unchanged metadata scope; these test populations overlap and are not summed. No new full typecheck, review, build or benchmark was run solely for the patch-identical refresh.
A retained macOS Node 26.8.2 source-Gateway benchmark used 5,000 synthetic sessions, selecting 200 rows with a valid 128 KiB skill prompt each. Sharing fell from 20 ms to 2–3 ms, and warm descendant requests from 58–64 ms to 40–44 ms. All 12 candidate responses preserved keys, order, metadata and cache roles; copying cost is included. These historical component measurements are bound to their original source and environment, were not repeated for this refresh, and do not establish production page-load performance. Cold first-use probes still reached 122 ms.
Earlier Linux Node 24.19.0 boundary proof passed 62 cases, overlapping later coverage. The previous
8cb0bd60run 35058496182 failed in renderer line count, planner fixtures and the Goal edit read budget; exact-source comparisons established these as inherited main defects, now repaired in the candidate base. The still-earlierecd3b604Active Memory assertion failure remains unattributed. Fresh CI on this candidate remains required before landing.