Skip to content

feat(ui): add reactive OpenClaw health nudges - #110708

Merged
steipete merged 5 commits into
mainfrom
claude/custodian-presence-pr2
Jul 18, 2026
Merged

steipete merged 5 commits into
mainfrom
claude/custodian-presence-pr2

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

The permanent OpenClaw custodian page was passive when a consequential system problem arrived. Operators had to notice the failure elsewhere and manually decide what to ask, while routine Gateway traffic made a broad reactive assistant too noisy.

Why This Change Was Made

This adds one restrained, dismissible nudge per normal custodian-page visit. Only consequential health snapshots qualify: configuration hot-reload disabled, configured/enabled channel credentials unavailable, explicit channel errors or failed probes, terminal disconnects, active channel disconnects, and the concrete degraded lifecycle states disconnected, stale-socket, and stuck. Routine events such as config.changed, disabled accounts, and intentionally stopped channels remain silent. Higher-severity failures may replace a pending chip; dismissal or use silences the visit. Gateway identity changes clear a pending chip so it cannot cross operators or servers.

Clicking the chip sends a canonical diagnosis question through the existing openclaw.chat path and records it as a real user transcript message. Onboarding mode never subscribes visibly to these nudges.

AI-assisted by Codex. No changelog edit per the phase work order.

Phase 6 server study / bounded follow-up proposal

The server deliverable was studied but intentionally stopped at the work order's depth gate:

  • Inbound /openclaw handling already enters src/auto-reply/reply/commands-system-agent.ts; existing commands use deterministic rescue via src/system-agent/rescue-message.ts.
  • A conversational /openclaw ask <request> can be routed there to openclaw.chat with the existing host-owned delegation fields from src/gateway/server-methods/system-agent.ts, and the normal reply pipeline preserves the source thread.
  • The hard agent-down seam is the final generic external failure in src/auto-reply/reply/agent-runner-error-handler.ts.
  • A safe fallback cannot be only a bounded reply hook: cancellation must reach the underlying in-process openclaw.chat inference. Today SystemAgentChatEngine.handle and the system-agent turn runner do not own an AbortSignal; merely racing the Gateway promise leaves inference running and can mutate a stable delegation session after the source turn was stopped.

Proposed follow-up: add turn-owned cancellation from openclaw.chat through the system-agent session queue, SystemAgentChatEngine.handle, and the embedded/CLI system-agent turn. Then add /openclaw ask <request> with source delegation, and invoke one disposable/cancellable diagnosis from the final generic channel failure. The returned copy must direct the user to the routable command, for example Ask me to fix it with /openclaw ask fix it, and reserved system-agent IDs must bypass the fallback to prevent loops.

User Impact

Operators can notice one meaningful health incident while already talking to OpenClaw and ask for diagnosis with one click, without fake assistant transcript content or recurring Clippy-style prompts.

Evidence

  • Unit: node scripts/run-vitest.mjs ui/src/pages/custodian/custodian-page.test.ts — 27 passed.
  • Mocked Gateway browser E2E: consequential event -> one chip -> real second openclaw.chat request; routine events and onboarding stay silent — 2 passed.
  • Source-blind behavior contract: 5 observable clauses passed; anti-cheat probes verified the real Gateway request, once-per-visit silence, routine-event silence, and onboarding isolation.
  • Visual proof captured locally: before event, disconnect chip, real-message transcript, plus browser video. Sanitized synthetic fixtures only; images will be attached to this PR.
  • Exact-head heavy gates on Blacksmith Testbox: pnpm tsgo, pnpm tsgo:ui, pnpm check:test-types, targeted oxlint, pnpm deadcode:exports (0), i18n baseline/verify, docs MDX, format check, and git diff --check all passed. Testbox hydration run.
  • Fresh branch autoreview: clean, no accepted/actionable findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: L maintainer Maintainer-authored PR labels Jul 18, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 56592bd652

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +18 to +24
const CHANNEL_AUTH_STATUS_KEYS = [
"tokenStatus",
"botTokenStatus",
"appTokenStatus",
"signingSecretStatus",
"userTokenStatus",
] as const;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include API credential status in auth nudges

When a Nextcloud Talk account has its bot secret available but apiPasswordFile is unreadable, the health snapshot carries apiCredentialStatus: "configured_unavailable" from extensions/nextcloud-talk/src/accounts.ts, and the probe skips with ok: true when API credentials cannot resolve in extensions/nextcloud-talk/src/bot-preflight.ts. Because this allowlist only checks token/bot/app/signing/user credential keys, classifyCustodianEventNudge treats that configured channel as healthy and never shows the promised unavailable-credentials nudge; include apiCredentialStatus or scan *Status credential fields for configured_unavailable.

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the claude/custodian-presence-pr2 branch from 56592bd to 7f58fb8 Compare July 18, 2026 13:49

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7f58fb859c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +74 to +77
private readonly eventSubscriptions = new SubscriptionsController(this).effect(
() => this.context?.gateway,
(gateway) =>
gateway.subscribeEvents((event) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Process cached hello health snapshots

When the OpenClaw page is opened after the Gateway has already cached a bad health snapshot, this subscription only sees future health events. The Gateway includes the current cached health in the hello snapshot (connect-hello.ts fills snapshot.health from getHealthCache()), and the UI stores that hello, but no event is replayed for it; the next broadcast comes from the 60s maintenance refresh. In that common case the promised event chip stays absent for up to a minute even though the page already has the failing snapshot available.

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the claude/custodian-presence-pr2 branch from 7f58fb8 to 50f5e1c Compare July 18, 2026 14:12

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 50f5e1c633

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +377 to +378
${!this.onboarding && this.eventNudge
? html`<div class="custodian__nudge" role="status">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the nudge visible in scrolled conversations

When the custodian transcript is long enough for .custodian__messages to scroll (ui/src/styles/custodian.css:57-63), this renders the chip as the first child while updated() only scrolls on messages changes. A health event that arrives while the user is at the bottom sets eventNudge without changing messages, so the new chip is inserted above the viewport and the operator sees no prompt; render it outside/sticky or after the transcript.

Useful? React with 👍 / 👎.

@steipete

Copy link
Copy Markdown
Contributor Author

UI screenshots (e2e captures, fixture data only — sanitized):

Before event — custodian page, normal chrome, no nudge:
before event

Consequential event (Telegram disconnect) → single dismissible nudge chip:
disconnected nudge

Chip click sends a real message ("what happened with telegram?") — transcript stays honest:
message sent

@steipete steipete self-assigned this Jul 18, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: abc64d8732

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -128,6 +145,7 @@ export class CustodianPage extends OpenClawLightDomElement {
if (scopeChanged) {
this.sessionScopeKey = scopeKey;
this.sessionStarted = false;
this.eventNudge = null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reset nudge dismissal when the gateway scope changes

When an operator dismisses or uses a nudge and the same mounted custodian page then switches Gateway URL/credentials/device token, this branch clears only the pending chip while leaving eventNudgeClosed true; the event subscription then returns before classifying every future health event. Because this same scope-change path already treats the new connection as a different operator/server and clears the transcript, the new scope silently inherits the old dismissal and will not see any health nudges until the page is reloaded or remounted.

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the claude/custodian-presence-pr2 branch from abc64d8 to dea5b1b Compare July 18, 2026 14:37
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Jul 18, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dea5b1b076

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

message: `what happened with ${canonical}?`,
};
}
if (account.connected === false && account.running === true) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor channel startup grace before nudging

When a channel has just started but has not connected within the first 120s grace window, evaluateChannelHealth returns healthy startup-connect-grace (src/gateway/channel-health-policy.ts:109-112), so getHealthSnapshot leaves healthState unset (src/commands/health.ts:674-681) while still carrying running: true/connected: false. This branch treats that normal startup snapshot as a disconnect nudge, so opening the custodian during a channel startup/restart prompts the operator to diagnose a healthy channel; gate this on a reported failure state or mirror the startup-grace check.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added the rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. label Jul 18, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Landing verification at exact head dea5b1b07667ae850e4e414709e5e570b71cb786:

  • Focused proof after the final rebase: node scripts/run-vitest.mjs ui/src/pages/custodian/custodian-page.test.ts ui/src/pages/custodian/route.test.ts ui/src/e2e/custodian-event-nudge.e2e.test.ts — 33 UI tests and 2 Chromium E2E tests passed.
  • Fresh final-head branch autoreview: clean; no accepted/actionable findings.
  • Exact-head CI: run 29648386769, terminal openclaw/ci-gate job 88090691279 successful, zero failed jobs.
  • Visual proof: three sanitized before/event/message captures.
  • Review artifacts validate as READY FOR /prepare-pr, with zero findings.

Known scoped stop: channel summon/agent-down fallback did not ship because the work order's depth gate triggered; the PR body records the cancellation prerequisite and bounded follow-up proposal.

@steipete
steipete merged commit a115af2 into main Jul 18, 2026
115 of 119 checks passed
@steipete
steipete deleted the claude/custodian-presence-pr2 branch July 18, 2026 14:44
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 19, 2026
* feat(ui): add reactive custodian health nudges

* fix(ui): distinguish stopped channels from startup failures

* test(ui): update custodian route gateway fixture

* fix(ui): preserve current channel health failures

* fix(ui): ignore recovered channel errors
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
* feat(ui): add reactive custodian health nudges

* fix(ui): distinguish stopped channels from startup failures

* test(ui): update custodian route gateway fixture

* fix(ui): preserve current channel health failures

* fix(ui): ignore recovered channel errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation maintainer Maintainer-authored PR proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant