Skip to content

fix(status): make online JSON status responsive on large fleets - #150269

Merged
steipete merged 2 commits into
mainfrom
upd/fleet-status-projection
Sep 16, 2026
Merged

steipete merged 2 commits into
mainfrom
upd/fleet-status-projection

Conversation

@steipete

@steipete steipete commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Related: #149538. Gateway-side sibling: #150223.

What Problem This Solves

Fixes openclaw status --json spending tens of seconds rescanning a large fleet even when the Gateway's status handler is responsive. The campaign context is the 632-agent × 54-model fleet reported in #149538 by @609NFT.

User Impact

Online JSON status uses Gateway-owned session, admission, heartbeat, task, and runtime facts. Agent names and ownership, memory-plugin selection, and the local Gateway's configured update channel come from an additive, opt-in status projection. The request retains operator.read; sensitive session details stay redacted. Local workspace/bootstrap checks and requested local plugin inspections are explicitly marked not collected, including nullable bootstrap counts and collected: false audit/compatibility sections. Explicit usage credential selection is preserved. Remote Gateway configuration cannot select the local CLI installation's update channel.

Offline diagnostics retain their existing path. Follow-up: offline scan is unbounded; bounding it needs a cleanup contract for exec SecretRefs.

Why This Change Was Made

The CLI's full config reader prepared plugin metadata for every workspace, local admission ran before report assembly, and most of the Gateway response was discarded before a second local summary was built. The online path now uses the existing narrow Gateway dispatch reader and consumes the prepared response. The original discovery branch remains only for offline diagnostics. Memory-slot policy moved to one shared owner rather than being copied into the new projection.

Compatibility disposition

includeCliProjection is an internal status-RPC request detail used by the built-in JSON client and forwarded as a summary-handler argument. It is an additive RPC parameter, with no dedicated operator CLI flag, configuration key, or environment variable. The handler enables it only for literal true; omitted, false, and other values keep the default closed. The independent operator.admin check still controls sensitive fields, so a read-scoped projection remains redacted.

Evidence

Synthetic fixture: 200 separate workspaces and agent databases, 54 configured model references per agent (10,800 total), 53 inline provider definitions, the same 12-plugin allowlist as the sibling proof, and a loopback-only model endpoint. No model turns were launched. Both runs used isolated state; Node v26.8.2.

Run Before: 30-second deadline Valid JSON at deadline After: wall time to valid JSON and exit 0
1 30.016 s No 4.037 s
2 30.009 s No 2.229 s
3 30.007 s No 1.662 s

Before samples are deadline observations: terminating their pnpm wrapper left underlying children running, so they could overlap and are not clean completion timings. JSON appeared later. After samples use node openclaw.mjs status --json directly, following one successful authorized status RPC, and await each process without terminating it. No precise speedup factor is claimed. An initial sample taken immediately after the readiness log hit a Gateway RPC timeout, used the unchanged offline path, and completed in 45.730 s; the next two online samples completed in 2.845 s and 1.367 s. That startup-unavailable case remains a limitation of the retained offline fallback.

Before traces recorded 200 metadata scans per config read (14.580–20.181 s) and 14.611–25.844 s of local admission; the corresponding Gateway status handlers took 341–462 ms. All three confirmed-online traces contain zero plugin metadata scans and zero local admission/session-summary stages, and return all 200 agents with explicit ownership.

  • The boundary regression failed before the fix with full metadata reader call count 1, expected 0; online tests now assert zero full reads, zero local admission/summary calls, and preserved Gateway counts. Local/remote projection, older Gateway, offline invalid-config, output, and read-scope tests pass: 41 focused tests.
  • node scripts/check-changed.mjs: passed, including core/test typechecks, lint, and repository guards.
  • pnpm build: passed in 6m 35.3s with the topology guard intact.
  • pnpm check:import-cycles: 0 runtime value cycles. pnpm docs:list completed; status docs updated.
  • Fresh Codex review with --mode branch --base origin/main --max-priority P1: scoped-clean, no actionable P0/P1 findings.

The earlier build failure was Boundary configuration or resolution topology changed during compilation: the regression file was added during the SDK declaration phase, changing both the source inventory and TypeScript roots. No production import caused that failure, and the guard was retained. The final build passed with source/test files frozen.

Initial cutover production: +395/−64 LOC; tests/support: +289/−4 LOC; docs: +18/−0 LOC. The growth is the online adapter, explicit collection metadata, and additive projection; the required offline implementation remains intact.

Status-handler CI repair

The previous-head CI job reported three stale exact-argument expectations: the read-scope and admin-scope cases plus the channel-summary-skipping case. They now include includeCliProjection: false, retaining the exact scope, sensitive-field, channel-summary, and response assertions. A repository-wide getStatusSummary/handler assertion audit found no other stale expectations. Reusing the existing request helper removes duplicated setup and satisfies the oversized-file line-growth ratchet without weakening coverage.

