Skip to content

fix(update): keep starting Gateways running after readiness timeouts - #149760

Merged
steipete merged 3 commits into
mainfrom
upd/slow-host-verification-budget
Sep 16, 2026
Merged

steipete merged 3 commits into
mainfrom
upd/slow-host-verification-budget

Conversation

@steipete

@steipete steipete commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Refs #146394 #149395

What Problem This Solves

Fixes updates stopping a Gateway that is still starting, or reporting successful verification after a readiness timeout or repeated restarts.

User Impact

Current update drivers preserve an identified Gateway when the restart owner records waiting for a listener, startup migration, or healthy settling. Established-listener probe failures and HTTP-unready services remain failures. For qualifying startup expiry, recovery backups are retained. The run closes as skipped with reason gateway-readiness-unverified, a recorded finish time, and no readiness confirmation. The warning preserves the elapsed allowance and last observation. Observed PID or boot-generation changes remain failures that reach recovery. Doctor reports qualifying unverified readiness with an explicit handled reason and an unverified-readiness message, including after migrated finalization.

Why This Change Was Made

The budget was already enlarged by #145219, but timeout still entered destructive failed-update recovery. The verifier and current service, repair, Doctor, and migrated finalization callers now preserve stable startup. Finalization records an explicit terminal unverified outcome because Gateway startup publishes boot facts but does not own CLI readiness completion. update status, JSON, the restart sentinel, and public report identifiers share that outcome. A Gateway ready within the allowance records confirmed readiness; later health does not rewrite a closed historical run. No options, environment controls, or database schema changes were added.

Follow-up: published-parent pending-readiness completion. Installed 2026.9.3/9.4 parents use status === "ok" for both backup retirement and Windows autostart preservation. Candidate code cannot change that already-loaded decision. This PR repairs current callers without changing the parent-facing response shape; the first-hop limitation remains.

Evidence

  • Current evidence head: ca81bad94a976d06f2c821bae545118b93778255.
  • All four reported CI cases reproduced on 72fe31bf6b7. Two added Doctor regressions also failed before this fix because direct and migrated unverified startup returned bare success.
  • 277 focused cases passed across nine selected files: 210 service/verifier/finalization cases, 63 Doctor cases, and four CLI cases. Coverage includes the original rejection contracts, explicit unverified outcomes, stable/deadline generation checks, real retained package bytes, and migrated ledger ownership. The focused wrapper rebuilt its required runtime.
  • node scripts/check-changed.mjs passed for all changed PR paths; git diff --check passed.
  • Fresh Codex P1 autoreview in branch mode against origin/main: scoped-clean.
  • Prior isolated built-Gateway proof: pre-fix verification failed at 66.3s while the PID stayed alive and became ready at 124.6s. At ebafd8ee44a, verification warned at 65.6s, preserved the PID, and observed /readyz HTTP 200 at 96.3s. Service-manager observations were adapted to the owned PID; Gateway and HTTP were real. No full Raspberry Pi or Windows guest upgrade proof.
  • Production +229/−130 (net +99); tests +643/−117 (net +526); docs +31/−0 (net +31). Growth carries explicit outcomes through existing owners; destructive recovery was removed and package completion was consolidated.

Consumer-test classifications

  1. Service integration — slow refresh: intentional contract change. The fixture's listener appears at 20 seconds, after the explicit 6.5-second observation window. That window sees the same running PID and a free port, without errors or generation changes. The previous ok result depended on forcing a recovery restart. The test now requires no such restart, a recorded skipped / gateway-readiness-unverified outcome, an unconfirmed readiness record, and the warning to retain recovery backups.
  2. Service integration — unready refresh: intentional terminal unverified outcome, not verified success. Its Infinity listener schedule is not observable during the finite window; the verifier sees the same pre-listener startup evidence as the slow case. The old fixture made it healthy by forcing recovery. The test now preserves the process, records the exact unverified outcome and backup-retention warning, and makes no claim that readiness will eventually arrive. Physical backup retention remains covered by the retained-package finalization regression.
  3. Doctor — http-unready: product regression; keep rejection. RPC health is healthy while /readyz remains 503, with no identified startup generation or startup progress. The predicate no longer converts that into pending startup. Its original rejection, triage, and absence of a successful-restart note remain asserted. Separate startup regressions now require Doctor's explicit handled gateway-readiness-unverified reason and unverified-readiness outro, for both direct and migrated completion.
  4. CLI — matching-version JSON restart stays unhealthy: product regression; keep rejection. A matching-version PID already owns a busy listener, but its probe times out without startup evidence. The original rejection and diagnostic assertions remain; JSON must also record status: error and a failed verification step.

Treat exhausted readiness observations as warnings while the Gateway is still running. Preserve unconfirmed health, recovery backups, and Windows autostart across current finalization and repair callers. Share package completion handling and leave candidates untouched when rollback is refused.

Keep the published 2026.9.3/9.4 parent completion limitation as a documented follow-up without changing its response contract.

Refs #146394 #149395
@clawsweeper

clawsweeper Bot commented Sep 16, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes commands Command implementations size: L maintainer Maintainer-authored PR labels Sep 16, 2026
@steipete
steipete marked this pull request as ready for review September 16, 2026 05:51
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 16, 2026, 4:20 AM ET / 08:20 UTC (Revision 3).

ClawSweeper review

What this changes

The updater preserves identified Gateways that are still starting after readiness expires, retains recovery backups, and reports an explicit unverified outcome through Doctor and update history.

Merge readiness

⛔ Blocked before merge - 4 items remain

This remains useful work: current main still treats exhausted startup verification as failure. The latest revision addresses the earlier correctness concern; the remaining landing question is acceptance of the documented published-updater limitation.

Priority: P1
Reviewed head: ca81bad94a976d06f2c821bae545118b93778255
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent repair with meaningful runtime evidence and focused regression coverage; the published-parent compatibility choice remains explicit.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied historical built-Gateway run exercised the real verifier and HTTP readiness, preserving a delayed-start PID until readiness returned 200; current regression coverage supports the narrowed startup predicate and terminal reporting. This proves the central startup behavior, not published-parent Windows upgrade completion.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied historical built-Gateway run exercised the real verifier and HTTP readiness, preserving a delayed-start PID until readiness returned 200; current regression coverage supports the narrowed startup predicate and terminal reporting. This proves the central startup behavior, not published-parent Windows upgrade completion.
Evidence reviewed 9 items Current main still needs the repair: At fetched main, the verifier invokes recovery without the new startup-pending guard and records exhausted readiness as failed verification. The merged budget work at #145219 supplies longer allowances, not this terminal-outcome repair.
Narrow startup classification and refreshed observations: Pending readiness requires a running identified process, timeout, and an owner-reported startup phase; mismatches, channel errors, stale PIDs, and HTTP-unready observations remain failures. Final HTTP verification refreshes service identity, addressing the earlier review concern.
Current finalization preserves unverified recovery material: Current finalizers recognize the pending verification step, avoid another recovery operation, preserve Windows autostart, and bypass package retirement. Normalization records skipped/gateway-readiness-unverified without a success continuation.
Findings None None.
Security None None.

How this fits together

Update verification checks the restarted Gateway’s process identity, health, and HTTP readiness. Its result controls service recovery, package-backup cleanup, Windows autostart completion, and the recorded update outcome.

flowchart TD
 A[Installed updater] --> B[Start candidate Gateway]
 B --> C[Observe identity and readiness]
 C --> D{Observed outcome}
 D -->|Ready| E[Confirm update and retire backups]
 D -->|Stable startup timeout| F[Preserve process and backups]
 D -->|Concrete failure| G[Guarded recovery]
 F --> H[Record readiness unverified]
Loading

Decision needed

Question Recommendation
May this land with the documented published-parent Windows autostart limitation, or must that first upgrade be qualified beforehand? Accept the bounded first-upgrade limitation: Land the current-driver improvement with explicit acceptance that published parents can still disable Windows autostart after unverified completion.

Why: The body acknowledges the limitation as follow-up, but does not explicitly accept the resulting Windows autostart behavior for landing; candidate code cannot replace the parent already executing.

Before merge

  • Resolve merge risk (P1) - A migrated upgrade driven by published v2026.9.4 can return the candidate’s unverified skipped result while the older parent disables Windows task autostart again; current-parent tests and the isolated Gateway run do not qualify this first upgrade.
  • Complete next step (P2) - Explicitly accept the documented published-parent Windows autostart limitation for landing, or qualify that upgrade path first.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +99, Tests +526, Docs +31. Total +656 across 34 files.

View PR surface stats
Area Files Added Removed Net
Source 18 229 130 +99
Tests 14 643 117 +526
Docs 2 31 0 +31
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 34 903 247 +656

Review metrics

Metric Value Why it matters
Outcome contract 1 new terminal reason; 0 new settings or schema changes The existing skipped status now distinguishes installation from confirmed readiness, which older updater parents do not understand.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/cli/update-cli/update-command-repair-service.ts, migration/backfill/repair: src/cli/update-cli/update-command-verification.ts, migration/backfill/repair: src/commands/doctor-update.ts, unknown-data-model-change: src/commands/doctor-update.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Accept the documented parent limitation (recommended)
    Explicitly accept the older parent’s Windows autostart compensation while adopting the safer current-driver behavior.
  2. Pause for first-upgrade qualification
    Keep the PR open until published-driver Windows evidence establishes the actual completion and recovery outcome.

Technical review

Best possible solution:

Keep one readiness owner and explicit unverified outcomes, with published-driver compatibility either demonstrated or explicitly accepted as a bounded landing limitation.

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

Yes: delay listener startup beyond the update readiness allowance while preserving the process identity. Current-main source, the field report, and the supplied historical Gateway run support this path; this review did not execute it.

Is this the best way to solve the issue?

Yes for current drivers: the patch keeps readiness classification with the existing verifier and carries its result through existing finalizers. Published-parent completion remains a separate compatibility limitation.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: Premature update recovery interrupts real slow-host Gateway startup and can leave the service unavailable.
  • merge-risk: 🚨 compatibility: The new skipped outcome reaches published parents whose Windows completion logic only recognizes status ok.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The supplied historical built-Gateway run exercised the real verifier and HTTP readiness, preserving a delayed-start PID until readiness returned 200; current regression coverage supports the narrowed startup predicate and terminal reporting. This proves the central startup behavior, not published-parent Windows upgrade completion.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied historical built-Gateway run exercised the real verifier and HTTP readiness, preserving a delayed-start PID until readiness returned 200; current regression coverage supports the narrowed startup predicate and terminal reporting. This proves the central startup behavior, not published-parent Windows upgrade completion.

Evidence

