Repository navigation
fix: reduce session inventory counting work - #148445
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review blockedAutomated review did not run, so no review verdict was produced. Reason: The input-safety check could not safely complete for this revision. ClawSweeper will not retry this unchanged revision. Next step: No contributor action is requested. Maintainers should inspect the linked workflow run. |
|
Codex review: needs maintainer review before merge. Reviewed September 14, 2026, 3:12 PM ET / 19:12 UTC (Revision 3). ClawSweeper reviewWhat this changesThe PR speeds up session inventory counts by counting physical rows through existing indexes and subtracting unreadable entries while preserving archive filtering. Merge readiness✅ Ready for maintainer review The optimization remains useful and is not present on current main. No actionable correctness or security defects were found; the prior merged optimization addresses allocations rather than this remaining counting work. Priority: P2 Review scores
Verification
How this fits togetherSession inventory reads OpenClaw’s per-agent SQLite session records. Its counts feed maintenance planning and lifecycle reporting. flowchart TD
A[Per-agent session database] --> B[Count stored rows]
C[Include archived setting] --> B
C --> D[Select unvalidated rows]
A --> D
D --> E[Parse existing entry projection]
B --> F[Subtract unreadable entries]
E --> F
F --> G[Maintenance and lifecycle counts]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +5. Total +5 across 1 file. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep inventory counting inside the existing SQLite owner, using compact indexes without changing readable-entry semantics or persisted state. Do we have a high-confidence way to reproduce the issue? Not applicable as a correctness-bug reproduction: this is a performance optimization supported by source inspection and reported matched maintenance measurements. Is this the best way to solve the issue? Yes. The patch reuses the existing query, parser, indexes, and cache lifecycle, avoiding a new counter or persisted projection. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b8de9f88996b. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
568e401 to
c6f92c6
Compare
|
Merged via squash.
|
What Problem This Solves
Repeated session maintenance counts were scanning wide session rows twice even when all entries had already been validated by the writer.
User Impact
Session inventory counts spend less time blocking maintenance and its callers. Counts preserve the existing archive filtering and handling of malformed, raw, and retained entries; no operator action is required.
Why This Change Was Made
Count physical rows through the existing compact indexes, then subtract unreadable entries using the same parser projection. Both parts remain in one SQLite statement, preserving the snapshot and prepared-query cache. The existing storage owner, schema, indexes, and write behavior stay unchanged.
Evidence