Repository navigation
refactor: streamline skills JSON output - #140581
Conversation
Use the existing string sanitizer during JSON serialization instead of recursively cloning plain skill reports first. Only prepare the human missing-skill name when that branch needs it. Preserve report values, ordering, and formatting while reducing intermediate traversal and code.
|
🦞👀 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 6, 2026, 9:54 PM ET / September 7, 2026, 01:54 UTC. ClawSweeper reviewWhat this changesThe PR sanitizes skills JSON during serialization instead of copying reports recursively, and prepares human-readable lookup errors only when needed. Merge readiness✅ Ready for maintainer review Keep open: this is a bounded, useful optimization not present on inspected main, with no actionable correctness finding. The maintainer-authored, protected PR remains eligible for normal review. Priority: P3 Review scores
Verification
How this fits togetherThe skills CLI receives status reports from the Gateway or local discovery. Its formatting layer turns those reports into terminal text or sanitized JSON for scripts. flowchart LR
A[Gateway status] --> C[Skills status report]
B[Local discovery] --> C
C --> D{Output format}
D --> E[Terminal text]
D --> F[JSON serialization and string sanitization]
F --> G[Standard output for scripts]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -11. Total -11 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Use the serializer's string replacer while preserving the existing plain-report JSON fields, ordering, indentation, and control-character sanitization. Do we have a high-confidence way to reproduce the issue? Not applicable to a correctness bug: this PR optimizes existing formatting, and the body supplies workload-specific before/after measurements. Is this the best way to solve the issue? Yes. A JSON replacer removes redundant traversal while applying the same sanitizer to the plain nested data produced by discovery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against dd3faf5f4749. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash; the accepted merge was confirmed after main advanced during final verification. No second merge request was sent.
|
…137098 * commit '8a540c252002878f3c3e9d8dfb837b83c8602a78': (2210 commits) perf(plugins): keep bundled catalog lookups lightweight (#140597) refactor: streamline skills JSON serialization (#140581) fix(feishu): expand quoted merged-forward messages (#136231) fix(talk): keep opaque realtime routes out of public config (#129144) fix(ci): avoid Linux packaging on pull requests (#140589) fix(usage): release completed request payloads (#140588) fix(tooling): omit Trae machine squash credit (#140562) fix(ui): stop catalog paging in hidden tabs (#140583) fix(portals): reach IPv6 loopback with IPv4-only localhost records (#140580) fix(transcripts): preserve fixed and legacy capture history (#140563) fix(ui): prevent Talk E2E audio capture stalls (#138803) fix(media): release completed document source buffers (#140561) fix(anthropic): preserve resumed CLI caches across Git changes (#140566) chore(ui): refresh control ui locales (#140586) fix(ui): keep usage exports bound to their session instance (#140573) refactor(exa): test response readers through tool execution (#140572) fix(macos): omit incompatible worker binaries from app bundles (#140557) fix: avoid retaining discarded tool output (#140570) refactor(gateway): share placement move matching (#140569) fix(gateway): preserve child turns during systemd drain (#140568) ... # Conflicts: # .agents/skills/release-openclaw-maintainer/SKILL.md # docs/reference/RELEASING.md
Use the existing string sanitizer during JSON serialization instead of recursively cloning plain skill reports first. Only prepare the human missing-skill name when that branch needs it. Preserve report values, ordering, and formatting while reducing intermediate traversal and code.
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.
What Problem This Solves
Large
openclaw skills list --jsoninventories spend avoidable time formatting their reports. This reduces that work while preserving the machine-readable output contract and terminal-control sanitization.Why This Change Was Made
Apply the existing string sanitizer during JSON serialization instead of recursively copying the report first. Also prepare the human lookup-error name only when returning that error. The cleanup removes 11 production lines without adding dependencies, configuration, or API fields.
The contract is the plain status reports produced by Gateway/local discovery, not arbitrary class instances or custom
toJSONmethods.User Impact
The fixed cohort's clean 1,000-skill list JSON medians improved 14.74% / 14.79%, saving about 0.404 / 0.428 ms per formatting call. Control-bearing 1,000-skill lists improved 13.04% / 12.63%. All returned output bytes were preserved.
The benefit is localized, not uniform: clean 1,000-skill info JSON regressed 55.22% / 69.55% (16.16 / 21.77 µs), some check rows regressed roughly 1–8%, and human-output controls were mixed and frequently adverse. Kernel and sampled tree peak RSS increased about 0.8–1.1%. No overall CLI-startup, Gateway, or memory improvement is claimed.
Evidence
First observations and warmups were untimed correctness checks. Each reported sample is the mean of two separately clocked formatter calls; maxima are maximum batch means, not latency percentiles. Discovery and provider/Gateway execution are outside the measured formatter intervals.
The first capture attempt hit the unchanged 64 MiB journal cap after 948 verified returns and produced no performance verdict. R2 retained full strings in a lossless dictionary with one exact reference per return, including new differing outputs before assertions, then ran a fresh complete cohort. No cap or call count was increased/reduced, no partial R1 timing was pooled, and all failed-attempt evidence remains preserved. Capture changes happened outside the clock but can affect process state, so these are descriptive workload results rather than a universal speedup.
All 53 rows: forward and reverse median / mean / maximum changes
Percent change is candidate relative to baseline; negative is faster. Forward is B0→C0 and reverse is B1→C1. “controls” fixtures contain ANSI/C0/C1-bearing strings.
Exact-head CI and required gate passed.