Relative to b0286e53ff37eee4acf163ef59b1f0e9c0c412a5, this repair changes only src/gateway/server-methods/server-methods.test.ts: +10/−15 test LOC, 0 production LOC. The complete test file passes 219/219 tests. The original production/build/runtime evidence above remains applicable because production is unchanged.

Repair validation: node scripts/check-changed.mjs --base b0286e53ff37eee4acf163ef59b1f0e9c0c412a5 -- src/gateway/server-methods/server-methods.test.ts exited 0, including core/test typechecks, targeted core lint, formatting, line-growth and other repository guards. No extension lint substitute was needed. git diff --check is clean.

Use the narrow Gateway connection reader and consume the Gateway's status
projection before local fleet discovery. Preserve read scope, expose prepared
roster/configuration facts additively, and identify local inspections that were
not collected. Keep the existing offline diagnostics path.

Related: #149538
Gateway-side sibling: #150223
@clawsweeper

clawsweeper Bot commented Sep 16, 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 docs Improvements or additions to documentation gateway Gateway runtime commands Command implementations size: L maintainer Maintainer-authored PR labels Sep 16, 2026
@steipete
steipete marked this pull request as ready for review September 16, 2026 19:56
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 16, 2026, 4:28 PM ET / 20:28 UTC (Revision 2).

ClawSweeper review

What this changes

Makes online JSON status reuse Gateway fleet information and identify skipped local inspections, while retaining offline diagnostics.

Merge readiness

⛔ Blocked before merge - 4 items remain

The performance fix remains useful and the latest test repair preserves the existing assertions. No discrete blocking code defect was found; the deliberate JSON compatibility change still needs an explicit upgrade disposition.

Priority: P2
Reviewed head: b102343436f9d741438291ad66e6d138ec1c1db6
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, well-supported performance repair with no discrete blocking finding; consumer compatibility remains an explicit landing consideration.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The captured production CLI/Gateway fleet runs exercise the new online collection path and report valid JSON, all 200 agents, successful exits, and elimination of local rediscovery stages; the subsequent head changes only tests. Before timing limitations and the slow offline fallback are disclosed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The captured production CLI/Gateway fleet runs exercise the new online collection path and report valid JSON, all 200 agents, successful exits, and elimination of local rediscovery stages; the subsequent head changes only tests. Before timing limitations and the slow offline fallback are disclosed.
Evidence reviewed 9 items Current main still performs local collection: Current main starts collectStatusScanOverview before building JSON, retaining local configuration, agent, and summary collection. The proposed online-first path is absent.
Latest release comparison: The supplied latest release, v2026.9.4, also starts with local overview collection and performs requested plugin and memory inspection; it does not contain this online-first implementation.
Introduced JSON contract changes: The online adapter returns nullable workspace/bootstrap/activity facts and consumes read-scoped session data. Requested security and compatibility inspections return collected:false; compatibility also retains count:0 and warnings:[], which older consumers may interpret as a completed clean inspection.
Findings None None.
Security None None.

How this fits together

The status CLI combines local installation information with Gateway health and fleet data. This change uses the running Gateway’s summary before attempting expensive local discovery.

flowchart TD
  A[JSON status command] --> B[Read connection configuration]
  B --> C[Request Gateway summary]
  C --> D{Gateway available?}
  D -->|Yes| E[Use fleet projection]
  D -->|No| F[Collect local diagnostics]
  E --> G[JSON with collection metadata]
  F --> G
Loading

Decision needed

Question Recommendation
Should online status replace the existing JSON detail and inspection contract for current consumers? Validate and accept the JSON cutover: Check representative existing consumers and explicitly accept nullable, redacted, and uncollected results before landing.

Why: The body intentionally documents reduced collection, but its compatibility disposition addresses the additive RPC parameter rather than acceptance of the changed CLI output contract.

Before merge

  • Resolve merge risk (P1) - Existing JSON consumers may reject null bootstrap counts, lose expected session details, or treat uncollected audit/compatibility output as a completed inspection. The performance evidence and additive RPC disposition do not establish compatibility for those consumers.
  • Complete next step (P2) - Validate representative existing JSON consumers and explicitly accept the changed output contract, or preserve the detailed inspection behavior they require.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +331, Tests +280, Docs +18. Total +629 across 22 files.

View PR surface stats
Area Files Added Removed Net
Source 15 395 64 +331
Tests 6 299 19 +280
Docs 1 18 0 +18
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 22 712 83 +629

Review metrics

