Repository navigation
perf(sessions): reuse rows and skip discarded terminal labels - #152109
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 18, 2026, 3:51 PM ET / 19:51 UTC. ClawSweeper reviewWhat this changesSession 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 Review scores
Verification
How this fits togetherThe 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]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -9. Total -9 across 1 file. View PR surface stats
Review metricsNone. Technical reviewBest 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. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…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) ...
…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) ...
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.