Skip to content

fix(cli): show live probe failures in health output - #117410

Merged
steipete merged 1 commit into
mainfrom
codex/autoqa-health-probe-precedence-20260801
Aug 1, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/autoqa-health-probe-precedence-20260801

Conversation

@steipete

@steipete steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Closes #117409

AI-assisted: yes.

What Problem This Solves

Fixes an issue where operators running openclaw health --verbose or openclaw status --deep could see a channel reported as healthy, configured, or linked even though the fresh active probe in the same Gateway snapshot failed. The same precedence bug hid a failed sibling account behind the selected account's passive healthy state.

Matrix exposes the regression directly: its sync monitor records healthState: "healthy" independently from its account probe. SMS and Zalouser exposed the older sibling cases through statusState: "configured" and linked: true.

Why This Change Was Made

The shared health-text formatter now orders facts by meaning instead of field position:

  1. Explicitly inactive, unconfigured, degraded, blocked, unlinked, or unstable-auth facts remain authoritative.
  2. Fresh probe failures and successes outrank only passive affirmative states.
  3. Healthy, linked, and configured values remain fallbacks when no live probe result exists.

Raw health JSON still records lifecycle and probe facts independently. This does not change probe execution, caching, protocol, configuration, persistence, or Plugin SDK contracts. Formatter tests moved into a dedicated module, shrinking the broader health-command test file from 743 to 648 lines.

User Impact

Verbose health and deep status now show the actionable live probe result instead of a stale/passive success label. Channel-specific failure states such as blocked, logged-out, conflict, and auth stabilizing remain visible, and ordinary non-probed output remains unchanged.

Evidence

  • Current-main reproduction: 7 new precedence cases failed while 32 controls passed. Observed examples were Matrix: healthy, SMS: configured, and Zalo User: linked instead of their distinct fresh probe errors.

  • Focused and sibling tests: 65/65 passed locally and 65/65 passed on Blacksmith Testbox tbx_01kyynm65xf29bsg18s28xmm03 (run 30700284352).

  • Scoped changed gate: fully green on the same Testbox, including core production/test types, changed-file lint/format, import cycles, dead-code scans, API/boundary/dependency guards, and database-first checks.

  • Full pnpm build: green on the same Testbox.

  • Built CLI black-box proof: dist/entry.js health --verbose sent {"probe":true}, exited 0 with empty stderr, and rendered five fixture-sensitive outcomes:

    Matrix: failed (unknown) - sync rejected
    SMS: failed (unknown) - credentials rejected
    Zalo User: failed (unknown) - session rejected
    Slack: blocked
    WhatsApp: auth stabilizing
    
  • Source-blind behavior validation: all five contract clauses and the varied-fixture anti-cheat check passed.

  • Fresh Codex autoreview: clean, no P0/P1 findings, overall patch-correct confidence 0.96.

  • Production delta: line-neutral (+36/-36); total PR delta +232/-131 across three files.

Regression provenance: #117300 added the unconditional healthState early return while preserving authored lifecycle facts. This repair keeps that ownership decision and corrects only the text projection precedence.

@openclaw-barnacle openclaw-barnacle Bot added the commands Command implementations label Aug 1, 2026
@steipete
steipete marked this pull request as ready for review August 1, 2026 12:57
@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Aug 1, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 9:04 AM ET / 13:04 UTC.

ClawSweeper review

What this changes

This PR changes the shared health-output formatter so live channel probe successes and failures appear before passive healthy, configured, or linked status fallbacks.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this active PR for human merge review: current main still returns passive healthState, statusState, or linked text before inspecting the fresh probe, while this focused patch moves only affirmative passive states behind probe rendering. The patch is coherent, adds the relevant precedence coverage, and the supplied built-CLI transcript is sufficient real-behavior proof; the maintainer label prevents automated cleanup.

Priority: P2
Reviewed head: ddd242f3a4edb8871a7f82b34cb39f2c78b9f767

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused owner-layer repair with direct CLI evidence, targeted regression cases, and no concrete correctness or security finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body includes an after-fix built-CLI terminal transcript for five fixture-sensitive channel outcomes, and the supplied GitHub check context records successful real-behavior proof.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body includes an after-fix built-CLI terminal transcript for five fixture-sensitive channel outcomes, and the supplied GitHub check context records successful real-behavior proof.
Evidence reviewed 6 items Current-main defect: Current main returns any non-empty healthState, then statusState, then linked before reaching the later failed-probe formatting branch, so affirmative passive facts can mask a present fresh failure.
Patch repairs the formatter owner: The PR keeps explicit inactive and negative states authoritative, evaluates failed account probes before passive affirmative fallbacks, and preserves the existing per-account timing path.
Regression coverage: The added formatter tests cover failed and successful fresh probes over passive states, authoritative negative states, and a failed sibling account while retaining existing formatter cases.
Findings None None.
Security None None.

How this fits together

Gateway health collection preserves channel account facts and probe results in one snapshot, and the CLI formatter turns that snapshot into operator-facing health and deep-status lines. The formatter is used by both openclaw health and the status report path, so its precedence determines which channel diagnosis an operator sees.

flowchart LR
  A[Channel runtime facts] --> C[Gateway health snapshot]
  B[Fresh account probes] --> C
  C --> D[Health text formatter]
  D --> E[Verbose health command]
  D --> F[Deep status report]
  E --> G[Operator diagnosis]
  F --> G
Loading

Before merge

  • Resolve merge risk (P1) - GitHub reports the branch as cleanly mergeable but behind current main, and several checks are still running; refresh the merge result and required checks on the exact head before human merge.
  • Complete next step (P2) - The patch has no discrete automated repair remaining, but the maintainer label and pending refresh/check state require a human merge decision.
Agent review details

Security

None.

PR surface

Source 0, Tests +101. Total +101 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 36 36 0
Tests 2 196 95 +101
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 232 131 +101

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #117409
Summary: This PR is the focused candidate repair for the health-output regression tracked by the canonical issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the repair in the shared formatter, retain the precedence matrix and built-CLI proof, then refresh the branch against current main and merge after the human owner confirms the remaining checks.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the repair in the shared formatter, retain the precedence matrix and built-CLI proof, then refresh the branch against current main and merge after the human owner confirms the remaining checks.

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

Yes, source-reproducible: a snapshot containing an affirmative passive field and probe.ok: false follows current-main early returns before the failed-probe branch. The PR supplies the focused fixture matrix and an after-fix built-CLI transcript; this read-only review did not execute the test suite.

Is this the best way to solve the issue?

Yes. The shared formatter is the narrow owner because raw Gateway snapshots already preserve both probe and lifecycle facts, and both reported CLI surfaces consume this formatter. Changing collectors or channel plugins would duplicate presentation policy and risk changing unrelated health behavior.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: The PR fixes deterministic but bounded operator diagnostic output that can hide a channel’s actionable live probe failure.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes an after-fix built-CLI terminal transcript for five fixture-sensitive channel outcomes, and the supplied GitHub check context records successful real-behavior proof.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes an after-fix built-CLI terminal transcript for five fixture-sensitive channel outcomes, and the supplied GitHub check context records successful real-behavior proof.

Label justifications:

  • P2: The PR fixes deterministic but bounded operator diagnostic output that can hide a channel’s actionable live probe failure.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes an after-fix built-CLI terminal transcript for five fixture-sensitive channel outcomes, and the supplied GitHub check context records successful real-behavior proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes an after-fix built-CLI terminal transcript for five fixture-sensitive channel outcomes, and the supplied GitHub check context records successful real-behavior proof.

Evidence

