Skip to content

fix(plugin-sdk): project recorded health facts through computed account status - #117236

Merged
steipete merged 2 commits into
mainfrom
fix/status-projection-fix
Aug 1, 2026
Merged

steipete merged 2 commits into
mainfrom
fix/status-projection-fix

Conversation

@steipete

@steipete steipete commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Channels that use the computed account-status adapter (createComputedAccountStatusAdapter / buildRuntimeAccountStatusSnapshot in src/plugin-sdk/status-helpers.ts) silently lose recorded health facts during projection. The projection allowlists omit ingressUnavailable, busy, activeRuns, lastRunActivityAt, and activeRunStartedAt, so:

  • channels.status, openclaw doctor, and CLI health evaluate channel health against a snapshot that can never carry ingressUnavailable — the operator-facing "Channel cannot admit inbound events" diagnostic in src/infra/channels-status-issues.ts is unreachable for every adapter-based channel (Slack, Discord, Telegram, and most others).
  • The busy/stuck inputs to evaluateChannelHealth (src/gateway/channel-health-policy.ts) are also dropped, so busy-state is invisible on the same surfaces.

The raw runtime store keeps these facts (health monitor and /readyz see them); only the operator-visible projection went blind. Silent divergence between surfaces reading "the same" snapshot is the worst-severity class per repo doctrine: recorded facts must survive to where they are read.

Why This Change Was Made

The fix belongs at the projection boundary, not in consumers: RuntimeLifecycleSnapshot and buildRuntimeAccountStatusSnapshot are the single seam every computed adapter funnels through. Adding the missing fields there fixes all adapter-based channels at once with an additive, backward-compatible change. ingressUnavailable keeps its deliberate optional-true semantics (absence means unknown, never healthy).

User Impact

Operators now see dead-ingress and busy state in channels status, openclaw doctor, and the channels.status RPC for all channels with computed status adapters. Previously these conditions were only visible to the internal health monitor, which could restart a channel for a reason no status surface ever displayed.

Evidence

  • node scripts/run-vitest.mjs src/plugin-sdk/status-helpers.test.ts — 24/24 pass (verified independently by reviewer session), including a new end-to-end assertion that a projected snapshot with ingressUnavailable: true yields evaluateChannelHealth → { healthy: false, reason: "ingress-unavailable" }.
  • pnpm plugin-sdk:surface:check — clean, no baseline changes.
  • Structured autoreview (Codex, gpt-5.6-sol, high): clean, no actionable findings.
  • Prod diff is +15 LOC, purely additive to the two projection sites; test diff +39.

Note for reviewers: the end-to-end test imports evaluateChannelHealth from src/gateway/ into a plugin-sdk test file. Placement follows "test where the bug lived" (the projection); flagging the cross-area import explicitly rather than hiding it.

🤖 Generated with Claude Code

Runtime proof (added post-review)

Redacted terminal transcript through the built dist adapter (createComputedAccountStatusAdapter from an integration build containing this PR): a runtime row recorded as the gateway records failed ingress projects ingressUnavailable + run-state facts into the operator-visible snapshot, and evaluateChannelHealth on that projected snapshot returns {"healthy":false,"reason":"ingress-unavailable"} — structurally impossible on current main. Full transcript: #117236 (comment)

Live ephemeral gateway on the same integration build: boots clean, /readyz ready, 3 plugins in 1.0s, clean 44ms shutdown.

@steipete
steipete marked this pull request as ready for review August 1, 2026 05:33
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 1, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 1, 2026
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Aug 1, 2026
@clawsweeper clawsweeper Bot added the P2 Normal backlog priority with limited blast radius. label Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 1, 2026, 1:44 AM ET / 05:44 UTC.

ClawSweeper review

What this changes

The PR forwards recorded ingress and run-health facts through computed channel account-status snapshots and adds regression coverage for the resulting channel-health evaluation.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 4 items remain

Keep this active, protected-label PR open. Current main drops health facts that already exist in the shared account-snapshot contract when a channel uses a computed status adapter; the proposed projection-boundary repair is sound, but it still needs redacted after-fix operator-visible proof before merge.

Priority: P2
Reviewed head: c3aa0150d2789c9d13304f0d1b720689fab61657

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The implementation is focused and source-supported, but real behavior proof remains a merge gate.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR body supplies focused tests and CI claims, but no redacted after-fix channels status, openclaw doctor, or runtime diagnostic output showing the repaired operator-visible behavior. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body supplies focused tests and CI claims, but no redacted after-fix channels status, openclaw doctor, or runtime diagnostic output showing the repaired operator-visible behavior. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 8 items Current-main projection omits health facts: RuntimeLifecycleSnapshot and buildRuntimeAccountStatusSnapshot carry connectivity fields but omit ingress-unavailable and run-state facts, even though the latter are available on the runtime snapshot contract.
Shared snapshot contract already owns the fields: The channel account snapshot type already defines ingressUnavailable, busy, activeRuns, lastRunActivityAt, and activeRunStartedAt; the computed-adapter projection is the missing owner-boundary handoff.
Computed adapter output is the operator-status input: Status construction calls a plugin's buildAccountSnapshot when present, instead of the generic safe-field projection, so an omission in the helper reaches all computed-adapter consumers.
Findings None None.
Security None None.

How this fits together

Channel runtimes record lifecycle and health facts in account snapshots. Computed plugin status adapters transform those facts into the snapshots consumed by channel health policy, CLI status, doctor, and gateway diagnostics.

flowchart LR
  A[Channel runtime lifecycle facts] --> B[Computed status adapter]
  B --> C[Account status snapshot]
  C --> D[Channel health policy]
  D --> E[CLI, doctor, and RPC diagnostics]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body supplies focused tests and CI claims, but no redacted after-fix channels status, openclaw doctor, or runtime diagnostic output showing the repaired operator-visible behavior. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - The PR changes the generated public plugin-SDK declaration surface by adding five optional status fields; it is additive, but the final review should confirm the exact head’s API-baseline and package checks.
  • Resolve merge risk (P1) - No redacted after-fix operator-visible run currently proves that a computed-adapter channel reports the expected channels status or doctor diagnostic rather than only satisfying unit tests.
  • Complete next step (P2) - This active PR has the protected maintainer label and no mechanical defect to dispatch; retain human review while the contributor supplies the required real operator-visible proof.
Agent review details

Security

None.

PR surface

Source +15, Tests +39, Generated 0. Total +54 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 15 0 +15
Tests 1 39 0 +39
Docs 0 0 0 0
Config 0 0 0 0
Generated 1 3 3 0
Other 0 0 0 0
Total 3 57 3 +54

Review metrics

Metric Value Why it matters
Public SDK status contract 5 optional lifecycle fields added The generated API baseline changes because computed status snapshots now expose five existing runtime health facts to plugin and operator consumers.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep one canonical projection in src/plugin-sdk/status-helpers.ts, merge the additive forwarding fields after a redacted real channel-status or doctor transcript proves an ingress-unavailable or busy/stuck result reaches the operator surface.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep one canonical projection in src/plugin-sdk/status-helpers.ts, merge the additive forwarding fields after a redacted real channel-status or doctor transcript proves an ingress-unavailable or busy/stuck result reaches the operator surface.

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

Yes, source-reproducible: current main defines the health facts on ChannelAccountSnapshot, routes computed adapter output into status construction, and evaluates those facts in channel health policy, while the helper projection omits them.

Is this the best way to solve the issue?

Yes: forwarding the already-recorded facts at the single computed-adapter projection boundary is preferable to adding downstream consumer exceptions and preserves the existing canonical health-policy flow.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 6922ddd93610.

Labels

Label changes:

  • add P2: The patch repairs operator-facing channel-health diagnostics with a bounded shared-SDK blast radius, but available evidence does not establish an active user outage.

