Repository navigation
improve(cli): cut ordinary gateway status startup memory - #133114
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 3:31 AM ET / 07:31 UTC. ClawSweeper reviewWhat this changesThis PR keeps ordinary Merge readinessKeep open: the branch still provides a distinct status-command memory reduction that is absent from current main, and source review found no introduced correctness or security defect. Priority: P2 Review scores
Verification
How this fits togetherGateway status is a routed CLI command that reads local and service configuration, derives connection details, and reports Gateway health. The change keeps simple status invocations lightweight while retaining full configuration loading for complex or deep inspection paths. flowchart LR
A[CLI invocation] --> B[Gateway status route]
B --> C[Fast config read]
C --> D{Complex or deep config?}
D -->|No| E[Derive port and bind defaults]
D -->|Yes| F[Full configuration loader]
E --> G[Gateway status report]
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +7, Tests +211. Total +218 across 10 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk options
Maintainer options:
Technical reviewBest possible solution: Land the focused lazy-loading boundary once exact-head checks complete, preserving full ConfigIO escalation for complex and deep status paths. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a PR review; the submitted constrained-host results are supporting evidence, while source review verifies the affected route and its guarded fast path. Is this the best way to solve the issue? Yes: route-level lazy loading removes the ordinary status import cost while retaining the existing full-loader contract for configurations that need it. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ef8fc680fe28. 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)
|
…3114) * perf(cli): checkpoint lazy gateway status config * perf(cli): keep gateway status off full config IO
Related: #132784
What Problem This Solves
Fixes an issue where ordinary
openclaw gateway statusstill loaded the full config runtime and generated schema graph on constrained hosts, even for a missing or plain same-file config. That unnecessary import closure added about 65 MB to cold-process RSS after the earlier duplicate-process fix.Why This Change Was Made
The status owner now reads missing and plain JSON5 configs through its existing bounded fast path and lazy-loads full config IO only for deep validation, includes, substitutions, root environment blocks, or non-
ENOENTread failures.Lifecycle-only config and service dependencies move out of the presentation helper imported by status. Two daemon helpers that still need full config IO load its runtime owner on demand. Deep status and lifecycle behavior remain unchanged.
User Impact
Ordinary Gateway status checks use materially less transient memory on small hosts while preserving output, RPC probing, malformed-config diagnostics, and full plugin-aware validation for
--deep.Evidence
gateway status --require-rpcpeak RSS fell from about 271 MiB on the prior landed build to 182-251 MiB across the complete matrix; Gateway RSS stayed within the expected host-dependent range.Production LOC: +54/-47 (net +7) | Tests: +279/-68 (net +211)
The production growth is the lazy owner boundary plus explicit missing-file semantics. Thirty-five production lines are a direct move of lifecycle-only helpers out of the status import closure.
Residual Limits