What I checked:

  • Current-main defect: Current main returns any non-empty healthState, then statusState, then linked before reaching the later failed-probe formatting branch, so affirmative passive facts can mask a present fresh failure. (src/commands/health-format.ts:189, fb9c8e74e619)
  • Patch repairs the formatter owner: The PR keeps explicit inactive and negative states authoritative, evaluates failed account probes before passive affirmative fallbacks, and preserves the existing per-account timing path. (src/commands/health-format.ts:202, ddd242f3a4ed)
  • Regression coverage: The added formatter tests cover failed and successful fresh probes over passive states, authoritative negative states, and a failed sibling account while retaining existing formatter cases. (src/commands/health-format.test.ts:70, ddd242f3a4ed)
  • Caller coverage: The shared formatter feeds the health command and is injected into status-report construction, so repairing it covers both reported operator surfaces without changing probe collection or snapshot contracts. (src/commands/health.ts:388, fb9c8e74e619)
  • Regression provenance: The current formatter behavior dates to the merged lifecycle-state change, which is the linked regression provenance; no later current-main commit touching this formatter was found after that merge. (src/commands/health-format.ts:189, aa2a5c96f69a)
  • Real behavior proof: The PR body reports a built dist/entry.js health --verbose run with five distinct after-fix channel outcomes, and the supplied check context records the Real behavior proof check as successful. (ddd242f3a4ed)

Likely related people:

  • steipete: Peter Steinberger authored the merged lifecycle-state change that introduced the current formatter ordering and has the strongest recent history on this command path. (role: recent formatter and lifecycle-state contributor; confidence: high; commits: aa2a5c96f69a, 02419ed1998f; files: src/commands/health-format.ts, src/gateway/health/collector.ts)
  • mcaxtr: Marcus Castro has historical work on WhatsApp health/auth state, an owner-authored state family whose diagnostic labels this formatter must preserve. (role: adjacent channel-health contributor; confidence: medium; commits: aa76cf43f011; files: extensions/whatsapp/src/auto-reply/monitor-state.ts, extensions/whatsapp/src/channel.ts)

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

Land-ready proof is complete for head ddd242f3a4edb8871a7f82b34cb39f2c78b9f767.

  • Current-main reproduction: 7/40 new precedence cases failed before the fix while the negative-state controls passed.
  • Focused proof: node scripts/run-vitest.mjs src/commands/health-format.test.ts src/commands/health.test.ts src/commands/health.snapshot.test.ts src/commands/status.command-sections.test.ts passed 65/65 locally and on Blacksmith Testbox tbx_01kyynm65xf29bsg18s28xmm03 (run 30700284352).
  • The scoped core, coreTests changed gate and full pnpm build passed on the same Testbox.
  • Built-CLI proof sent { "probe": true }, exited 0 with empty stderr, surfaced distinct Matrix/SMS/Zalo failures, and preserved Slack blocked plus WhatsApp auth stabilizing.
  • Source-blind behavior validation passed all five clauses and the varied-fixture anti-cheat check.
  • Fresh Codex autoreview returned no P0/P1 findings at 0.96 confidence.
  • Exact-head hosted CI run 30700746486 completed successfully, including openclaw/ci-gate.
  • ClawSweeper found no code/security issue, marked proof sufficient, rated the PR 5/6, and agreed the shared formatter is the best owner boundary.

ClawSweeper's remaining merge-risk move is satisfied without a branch rewrite: GitHub reports the head cleanly mergeable, exact-head CI is green, and repository-native prepare will verify the current three-way merge. Behind-main drift is advisory under the maintainer workflow. The explicit maintainer decision is to land this low-risk text-projection fix; raw snapshots, probe execution, protocol, config, persistence, and Plugin SDK remain unchanged.

@steipete
steipete merged commit 2576d84 into main Aug 1, 2026
187 of 195 checks passed
@steipete
steipete deleted the codex/autoqa-health-probe-precedence-20260801 branch August 1, 2026 13:12
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: M 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.

Health text hides live probe failures behind passive channel state

1 participant