Metric Value Why it matters
RPC surface 1 opt-in request parameter; 0 new CLI flags, config keys, or environment variables The additive RPC parameter is separate from the compatibility-sensitive change to existing JSON output.
Production and test growth Production +395/−64; tests/support +299/−19 The body justifies production growth as the online adapter and collection metadata while retaining the required offline path.

Stored data model

Persistent data-model change detected: vector/embedding metadata: src/status/memory-plugin.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Accept the documented output change after consumer checks (recommended)
    Validate existing JSON consumers and record acceptance of skipped inspections and nullable or redacted fields.
  2. Retain details needed by existing consumers
    Preserve the supported detailed inspection path if consumer checks establish a dependency on its previous output.

Technical review

Best possible solution:

Keep Gateway-owned online collection with an explicitly accepted JSON upgrade contract and clear access to the omitted local diagnostics.

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

Yes, source inspection establishes that current main performs local fleet collection before JSON assembly, and the supplied fleet traces identify those expensive stages. This read-only review did not execute a reproduction.

Is this the best way to solve the issue?

Yes for the performance mechanism: reuse the Gateway’s prepared facts through the existing status owner. Acceptance of the reduced JSON contract remains a separate upgrade decision.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded performance repair for large-fleet status diagnostics, distinct from the broader Gateway availability incident.
  • merge-risk: 🚨 compatibility: Online JSON changes previously populated fields and requested inspection results in ways existing consumers may not handle.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The captured production CLI/Gateway fleet runs exercise the new online collection path and report valid JSON, all 200 agents, successful exits, and elimination of local rediscovery stages; the subsequent head changes only tests. Before timing limitations and the slow offline fallback are disclosed.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured production CLI/Gateway fleet runs exercise the new online collection path and report valid JSON, all 200 agents, successful exits, and elimination of local rediscovery stages; the subsequent head changes only tests. Before timing limitations and the slow offline fallback are disclosed.

Evidence

What I checked:

  • Current main still performs local collection: Current main starts collectStatusScanOverview before building JSON, retaining local configuration, agent, and summary collection. The proposed online-first path is absent. (src/commands/status.scan.fast-json.ts:80, dd303462323e)
  • Latest release comparison: The supplied latest release, v2026.9.4, also starts with local overview collection and performs requested plugin and memory inspection; it does not contain this online-first implementation. (src/commands/status.scan.fast-json.ts:80, 3a9d69db306c)
  • Introduced JSON contract changes: The online adapter returns nullable workspace/bootstrap/activity facts and consumes read-scoped session data. Requested security and compatibility inspections return collected:false; compatibility also retains count:0 and warnings:[], which older consumers may interpret as a completed clean inspection. (src/commands/status-json-runtime.ts:94, b102343436f9)
  • Real fleet behavior evidence: The complete captured PR body, sourceRevision 86f4c5b6af21e567ad7b353356d8425b67060c4a63a455b713234c85aca814e3, describes the production CLI and Gateway running against 200 isolated agent databases and 10,800 model references. Three confirmed-online after runs returned valid JSON and exited successfully in 4.037, 2.229, and 1.662 seconds, with zero metadata scans or local admission/summary stages. Before measurements are deadline observations with overlapping-child limitations, not clean speedup measurements. The startup-unavailable fallback remained slow. (b0286e53ff37)
  • Re-review continuity: Comparison with the earlier reviewed head shows only the server-methods test repair: exact expectations now include includeCliProjection:false, while scope, sensitive-field, channel-summary, and response assertions remain. The supplied body reports 219 passing tests and a passing changed-file gate. The previous review had no findings; its JSON-consumer compatibility concern remains distinct from the documented additive RPC parameter. (src/gateway/server-methods/server-methods.test.ts:4556, b102343436f9)
  • Read-scope boundary preserved: The status handler enables the projection only for literal true and independently gates sensitive fields on operator.admin. The projection contains roster names, ownership, update channel, and memory-slot selection; the owner-routing test verifies read-scoped session redaction. No authority-bearing value or new authorization path was introduced. (src/gateway/server-methods/health.ts:167, b102343436f9)

Likely related people:

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

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record representative JSON-consumer upgrade results and explicitly accept the reduced online output contract.

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-16T20:03:48.936Z sha b0286e5 :: blocked before merge. :: none

@steipete
steipete merged commit 6d175b1 into main Sep 16, 2026
212 of 214 checks passed
@steipete
steipete deleted the upd/fleet-status-projection branch September 16, 2026 20:56
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 17, 2026
…claw#150269)

* fix(status): make online JSON status responsive on large fleets

Use the narrow Gateway connection reader and consume the Gateway's status
projection before local fleet discovery. Preserve read scope, expose prepared
roster/configuration facts additively, and identify local inspections that were
not collected. Keep the existing offline diagnostics path.

Related: openclaw#149538
Gateway-side sibling: openclaw#150223

* test(gateway): align status scope expectations with projection default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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