Skip to content

perf(status): select recent sessions without full sort#96955

Merged
vincentkoc merged 1 commit into
openclaw:mainfrom
ly-wang19:codex/high-quality-algo-5
Jun 26, 2026
Merged

perf(status): select recent sessions without full sort#96955
vincentkoc merged 1 commit into
openclaw:mainfrom
ly-wang19:codex/high-quality-algo-5

Conversation

@ly-wang19

Copy link
Copy Markdown
Contributor

What Problem This Solves

openclaw status only 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

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: S labels Jun 26, 2026
@clawsweeper

clawsweeper Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 26, 2026, 6:31 PM ET / 22:31 UTC.

Summary
The PR changes getStatusSummary to keep a bounded stable recent-session candidate window before hydrating rows and adds tied-timestamp ordering coverage.

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: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🦞 diamond lobster
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted terminal output, copied live output, or logs from a real openclaw status or openclaw status --json run showing unchanged recent-session output and counts after the change.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body and visible comments include tests, CI, and maintainer review, but no redacted terminal output, copied live output, or logs from a real after-fix openclaw status run. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] The external PR still lacks redacted real openclaw status or openclaw status --json output/logs from an after-fix setup, so behavior preservation is not proven outside tests and review.

Maintainer options:

  1. Decide the mitigation before merge
    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.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] No automated code repair is needed; the remaining action is contributor real-behavior proof or maintainer acceptance of that proof gap.

Security
Cleared: The diff only changes status-summary selection logic and a focused test; it does not touch dependencies, workflows, secrets, install scripts, or code-execution surfaces.

Review details

Best 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 changes

Label justifications:

  • P3: This is a small status-command performance cleanup with limited blast radius and no urgent regression evidence.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦞 diamond lobster.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body and visible comments include tests, CI, and maintainer review, but no redacted terminal output, copied live output, or logs from a real after-fix openclaw status run. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +22, Tests +34. Total +56 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 29 7 +22
Tests 1 34 0 +34
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 63 7 +56

What I checked:

Likely related people:

  • vincentkoc: The live PR discussion has Vincent Koc's land-ready review for this exact change, and local history shows multiple adjacent status fast-path commits. (role: current reviewer and adjacent status contributor; confidence: high; commits: d518260bb826, 0f69b5c11aba, a608d0955286; files: src/commands/status.summary.ts, src/commands/status.scan.fast-json.ts)
  • steipete: Status summary, overview, and report-data history includes several prior refactors and performance-oriented status changes by Peter Steinberger. (role: historical status-area contributor; confidence: medium; commits: c72f539ced72, 143f501fe533, 88aa81422653; files: src/commands/status.summary.ts, src/commands/status.command-report-data.ts)
  • Ayaan Zaidi: Local history shows earlier status JSON startup performance work touching the same status-summary area. (role: adjacent status performance contributor; confidence: medium; commits: 97a7dcf48e1c; files: src/commands/status.summary.ts, src/commands/status.scan.fast-json.ts)
  • Kevin Lin: Current local blame for the candidate helper and selection lines points to a recent broad carry-forward commit, so this is useful routing evidence but probably not the original design owner. (role: current-line carry-forward; confidence: low; commits: a6a4652c708a; files: src/commands/status.summary.ts, src/commands/status.summary.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jun 26, 2026
@vincentkoc vincentkoc self-assigned this Jun 26, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Land-ready review for #96955:

  • Reviewed src/commands/status.summary.ts and src/commands/status.summary.test.ts against current origin/main; current main does full candidate sorting before slicing, while this PR keeps a bounded stable top-10 selector at the status summary owner boundary.
  • Verified old ordering semantics: descending updatedAt, store-order stability for equal timestamps, unchanged total counts, and unchanged row hydration scope for per-agent and aggregate recent sessions.
  • Focused proof passed: node scripts/run-vitest.mjs src/commands/status.summary.test.ts --testNamePattern "hydrates only recent session rows|preserves store order for tied recent session timestamps|passes agent scope when listing configured agent session stores|includes the selected agent runtime on recent sessions".
  • Autoreview passed clean: .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main.
  • Hosted exact-head gates passed for 3e707d430b2388e555a6ccce1ad1681682b9e469: CI #28220073905 and Workflow Sanity #28220073897.

No blocking findings. Proceeding to merge via scripts/pr merge-run.

@vincentkoc
vincentkoc force-pushed the codex/high-quality-algo-5 branch 2 times, most recently from ac2732d to bd33e48 Compare June 26, 2026 22:12
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jun 26, 2026
@vincentkoc
vincentkoc force-pushed the codex/high-quality-algo-5 branch from bd33e48 to 962a6bf Compare June 26, 2026 22:23
@vincentkoc

Copy link
Copy Markdown
Member

Updated land-ready proof for rebased head 962a6bff456d71ea52d8ba14e96e0e031c075a04:

  • Rebased onto latest origin/main, including the mainline i18n registry-test fix that had made the previous exact-head CI red.
  • Re-ran focused proof: node scripts/run-vitest.mjs src/commands/status.summary.test.ts --testNamePattern "hydrates only recent session rows|preserves store order for tied recent session timestamps|passes agent scope when listing configured agent session stores|includes the selected agent runtime on recent sessions".
  • Re-ran autoreview: .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main; clean, no accepted/actionable findings.
  • Hosted exact-head gates passed for 962a6bff456d71ea52d8ba14e96e0e031c075a04: CI #28268641283 and Workflow Sanity #28268641278.

No blocking findings remain. Proceeding to merge via scripts/pr merge-run.

@vincentkoc
vincentkoc merged commit 41c00a6 into openclaw:main Jun 26, 2026
93 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

wangmiao0668000666 pushed a commit to wangmiao0668000666/openclaw that referenced this pull request Jun 27, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 27, 2026
xydigit-zt pushed a commit to xydigit-zt/xydigit-zt-openclaw that referenced this pull request Jun 28, 2026
QiuYuang pushed a commit to QiuYuang/openclaw that referenced this pull request Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants