Repository navigation
perf(channels): serve status from recorded health - #166538
Conversation
Read lifecycle health and secret-free account metadata for ordinary channel status. Keep explicit checks concurrent under one channel deadline, fence expired hooks, and publish provider metadata from its lifecycle owners.
|
🦞👀 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 October 7, 2026, 5:49 AM ET / 09:49 UTC (Revision 2). ClawSweeper reviewWhat this changesChannel status reads use recorded lifecycle health and safe account metadata, while explicit probes receive a shared channel deadline and WhatsApp and Nostr publish provider metadata through their lifecycle owners. Merge readiness✅ Ready for maintainer review The change remains useful: current main still performs operational account resolution and status hooks during ordinary reads. No actionable introduced defect was found, and the documented diagnostics tradeoff does not require a new maintainer decision. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway combines channel configuration and recorded runtime health into status responses consumed by CLI commands and the Control UI. Explicit probes additionally invoke provider checks and return recorded state with warnings when their deadline expires. flowchart TD
A[CLI or Control UI request] --> B{Explicit probe?}
C[Recorded channel health] --> D[Safe status projection]
E[Account configuration metadata] --> D
B -->|No| D
B -->|Yes| F[Provider checks within channel deadline]
F -->|Timeout| D
F --> G[Status response and warnings]
D --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +94, Tests +234, Docs +15. Total +343 across 15 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep ordinary diagnostics on existing lifecycle and inspection owners, with explicit live checks bounded by one channel deadline. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main awaits operational account preparation and snapshot hooks outside the bounded probe calls, so a delayed hook can hold the status response. This review did not execute a reproduction. Is this the best way to solve the issue? Yes. Reusing recorded lifecycle facts and the existing safe inspection projection avoids a competing cache, while deadline assertions prevent later live hooks from starting after expiry. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 49c18152c8bf. LabelsLabel changes: No label changes. Label 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)
|
|
CI run 37602575492, attempt 1, has one failed root job: I independently ran the full test file on unchanged main revision The fixture leak is already repaired on main by #166529 ( The additional sibling sweep selected 688 immediate test files across the five touched directories. Blacksmith Testbox leases The two local failures were investigated without hiding them:
No authenticated provider or production latency validation is claimed. Both Testbox baseline commands exited 0; the fresh-archive run reported a runner portal notification timeout after its successful command. The local Mac ran no heavy validation. Landed as |
Read lifecycle health and secret-free account metadata for ordinary channel status. Keep explicit checks concurrent under one channel deadline, fence expired hooks, and publish provider metadata from its lifecycle owners.
What Problem This Solves
Ordinary channel-status reads can wait seconds for operational credential resolution, plugin state reads, and authentication-file inspection even when live probing was not requested.
User Impact
Channel status returns recorded lifecycle health and secret-free configuration metadata. Unknown configuration and stale connections remain visible. Explicit probes still run live checks, with one deadline per channel so a stuck channel cannot withhold healthy siblings indefinitely.
Why This Change Was Made
The runtime owns channel health. Ordinary reads now consume those facts instead of rebuilding them through operational account resolvers and status hooks. For example, X already records guest usage in its monitor, while the old status path read that usage again; WhatsApp's summary re-read authentication files. There is no new cache or configuration option.
Live checks already ran concurrently; the unbounded work was account preparation and snapshot/summary hooks. Explicit live checks retain their existing plugin contracts. The deadline now covers account preparation, probes, audits, account snapshots, and summaries. The channel owner passes its deadline assertion through the snapshot helper, and an elapsed-deadline check routes synchronous overruns through the same recorded-state fallback as timer expiry. On timeout the response preserves recorded state and reports a warning. Nostr publishes its profile through lifecycle status; WhatsApp publishes identity metadata while running, refreshes auth age from its existing heartbeat sample, and clears identity on stop/logout. Details that a plugin has not recorded may require an explicit probe.
Production LOC: +94 net (177 added, 83 removed), plus +152 in the shared test helper. The requested production stat filter reports +246 because it includes
*.test-helpers.ts. Growth is required by the existing asynchronous plugin-hook and provider-metadata contracts: a single channel deadline must bound preparation and prevent follow-up operations after timeout, while lifecycle publications retain provider fields that the UI consumes.Evidence
Blacksmith Testbox, profile
openclaw-check:tbx_01m4a9r1rmzedv3r8rzmq5hq1s, pinned basea6e31e2247ebdc477be43c8ba6b5e73bf6082928with all 11 candidate files hash-verified: 80 focused tests passed in 54.63 seconds throughnode scripts/run-vitest.mjs ... --maxWorkers=1. File durations: Gateway status 26.16 s (42 tests), WhatsApp status 11.16 s (7), Nostr lifecycle/outbound 10.89 s (18), account status 3.09 s (13). Test bodies were under one second per file.tbx_01m4am1xb35t0s662djpz2f5gw: 106 behavior tests passed across five files, including 49 Gateway status cases (37.08 s wall time), 44 WhatsApp/monitor cases (9.14 s), and 13 shared-status cases (3.38 s). Unchanged sibling proof brings the union to 176 tests across 10 files. Wall time is primarily transformation/import work; deadline tests use fake time. The export-name guard and 20 import-closure tests passed.authAgeMs. Removing only the new summary-entry assertion also fails the queued-summary regression because the summary hook runs after expiry. All pass on the candidate. The first queued-summary fixture failed this negative control and was corrected before acceptance.pnpm buildpassed. Nostr and WhatsApp cold-import profiles completed. Their memory comparison is explicitly unqualified because the source checkout contained the hash-verified staged patch; only import completion is claimed.tbx_01m4a8ts6p1yhpbs9j2q4weq8balso required a one-time dependency install and had an earlier 42-test passing run.No live Gateway was modified. Independent review found and prompted fixes for remaining hook budgets and synchronous deadline expiry/continuations; final Codex P0–P2 review passed with no actionable findings. Selected CI jobs passed in 156 s (channels), 309 s (extension bundle), and 185 s (boundary); those are whole-job durations, not incremental test cost. The latency comparison is a synthetic handler benchmark on Linux Testbox; it does not measure network/WebSocket overhead or authenticated providers.
Remote run record
The table below uses provider
blacksmith-testboxand profileopenclaw-checkthroughcrabbox run --id … --timing-json -- bash -c ….status-tests=node scripts/run-vitest.mjs src/gateway/server-methods/channels.status.test.ts --maxWorkers=1.focused-testsaddssrc/channels/plugins/status.test.ts,extensions/nostr/src/channel.outbound.test.ts, andextensions/whatsapp/src/channel.status.test.tsto that invocation.owner/sibling-testsrunssrc/channels/plugins/status.test.ts,src/channels/account-summary.test.ts,src/channels/account-snapshot-fields.test.ts,src/gateway/server-methods/channels.start.test.ts,extensions/nostr/src/channel.outbound.test.ts,extensions/nostr/src/channel.test.ts, andextensions/whatsapp/src/channel.status.test.tsthroughnode scripts/run-vitest.mjs ... --maxWorkers=1.closure-guardsrunsnode --import ./scripts/tsx.mjs scripts/check-export-name-collisions.mtsandnode scripts/run-vitest.mjs test/scripts/eager-import-closure.test.ts test/scripts/pr-wrapper-source-closure.test.ts.final-testsaddsextensions/whatsapp/src/auto-reply/monitor-state.test.tsandextensions/whatsapp/src/auto-reply/web-auto-reply-monitor.test.tsto the Gateway, WhatsApp status, and shared-status files.import profiles=OPENCLAW_LOCAL_CHECK=0 node --import tsx scripts/profile-extension-memory.mts --extension <nostr|whatsapp> --skip-combined --concurrency 1.comparisoncreates an isolated worktree at the pinned base, installs frozen dependencies, copies the regression fixture, and runs the failing regression plus the synthetic before/after benchmark.q4weq8bstatus-testsq4weq8bpnpm install --frozen-lockfile && status-testsq4weq8bstatus-testsq4weq8bfocused-testsmq5hq1sfocused-tests && comparisonmq5hq1scomparison && node scripts/check-changed.mjsmq5hq1sstatus-tests && node scripts/check-changed.mjs --stagedmq5hq1sba0b8nqen0j9nkstatus-tests && staged gateen0j9nken0j9nkj26vxgk9j26vxgk9j26vxgk9jpz2f5gwjpz2f5gwpnpm build, import profilesjpz2f5gwFull lease IDs appear above; the final lease is
tbx_01m4am1xb35t0s662djpz2f5gw; preceding leases weretbx_01m4ajkr09x77yc3v5j26vxgk9andtbx_01m4ag4z0e1bxa1z0f8en0j9nk. After the final lease queued for over 20 minutes, the staged gate used the authorized isolated Linux rig (8 vCPU, 30 GB RAM), with the exact staged patch on the same pinned base:node scripts/check-changed.mjs --staged. The final full run passed with== exit=0 (09:38Z). The prescribed wrapper retains its final 80 lines; this completion summary reflects that log: No local heavy validation was used.node scripts/check-changed.mjs --stagedCI and sibling validation
CI run 37602575492, attempt 1, has one failed root job (
checks-node-changed-2) and its downstream aggregate. Three unchanged worker chat-abort cases fail before provider entry. The independent unchanged-main run ata282f8002a381b87182e7765736d8ff7fd3efbfareproduces the shared failure (2 failed / 6 passed); the test and harness blobs match CI's main parent and tested merge. Main already contains the fixture repair in #166529 (5077ad4f99aa0677d089818aeda4f68ce347f16f). No CI rerun or branch refresh was used to chase green. All other selected CI jobs, security/dependency review, and exact-head ClawSweeper review passed.The additional sibling sweep selected 688 immediate test files across the five touched directories. Blacksmith Testbox leases
tbx_01m4awprsj8em23kwxb703bcsxandtbx_01m4b0kmp15hfhmbmgfya7vbnfrannode scripts/run-vitest.mjs <selected files>; infrastructure and synthetic E2E files used their explicit repository configs. Results: 682 files / 9,036 tests passed; 2 files / 15 tests failed; 3 benchmark files / 6 cases skipped. The credentialedsessions-create.visible-spawn.live.test.tswas excluded. All 99 Nostr/WhatsApp sibling files passed.The two local failures were investigated without hiding them:
chat-send-global-identity.test.ts, “config store changes after ACK”: admission is closed at persistence, line 698. The unchanged original basea6e31e2247ebdc477be43c8ba6b5e73bf6082928reproduces the same failure on the isolated Linux rig (1 failed / 22 passed); the test blob is identical.package-state-probes.test.ts: 14 mock-dependent cases returned actual catalog entries instead of the synthetic catalog. The unchanged file on the rig base failed 8 of 15 cases. A fresh Testbox archive of the same base passed the original 46-file channel batch (552 tests); a second comparison retained the original Testbox workspace/artifacts and reran the original five-project invocation with all 15 PR files temporarily replaced by exact base bytes, then restored them. It passed 144 files / 1,713 tests. The exact module/mock-retention cause remains unresolved; these passes are not a fix or proof that the original failure disappeared. The package-probe owner and test are unchanged, the status change adds no imports to their module graph, and the changed status test ran after the original failures. This remains a separately documented fixture investigation under the repository test-failure policy.No authenticated provider or production latency validation is claimed. Both Testbox baseline commands exited 0; the fresh-archive run reported a runner portal notification timeout after its successful command. The local Mac ran no heavy validation.