Skip to content

perf(sessions): reuse rows and skip discarded terminal labels - #152109

Merged
steipete merged 1 commit into
mainfrom
codex/perf-session-cli-owned-rows-20260918
Sep 18, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/perf-session-cli-owned-rows-20260918

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Session listing copies private display rows repeatedly and builds terminal runtime labels that JSON output immediately discards.

User Impact

Session JSON and human output retain their values, ordering, metadata and token semantics while doing less presentation work. No configuration or migration is required.

Why This Change Was Made

Enrich the freshly owned display row directly, keep the necessary JSON exclusion copy, and apply overrides to that private copy. Skip terminal-label construction for JSON; human requests still use the same formatter at the same point. Delete the single-use exclusion wrapper. Production shrinks by nine lines with no cache, new API, selection or authority change.

Evidence

Fresh validation passed 145 existing tests and all maintained changed checks. Managed Codex P2 review and independent complete-data audit passed. Both actual CLI aliases, native/fallback JSON output, metadata, descriptor/key order, aliases, errors and unchanged SQLite fixtures were verified.

A separately fixed six-phase AB/BA/AB experiment retained 960 observations, 720 measured. An untimed real-formatter probe confirmed JSON label calls drop from 100 to zero while human calls remain 100. The 1,000-row JSON --limit all case improved in all three pairs: wall −44.99%/−14.54%/−17.65%, CPU −33.60%/−14.20%/−23.42%.

Results are not uniformly better: 11/30 wall and 13/30 CPU comparisons are adverse; the capped 1,000-row case has a +109.79% wall pair, and unchanged empty/error controls drift substantially. Whole-process RSS includes setup and is not allocation proof. All observations remain; no outliers were removed.

The earlier row-copy-only variant and its mixed measurements are preserved. These results compare the combined change with the original baseline, not the label change in isolation. No blanket CLI, cold-start, stdout-I/O or memory-saving claim is made.

@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: XS maintainer Maintainer-authored PR labels Sep 18, 2026
@steipete
steipete marked this pull request as ready for review September 18, 2026 19:45
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 18, 2026
@clawsweeper

clawsweeper Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 18, 2026, 3:51 PM ET / 19:51 UTC.

ClawSweeper review

What this changes

Session listing reuses private display rows and skips terminal-label formatting for JSON output while preserving output fields and token semantics.

Merge readiness

✅ Ready for maintainer review

This remains a useful, bounded optimization absent from inspected main. No actionable correctness or security defect was found; the maintainer-authored, protected PR should remain open for normal review.

Priority: P3
Reviewed head: 2d77341ec4f9461c89385d80281785664f1ece1a

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving optimization with existing contract coverage and appropriately qualified performance claims.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR is exempt from the external contributor proof gate and changes no authority boundary. Its body reports actual session-list CLI checks and formatter measurements, but raw execution artifacts were not independently inspected.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR is exempt from the external contributor proof gate and changes no authority boundary. Its body reports actual session-list CLI checks and formatter measurements, but raw execution artifacts were not independently inspected.
Evidence reviewed 7 items Introduced change and current-main necessity: The pinned introduction changes only session presentation. Comparing inspected main with the head shows the same optimization remains absent from main; the display-row producer and runtime-label formatter have no additional drift.
Private row ownership and preserved output: toSessionDisplayRow returns a fresh object literal. The command only overwrites top-level display fields, retains the JSON exclusion copy, and evaluates token overrides before Object.assign mutates that copy. The omitted formatter computes display text without writing session state. This is OpenClaw-owned presentation logic, with no changed Codex dependency contract.
Existing behavioral coverage: Inspected existing tests cover exact token values and freshness, terminal runtime labels, terminal-only sanitization, collaboration metadata, ordering, filtering, limits, and errors. Plugin metadata coverage also excludes displayModelRef from JSON. Tests were read, not executed, under the read-only review constraint.
Findings None None.
Security None None.

How this fits together

The sessions CLI reads stored conversation entries, selects recent rows, and enriches them with display metadata. It then emits machine-readable JSON or a terminal table.

flowchart TD
  A[CLI options] --> B[Read session stores]
  B --> C[Filter and select rows]
  C --> D[Enrich private display rows]
  D --> E{Output format}
  E -->|JSON| F[Exclude presentation fields]
  E -->|Terminal| G[Format runtime labels and table]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -9. Total -9 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 17 26 -9
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 17 26 -9

Review metrics

None.

Technical review

Best possible solution:

Keep presentation work local to freshly created rows, preserve the existing output contract, and limit performance claims to the measured workloads.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a behavioral bug: source confirms avoidable copies and discarded label construction, but performance measurements were not rerun during this read-only review.

Is this the best way to solve the issue?

Yes. Reusing fresh display objects and skipping an unused formatter removes work within the existing owner without adding caching, configuration, or another implementation path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against a7bb7f790b00.

Labels

Label changes:

  • add P3: This is a small internal performance improvement with no intended output or configuration change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR is exempt from the external contributor proof gate and changes no authority boundary. Its body reports actual session-list CLI checks and formatter measurements, but raw execution artifacts were not independently inspected.

Label justifications:

  • P3: This is a small internal performance improvement with no intended output or configuration change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR is exempt from the external contributor proof gate and changes no authority boundary. Its body reports actual session-list CLI checks and formatter measurements, but raw execution artifacts were not independently inspected.

Evidence

What I checked:

  • Introduced change and current-main necessity: The pinned introduction changes only session presentation. Comparing inspected main with the head shows the same optimization remains absent from main; the display-row producer and runtime-label formatter have no additional drift. (src/commands/sessions.ts:369, 2d77341ec4f9)
  • Private row ownership and preserved output: toSessionDisplayRow returns a fresh object literal. The command only overwrites top-level display fields, retains the JSON exclusion copy, and evaluates token overrides before Object.assign mutates that copy. The omitted formatter computes display text without writing session state. This is OpenClaw-owned presentation logic, with no changed Codex dependency contract. (src/commands/sessions-table.ts:14, 2d77341ec4f9)
  • Existing behavioral coverage: Inspected existing tests cover exact token values and freshness, terminal runtime labels, terminal-only sanitization, collaboration metadata, ordering, filtering, limits, and errors. Plugin metadata coverage also excludes displayModelRef from JSON. Tests were read, not executed, under the read-only review constraint. (src/commands/sessions.test.ts:405, 2d77341ec4f9)
  • Release comparison: The latest supplied release, v2026.9.4, still copies the display row, computes runtimeLabel unconditionally, and copies the JSON exclusion result again. The optimization is not present in that release. (src/commands/sessions.ts:391, 3a9d69db306c)
  • Relevant maintenance history: Current-main history includes session-list performance work by Peter Steinberger and display-row contract work by Dallin Romney. GitHub commit responses identify their handles as steipete and RomneyDa. Local blame and historical patch inspection encountered unavailable objects, so no source-line introduction attribution is asserted. (src/commands/sessions.ts, 1c1affa936f6)
  • Captured validation claims and limits: The supplied body at sourceRevision da877909ecfea03dc2421bfe1754d357dbe89ea4cea9ca3fa584a861bd378357 reports both CLI aliases, JSON and human output, unchanged SQLite fixtures, and 145 passing tests. It reports JSON formatter calls dropping from 100 to zero while acknowledging adverse timing comparisons. These are author-reported results; no raw benchmark artifact was supplied or independently executed. (2d77341ec4f9)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • RomneyDa: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

@steipete
steipete merged commit d9cb5f8 into main Sep 18, 2026
168 checks passed
@steipete
steipete deleted the codex/perf-session-cli-owned-rows-20260918 branch September 18, 2026 20:56
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 18, 2026
…49075-c1-control-repair

* commit 'dc5b321b5f89f9cf0e704ee202ea3059fb1ce63d': (79 commits)
  fix: start background context maintenance after durable turns (#151936)
  fix(models): avoid ambient state reads during prepared selection (#152119)
  feat: recover abandoned Crabbox source staging (#152006)
  chore(ui): refresh control ui locales (#152098)
  fix(ui): keep cloud startup prompts and progress in chat (#152024)
  fix: report completed subprocess cleanup after cancellation (#152107)
  perf(reply): reuse normalized inbound text (#152110)
  fix(cron): paused future one-shots disappear after Run now (#152126)
  perf(sessions): reuse rows and skip discarded terminal labels (#152109)
  fix(ui): keep keyboard-focused automation controls clear of sticky actions (#152135)
  fix(ui): load remote images in compact activity previews (#152045)
  refactor(health): skip unused verbose account projection (#152108)
  fix: restore dashboard test limits and SQLite test compilation (#152089)
  test(qa-lab): stabilize timeout recovery delivery proof (#152100)
  fix: probe SQLite when Node denies worker threads (#152075)
  perf(gateway): keep GitHub co-author trailer scans linear (#152115)
  fix(media): report CLI models with missing command or args (#151969)
  refactor: remove retired runtime code and duplicate helpers (#151973)
  perf(plugins): combine runtime and tool call scopes (#152101)
  test(memory): seed restart fixtures with the Gateway stopped (#152038)
  ...
vincentkoc added a commit that referenced this pull request Sep 18, 2026
…n-20260918-v4

* origin/main: (81 commits)
  fix: retire failed setup plugins without replaying facade initialization (#152026)
  fix(test): select Node for built runtime recovery fixtures (#152162)
  refactor(auth): reuse privately assembled choice groups (#152166)
  fix: preserve chat media delivery and session boundaries (#152079)
  fix: keep stale Stop messages from canceling replacement sessions (#152116)
  improve(plugins): reduce mutable argument handling overhead (#152154)
  fix(scripts): prevent host tooling drift from blocking PR workflows (#152078)
  improve: reduce model capability preparation work (#152128)
  fix: stop marking delivered scheduled reports as failed (#152165)
  fix: start background context maintenance after durable turns (#151936)
  fix(models): avoid ambient state reads during prepared selection (#152119)
  feat: recover abandoned Crabbox source staging (#152006)
  chore(ui): refresh control ui locales (#152098)
  fix(ui): keep cloud startup prompts and progress in chat (#152024)
  fix: report completed subprocess cleanup after cancellation (#152107)
  perf(reply): reuse normalized inbound text (#152110)
  fix(cron): paused future one-shots disappear after Run now (#152126)
  perf(sessions): reuse rows and skip discarded terminal labels (#152109)
  fix(ui): keep keyboard-focused automation controls clear of sticky actions (#152135)
  fix(ui): load remote images in compact activity previews (#152045)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant