Repository navigation
fix(cli): keep channels status route cold - #117751
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 10:34 PM ET / August 2, 2026, 02:34 UTC. ClawSweeper reviewWhat this changesThis PR makes route-first Merge readinessThis PR remains necessary: current Priority: P2 Review scores
Verification
How this fits togetherThe CLI command catalog supplies startup policy to both Commander and lightweight route-first commands. flowchart LR
A[CLI argv] --> B[Command catalog]
B --> C[Route-first dispatcher]
C --> D[Startup policy]
D --> E[Gateway channels status RPC]
E --> F[JSON payload]
E --> G[Text or fallback runtime]
G --> H[Operator output]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +1, Tests +26. Total +27 across 4 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep one declarative startup-policy rule on the Do we have a high-confidence way to reproduce the issue? Yes. A packaged Is this the best way to solve the issue? Yes. The catalog is the authoritative startup-policy owner, and AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b8865942db84. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Land-ready at
No review findings remain. |
|
Merged via squash.
|
What Problem This Solves
openclaw channels status --jsonstill took ~10 s in production after #117705, which was supposed to make its JSON success path cold. Measured on the production team host running a dist that contains #117705: 9878 ms and 9839 ms on consecutive runs, with a CPU profile showing the identical plugin-module load storm as before that fix (jiti 2579 ms, package_json_reader 924 ms, lstat 604 ms, compile+vm ~980 ms).Why This Change Was Made
The CLI has two dispatch paths, and #117705 covered only one. Commander's pre-action hook consults
bypassConfigGuard— that half worked (theopenclaw agentimprovement is live in production). Butchannels statusis a route-first command:run-main.ts→route.ts→command-bootstrap.ts→config-guard.ts, and routed commands derive their startup policy fromrouteConfigGuard, which the entry never set. So the routed path still ran the doctor/config preflight, which reaches state migrations and plugin validation — the ~10 s storm.The prior cold-import guard passed while production stayed slow because it called
channelsStatusCommanddirectly, bypassing routing and bootstrap entirely — it proved only that the runtime module stayed lazy after a successful gateway response, not that the real path was cold.The fix is one production line:
routeConfigGuard: "always"on the["channels", "status"]catalog entry (the same policy every other cold routed command already declares). The replacement guard test drives the realtryRouteCliwiring for JSON status with and without--probe, asserts neither the config guard nor the status runtime loads, and fails on the config-guard sentinel if the production line is reverted. The test deliberately never clears the module-load marker set, so an eager import introduced anywhere in the route's own static import graph is also caught (a first review round found that clearing it inbeforeEachwould have erased exactly that evidence).Text rendering and the unreachable-gateway fallback still load
status.runtime.tson demand; command matching is unchanged.User Impact
openclaw channels status --json(success path) drops from ~10 s to sub-second. Local reachable-gateway measurements: 5.45 s / 5.33 s before → 0.69 s / 0.68 s / 0.68 s after, with startup tracing emitting no config/migration stages.Evidence
pnpm buildpassed; no[INEFFECTIVE_DYNAMIC_IMPORT].gpt-5.6-sol, high): first round found the guard-evidence hole (fixed); final round clean, "patch is correct" (0.93).Known context: one unrelated logs-fixture test is nondeterministic on the branch base and already fixed upstream (2649903); not mixed into this change.