Label justifications:

  • P2: The patch repairs operator-facing channel-health diagnostics with a bounded shared-SDK blast radius, but available evidence does not establish an active user outage.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body supplies focused tests and CI claims, but no redacted after-fix channels status, openclaw doctor, or runtime diagnostic output showing the repaired operator-visible behavior. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Current-main projection omits health facts: RuntimeLifecycleSnapshot and buildRuntimeAccountStatusSnapshot carry connectivity fields but omit ingress-unavailable and run-state facts, even though the latter are available on the runtime snapshot contract. (src/plugin-sdk/status-helpers.ts:27, 6922ddd93610)
  • Shared snapshot contract already owns the fields: The channel account snapshot type already defines ingressUnavailable, busy, activeRuns, lastRunActivityAt, and activeRunStartedAt; the computed-adapter projection is the missing owner-boundary handoff. (src/channels/plugins/types.core.ts:176, 6922ddd93610)
  • Computed adapter output is the operator-status input: Status construction calls a plugin's buildAccountSnapshot when present, instead of the generic safe-field projection, so an omission in the helper reaches all computed-adapter consumers. (src/channels/plugins/status.ts:33, 6922ddd93610)
  • Dropped fields affect real health decisions: The shared health policy directly evaluates ingress availability and busy/run timestamps; missing those values can suppress ingress-unavailable and stuck/busy outcomes. (src/gateway/channel-health-policy.ts:80, 6922ddd93610)
  • Operator diagnostics use the shared health policy: Channel status issue collection derives generic operator-visible warnings from evaluateChannelHealth, confirming the projected snapshot is the correct repair boundary rather than a consumer-specific workaround. (src/infra/channels-status-issues.ts:55, 6922ddd93610)
  • Feature provenance: Blame ties both the current helper projection and health-policy busy logic to the recent authoritative status work introduced by commit 90ae3c253f; the proposed repair completes that same status handoff. (src/plugin-sdk/status-helpers.ts:400, 90ae3c253f59)

Likely related people:

  • steipete: Current-main blame attributes the computed status helper and the related health-policy logic to Peter Steinberger, and the supplied PR metadata maps the same contributor to steipete. (role: feature introducer and recent area contributor; confidence: high; commits: 90ae3c253f59, beb2b7c3a6a4, c3aa0150d278; files: src/plugin-sdk/status-helpers.ts, src/gateway/channel-health-policy.ts, src/channels/plugins/status.ts)

Rank-up moves

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

  • Attach a redacted terminal transcript from a computed-adapter channel showing channels status or openclaw doctor report the repaired ingress-unavailable or busy/stuck condition.
  • Refresh the public SDK baseline and package checks on the final rebased head if current CI does not complete before merge.

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.

@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Runtime proof: recorded health facts now reach the operator-visible surface (redacted transcript)

Real-behavior proof per review: the built dist from an integration build containing this PR (dist/plugin-sdk/status-helpers.js) was driven through the real createComputedAccountStatusAdapter — the exact projection every computed-adapter channel funnels through for channels.status, doctor, and CLI health — with a runtime row recorded the way src/gateway/server-channels.ts records a failed ingress start (running + connected + ingressUnavailable: true, plus active-run facts).

Terminal transcript:

operator-visible snapshot (channels.status projection):
{
  "enabled": true,
  "lastStartAt": 1753900000000,
  ...
  "ingressUnavailable": true,
  "busy": true,
  "activeRuns": 1,
  "lastRunActivityAt": 1753900020000,
  "activeRunStartedAt": 1753900015000,
  ...
  "running": true,
  "connected": true
}
evaluateChannelHealth on the projected snapshot: {"healthy":false,"reason":"ingress-unavailable"}
ingressUnavailable survived projection: YES
busy/run facts survived projection   : YES

On current main, this same path drops ingressUnavailable and all four run-state fields, so evaluateChannelHealth on the projected snapshot can never return ingress-unavailable — the operator diagnostic in src/infra/channels-status-issues.ts was unreachable for every computed-adapter channel. After the fix, the recorded fact reaches the verdict.

Supporting live-runtime evidence from the same integration build: ephemeral gateway (isolated state dir, loopback) boots clean, /readyz → {"ready":true,"failing":[]}, 3 plugins in 1.0s, clean 44ms shutdown.

🤖 Generated with Claude Code

@steipete
steipete merged commit 0cd33ba into main Aug 1, 2026
131 of 133 checks passed
@steipete
steipete deleted the fix/status-projection-fix branch August 1, 2026 05:52
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 1, 2026
…nt status (openclaw#117236)

* fix(plugin-sdk): project recorded health facts through computed account status

* fix(plugin-sdk): regenerate API baseline and pin ingressUnavailable literal in test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant