Repository navigation
fix(update): avoid false restart failures after authentication rejection - #175735
Conversation
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.
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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".
| if (snapshot.authenticationError) { | ||
| return withWaitContext(snapshot, "auth-rejected", elapsedMs); |
There was a problem hiding this comment.
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 👍 / 👎.
|
Codex review: needs changes before merge. What this changesThis 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.”
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete 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 Before merge
Findings
Provenance
Tests
Agent review detailsHow this fits togetherThe 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]
Technical reviewBest 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:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e9188c5f60b4. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +70, Tests +104, Docs +5. Total +179 across 10 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 17, 2026, 2:02 PM ET / 18:02 UTC. |
…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
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]>
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
/startupzand/readyzcontracts 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 1008device 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.mtspassed (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 fullcheck:changedSQLite 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), andupdate-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.