Skip to content

fix(update): avoid false restart failures after authentication rejection - #175735

Merged
steipete merged 1 commit into
mainfrom
upd/upd-l1675
Oct 17, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/upd-l1675

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Updates can wait 30 minutes and report failure when the restarted Gateway rejects the retained CLI's health credentials, even while serving normally.

User Impact

The updated verifier can confirm local readiness and runtime identity after an authentication refusal, recording a warning instead of a false update failure. It does not change Gateway authentication or pairing, and cannot retrofit an already-running v2026.10.2 updater.

Why This Change Was Made

The restart-health owner now classifies correlated authentication refusals, recognized policy-close reasons, and local missing-credential failures as terminal authentication facts. Non-strict update verification with an expected version can use the existing direct-loopback /startupz and /readyz contracts instead. Startup details now include the running build ID so existing version/build checks remain authoritative. Successful HTTP verification records an RPC authentication warning through the existing update ledger; unavailable readiness or mismatched identity cannot become success.

Gateway authentication and pairing are unchanged. Strict plugin/channel health checks still require their RPC result. The relevant admission helpers are identical between v2026.10.2 and v2026.10.4; the report does not establish an admission regression or specify the effective credentials.

Fixes #175712.

Evidence

  • Consumer coverage selected all 68 test files importing the changed owners (including the existing restart-health barrel), in discovery order: 67 files / 1,540 tests passed across the completed Gateway, focused, and remaining-consumer batches. One Linux-only file and 15 Linux-only cases were skipped by their existing platform guards on macOS. The remaining-consumer batch finished 5 shards in 1110.6s.

  • All five new rejection/readiness/build cases fail against the original restart-health implementation with timeout, then pass with this change. The simulated 30-minute budget completes without a retry after a deterministic rejection.

  • Focused proof: node scripts/run-vitest.mjs src/cli/daemon-cli/restart-health-probe.test.ts src/cli/daemon-cli/restart-health-client.test.ts src/cli/update-cli/update-command-verification-report.test.ts src/cli/update-cli/update-command-verification-channels.test.ts --maxWorkers=1 — 4 files, 34 tests passed. This includes socket-level local token/password/auth-none/paired-device contracts and successful ledger verification with a retained authentication warning.

  • Live proof used an isolated HOME/state directory, a free loopback port, and the built package launcher (node openclaw.mjs gateway run --port <port> --bind loopback --auth token --allow-unconfigured). A protocol-4, v2026.10.2-style CLI without device identity received 1008 device identity required; the updated verifier used local readiness and recovered the running version/build in about 4.2 seconds. A stale-token WebSocket rejection also fell back successfully; a device-less valid-token CLI probe succeeded directly. The test-owned Gateway shut down cleanly.

  • node --import ./scripts/tsx.mjs scripts/build-all.mts passed (3m55s cold build; declaration generation 1m59s). Runtime preparation after the final edit also passed (1m06s).

  • Independent Codex autoreview: no actionable P0–P2 findings after the final change.

  • Core tsgo, scoped oxlint, changed-file oxfmt, git diff --check, and the madge import-cycle check passed (0 cycles). The full check:changed SQLite inventory was omitted under the campaign's local gate budget; PR CI supplies broad checks.

  • Existing slow consumer coverage: update-command-database-rollback.test.ts (13 cases, 141.3s test time), update-command-original-service.test.ts (48 cases, 158.3s), and update-command-lease.test.ts (54 cases, 144.5s). These exercise fresh database/update/backup/service-recovery fixtures per case; no timeouts, retries, or assertions were relaxed. The new rejection cases take 2–8ms each.

Limits

Live proof was on macOS, not an npm-global Ubuntu/systemd installation. It establishes the reported wire rejection and both fallback paths, but not the reporter's unspecified credential/profile mismatch. No configuration, CLI options, dependencies, or SQLite schemas changed.

Production LOC: +83/-13; tests: +105/-1; docs: +5/-0. The added production code carries the authentication fact through the existing restart owner and reuses the existing local HTTP probe and warning ledger.

Stop retrying deterministic restart health authentication failures. Verify local HTTP readiness and runtime identity when the update probe cannot authenticate, and preserve the rejection as a warning without changing Gateway admission.

Fixes #175712.
@clawsweeper

clawsweeper Bot commented Oct 17, 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.

@steipete
steipete marked this pull request as ready for review October 17, 2026 17:45
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T17:49:09.317106Z 6bdd706 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime cli CLI command changes size: M labels Oct 17, 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: 6bdd706cdb

ℹ️ 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 +324 to +325
if (snapshot.authenticationError) {
return withWaitContext(snapshot, "auth-rejected", elapsedMs);

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.

P1 Badge Keep polling HTTP readiness after RPC rejection

When RPC authentication is rejected and /startupz reports started but the first /readyz sample is temporarily 503, confirmGatewayReachable leaves authenticationError set with healthy=false, so this branch exits after that single sample. observeUpdateGatewayReadiness subsequently treats auth-rejected as terminal and never reaches its existing HTTP readiness polling loop; a channel startup, plugin reload, or readiness-cache transition can therefore make a healthy updated Gateway be reported as failed and enter recovery. Stop retrying the rejected RPC, but continue polling local HTTP readiness and identity within the existing deadline.

AGENTS.md reference: AGENTS.md:L83-L83

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 17, 2026
@clawsweeper

clawsweeper Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR lets update verification use local HTTP readiness and runtime identity after RPC authentication fails, preserving the rejection as a warning.

Example: A verifier targeting Gateway 2026.10.4 receives WebSocket close 1008 with “device identity required.”

  • Before: Verification repeatedly retries the rejected RPC and can exhaust the update deadline.
  • After: Matching local startup identity and successful readiness checks allow verification to succeed with an authentication warning.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) Useful direction with focused regression coverage and reported live verification, but premature readiness failure blocks merge.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; its body reports an isolated built-launcher Gateway exercising authentication rejection and HTTP identity recovery, without attached raw output or a full published-driver upgrade.
Patch quality 🧂 unranked krab (1/6) 2 actionable review findings remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An otherwise serving Gateway can leave an update marked failed because its retained verifier cannot authenticate.
Reason: The maintainer-authored direction reuses existing local diagnostic contracts without adding configuration or weakening Gateway admission.

Merge readiness

⛔ Needs changes before merge - 3 items remain

Keep this PR open: the maintainer-approved repair addresses a real verification failure, but its new terminal authentication outcome can reject a Gateway that is still becoming ready.

Priority: P2
Reviewed head: 6bdd706cdb1be52d8e6313c45c3d1f2d6cfd90c7

Before merge

  • Continue HTTP readiness polling after authentication rejection (P1) - When the RPC is rejected and the first /readyz response is 503, confirmGatewayReachable retains authenticationError with reachable=false. This branch immediately returns auth-rejected, and observeUpdateGatewayReadiness exits before its HTTP polling loop. A temporary plugin reload, startup transition, or cached unready result therefore fails verification and can enter recovery even when the same process becomes ready within its allowance. Stop retrying the rejected RPC, but continue HTTP startup/readiness and identity observation until success, a definitive mismatch, or the existing deadline; update the new ready=false case that currently requires immediate rejection.
  • Render the new authentication outcome explicitly (P3) - The new auth-rejected outcome also reaches ordinary gateway start/restart callers, but formatGatewayRestartFailure has no matching case. An immediate device-required or missing-credentials rejection therefore falls through to “Gateway restart timed out” despite no deadline expiring. Add an authentication-specific diagnostic with the appropriate recovery action so operators can distinguish rejected credentials from slow startup.
  • Explain or restore the original intent of Startup and readiness waiting - 14e26a3: Recover startup under load and distinguish startup from readiness; the new terminal branch inadvertently bypasses the existing readiness allowance.

Findings

  • [P1] Continue HTTP readiness polling after authentication rejection — src/cli/daemon-cli/restart-health.ts:324-325
  • [P3] Render the new authentication outcome explicitly — src/cli/daemon-cli/restart-health.types.ts:8

Provenance

  • Startup and readiness waiting changes intended behavior without addressing why it exists (14e26a3: Recover startup under load and distinguish startup from readiness; the new terminal branch inadvertently bypasses the existing readiness allowance.)

Tests

  • Missing end-to-end proof: The supplied live scenario does not exercise an initial startup/readiness 503 followed by successful readiness within the existing deadline.
Agent review details

How this fits together

The restart-health owner combines native service state, listener ownership, Gateway identity, and health observations; update verification consumes that snapshot to record success, warnings, or recovery failure.

flowchart TD
  A[Update verifier] --> B[Restart health owner]
  B --> C[Native service and listener]
  B --> D[Gateway health RPC]
  D --> E[Authentication rejection]
  E --> F[Local startup and readiness HTTP]
  F --> B
  B --> G[Update result and warning ledger]
Loading

Technical review

Best possible solution:

Stop retrying rejected RPC authentication while continuing bounded HTTP startup, readiness, and identity observation, with accurate authentication diagnostics.

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

The source deterministically shows authentication rejection plus an initial HTTP 503 producing immediate failure; no target code was executed, and the original reporter's credential mismatch remains unverified.

Is this the best way to solve the issue?

The existing local probe is an appropriate fallback, but authentication rejection must end RPC retries without also ending the readiness allowance.

Full review comments:

  • [P1] Continue HTTP readiness polling after authentication rejection — src/cli/daemon-cli/restart-health.ts:324-325
    When the RPC is rejected and the first /readyz response is 503, confirmGatewayReachable retains authenticationError with reachable=false. This branch immediately returns auth-rejected, and observeUpdateGatewayReadiness exits before its HTTP polling loop. A temporary plugin reload, startup transition, or cached unready result therefore fails verification and can enter recovery even when the same process becomes ready within its allowance. Stop retrying the rejected RPC, but continue HTTP startup/readiness and identity observation until success, a definitive mismatch, or the existing deadline; update the new ready=false case that currently requires immediate rejection.
    Confidence: 0.99
  • [P3] Render the new authentication outcome explicitly — src/cli/daemon-cli/restart-health.types.ts:8
    The new auth-rejected outcome also reaches ordinary gateway start/restart callers, but formatGatewayRestartFailure has no matching case. An immediate device-required or missing-credentials rejection therefore falls through to “Gateway restart timed out” despite no deadline expiring. Add an authentication-specific diagnostic with the appropriate recovery action so operators can distinguish rejected credentials from slow startup.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Restart authentication and local control keeps the original intent (a5f3623: Use existing local-control authentication without device writes while retaining served identity and health diagnostics; this is prior implementation context, not a proven introduction of the original rejection behavior.)
  • Update warning projection keeps the original intent (e7546f2: Preserve inconclusive health observations as warnings while requiring service identity and HTTP readiness.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/cli/daemon-cli/restart-health-probe.test.ts src/cli/daemon-cli/restart-health-wait.test.ts src/cli/daemon-cli/restart-health-client.test.ts --maxWorkers=1
  • pnpm test src/cli/update-cli/update-command-verification-report.test.ts src/cli/update-cli/update-command-verification-channels.test.ts --maxWorkers=1
  • Verify an initial HTTP 503 can recover within the original deadline without retrying rejected RPC authentication; permanent unreadiness must remain unsuccessful.
  • git diff --check

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit dbf3597 adds src/cli/daemon-cli/restart-health-probe.ts:39 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: dbf3597f9b80; files: src/cli/daemon-cli/restart-health-probe.ts)
  • Galin Iliev: Raw commit 14e26a3 adds src/cli/daemon-cli/restart-health-probe.ts:55 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 14e26a380d34; files: src/cli/daemon-cli/restart-health-probe.ts)
  • SunnyShu: Raw commit 823fbf7 adds src/cli/daemon-cli/restart-health-probe.ts:107 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 823fbf745d4e; files: src/cli/daemon-cli/restart-health-probe.ts)

PR surface

Source +70, Tests +104, Docs +5. Total +179 across 10 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 6 83 13 +70
Tests 3 105 1 +104
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 193 14 +179

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #175712
Summary: This PR directly targets the linked report's false verification failure, without establishing why its credentials were rejected.

Members:

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

Labels

Label changes:

  • add P2: This repairs a bounded update-verification failure while the reported Gateway remains available.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🦐 gold shrimp and patch quality is 🧂 unranked krab.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: This repairs a bounded update-verification failure while the reported Gateway remains available.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🦐 gold shrimp and patch quality is 🧂 unranked krab.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 17, 2026, 2:02 PM ET / 18:02 UTC.

@steipete
steipete merged commit ea0111c into main Oct 17, 2026
221 of 226 checks passed
@steipete
steipete deleted the upd/upd-l1675 branch October 17, 2026 18:09
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
…w#175735)

After a 2026.10.2 -> 2026.10.4 update, post-restart verification connected without a device identity, the new Gateway rejected it with 1008 'device identity required', and the verifier kept retrying for the full 30-minute health window before recording a failure even though the Gateway was healthy. Deterministic authentication refusals now end the retry loop immediately; the verifier then confirms the expected version/build and readiness through the Gateway's local HTTP startup/readiness endpoints and records success with an authentication warning. Gateway admission and pairing are unchanged; an unready or mismatched Gateway still fails verification.

Fixes openclaw#175712
RomneyDa added a commit that referenced this pull request Oct 28, 2026
After a 2026.10.2 -> 2026.10.4 update, post-restart verification connected without a device identity, the new Gateway rejected it with 1008 'device identity required', and the verifier kept retrying for the full 30-minute health window before recording a failure even though the Gateway was healthy. Deterministic authentication refusals now end the retry loop immediately; the verifier then confirms the expected version/build and readiness through the Gateway's local HTTP startup/readiness endpoints and records success with an authentication warning. Gateway admission and pairing are unchanged; an unready or mismatched Gateway still fails verification.

Fixes #175712

(cherry picked from commit ea0111c)

Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

update: post-restart verification fails with device identity required after 2026.10.2 → 2026.10.4 (npm install)

1 participant