What I checked:

  • Current main still needs the repair: At fetched main, the verifier invokes recovery without the new startup-pending guard and records exhausted readiness as failed verification. The merged budget work at fix(update): derive update budgets from measured state instead of fixed literals #145219 supplies longer allowances, not this terminal-outcome repair. (src/cli/update-cli/update-command-verification.ts:257, 967a8681d0d5)
  • Narrow startup classification and refreshed observations: Pending readiness requires a running identified process, timeout, and an owner-reported startup phase; mismatches, channel errors, stale PIDs, and HTTP-unready observations remain failures. Final HTTP verification refreshes service identity, addressing the earlier review concern. (src/cli/update-cli/update-command-verification.ts:211, ca81bad94a97)
  • Current finalization preserves unverified recovery material: Current finalizers recognize the pending verification step, avoid another recovery operation, preserve Windows autostart, and bypass package retirement. Normalization records skipped/gateway-readiness-unverified without a success continuation. (src/cli/update-cli/update-command-post-update.ts:353, ca81bad94a97)
  • Published parent compatibility: The v2026.9.4 parent completes Windows recovery and package cleanup using response.result.status === "ok". A candidate returning the newly introduced skipped outcome therefore reaches the old parent's unsuccessful-completion branch. The unavailable local release blob was inspected through GitHub's contents endpoint. (src/cli/update-cli/update-command-migrated.ts, 3a9d69db306c)
  • Published Windows compensation effect: The published recovery owner disables the previously suspended task when complete(false) follows restoration or handoff. This establishes the concrete autostart concern; the current-parent tests do not exercise that published parent. (src/cli/update-cli/update-command-windows-task.ts:126, 3a9d69db306c)
  • Real startup evidence and current regression coverage: The captured PR body reports an isolated built Gateway: before the fix, verification failed at 66.3 seconds and readiness arrived at 124.6 seconds; at ebafd8e, verification warned at 65.6 seconds, preserved the PID, and HTTP readiness reached 200 at 96.3 seconds. Service-manager observations were adapted to the owned PID. The current head reports 277 focused passing cases, including restored rejection contracts and Doctor outcomes; these tests supplement the historical runtime observation. No Windows guest upgrade is claimed. (ebafd8ee44a1)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • fuller-stack-dev: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Record acceptance of the published-parent Windows autostart limitation, or provide the corresponding upgrade outcome evidence.

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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-16T05:58:49.353Z sha ebafd8e :: blocked before merge. :: [P1] [P1] Refresh service state before treating HTTP expiry as pending
  • reviewed 2026-09-16T06:56:05.761Z sha 72fe31b :: blocked before merge. :: none

Preserve observed PID and boot-generation changes as verification failures that reach recovery. Close stable readiness expiry as skipped with gateway-readiness-unverified, a finite outcome shared by finalization, status, sentinels, and public reports. Keep backups and suppress success continuations while readiness is unconfirmed, including already-current core updates that restart after plugin changes.

Refs #146394 #149395
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 16, 2026
Require an identified startup phase before treating readiness expiry as a warning. Keep established-listener probe failures and HTTP-unready services as failed verification. Report Doctor's unverified completion explicitly, including migrated finalization.

Reconcile the service fixtures against their finite observation window: the same running PID with no listener does not authorize a forced recovery restart or establish readiness. Preserve the terminal unverified outcome and backup-retention warning.

Refs #146394 #149395
@steipete
steipete merged commit 53fc4b9 into main Sep 16, 2026
195 checks passed
@steipete
steipete deleted the upd/slow-host-verification-budget branch September 16, 2026 08:47
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 17, 2026
…penclaw#149760)

* fix(update): keep starting Gateways running after readiness timeouts

Treat exhausted readiness observations as warnings while the Gateway is still running. Preserve unconfirmed health, recovery backups, and Windows autostart across current finalization and repair callers. Share package completion handling and leave candidates untouched when rollback is refused.

Keep the published 2026.9.3/9.4 parent completion limitation as a documented follow-up without changing its response contract.

Refs openclaw#146394 openclaw#149395

* fix(update): distinguish unstable and unverified Gateway starts

Preserve observed PID and boot-generation changes as verification failures that reach recovery. Close stable readiness expiry as skipped with gateway-readiness-unverified, a finite outcome shared by finalization, status, sentinels, and public reports. Keep backups and suppress success continuations while readiness is unconfirmed, including already-current core updates that restart after plugin changes.

Refs openclaw#146394 openclaw#149395

* fix(update): distinguish startup from unhealthy service observations

Require an identified startup phase before treating readiness expiry as a warning. Keep established-listener probe failures and HTTP-unready services as failed verification. Report Doctor's unverified completion explicitly, including migrated finalization.

Reconcile the service fixtures against their finite observation window: the same running PID with no listener does not authorize a forced recovery restart or establish readiness. Preserve the terminal unverified outcome and backup-retention warning.

Refs openclaw#146394 openclaw#149395
This was referenced Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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.

1 participant