perf(status): select recent sessions without full sort#96955
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 26, 2026, 6:31 PM ET / 22:31 UTC. Summary PR surface: Source +22, Tests +34. Total +56 across 2 files. Reproducibility: yes. from source inspection: current main sorts all lightweight session candidates before slicing to the 10 displayed rows. I did not run a live timing reproduction in this read-only review. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the bounded selector after redacted real status-command proof is added, or after maintainers explicitly accept the proof gap for this small performance cleanup. Do we have a high-confidence way to reproduce the issue? Yes from source inspection: current main sorts all lightweight session candidates before slicing to the 10 displayed rows. I did not run a live timing reproduction in this read-only review. Is this the best way to solve the issue? Yes. The PR is the narrow maintainable fix because it stays inside status summary selection, preserves counts and stable ordering, and avoids changing storage, output schema, or session accessor contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against eba1ca683f6c. Label changesLabel justifications:
Evidence reviewedPR surface: Source +22, Tests +34. Total +56 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Land-ready review for #96955:
No blocking findings. Proceeding to merge via |
ac2732d to
bd33e48
Compare
bd33e48 to
962a6bf
Compare
|
Updated land-ready proof for rebased head
No blocking findings remain. Proceeding to merge via |
|
Merged via squash.
|
Co-authored-by: ly-wang19 <[email protected]>
Co-authored-by: ly-wang19 <[email protected]>
Co-authored-by: ly-wang19 <[email protected]>
Co-authored-by: ly-wang19 <[email protected]>
What Problem This Solves
openclaw statusonly displays and hydrates the most recent 10 session rows, but the summary path sorted every session candidate before slicing that small window. Large long-lived session stores paid O(n log n) work even though the command only needs a bounded recent subset plus the total count.Why This Change Was Made
This changes status session selection to keep a stable bounded top-N list while scanning candidates. Counts still use the full candidate list, but per-agent and aggregate recent-session hydration now sort only the displayed window. Timestamp ties keep store order to match stable
toSorted(...).slice(0, 10)behavior.User Impact
Users with large session stores should see less status-summary CPU work before the command renders recent sessions. Output order, counts, and model/runtime hydration semantics are preserved.
Evidence
node scripts/run-vitest.mjs src/commands/status.summary.test.ts.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --parallel-tests "node scripts/run-vitest.mjs src/commands/status.summary.test.ts"git diff --check