Repository navigation
fix(update): preserve slow Gateway startup during verification - #151663
Conversation
|
🦞👀 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: blocked before merge. Reviewed September 19, 2026, 10:36 AM ET / 14:36 UTC (Revision 10). ClawSweeper reviewWhat this changesThe PR shares progress-aware Gateway readiness checks across update respawns and verification, preserving slow-starting processes and reporting unknown identity accurately. Merge readiness⛔ Blocked before merge - 2 items remain The PR remains useful and has no actionable correctness findings. The earlier response-contract defect is resolved, and the current description explicitly records acceptance of the remaining upgrade-integration evidence gap. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s updater replaces the installed runtime and checks whether the replacement Gateway is ready. These checks determine whether to report success, preserve pending startup and backups, or enter recovery. flowchart TD
A[Installed updater] --> B[Restart or respawn Gateway]
B --> C[Shared readiness checks]
D[Process identity and startup progress] --> C
C --> E[Healthy replacement]
C --> F[Still starting]
C --> G[Definite failure]
E --> H[Finalize update]
F --> I[Preserve process and backups]
G --> J[Recovery]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +69, Tests +423, Docs +16. Total +508 across 28 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep readiness policy in the shared owner, preserve published response contracts, and retain the accepted upgrade-integration follow-up. Do we have a high-confidence way to reproduce the issue? Yes, from source: a replacement that binds after ten seconds exceeds main’s separate respawn deadline. This review did not execute the path or reproduce the reporter’s Windows timeline. Is this the best way to solve the issue? Yes. Reusing the existing progress-aware readiness owner removes competing timeout policy, and the published-marker response adapter preserves the released caller contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 28d8ee4f096b. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
4a81bfe to
5c8ce20
Compare
a2fc10b to
a1e74b1
Compare
a1e74b1 to
df6b39e
Compare
Related: #145087. Builds on the readiness owner from #151387, now landed on main as
ea99448f4c2d3a5ae752851014c5acd11da506d6. This branch contains only the four L702 commits.What Problem This Solves
Fixes slow, progressing Gateway replacements being rejected by a separate ten-second respawn wait, and update verification reporting unavailable identity or continuing startup as a failed restart.
User Impact
Update respawns use the existing progress-aware restart readiness owner. At the existing five-minute cap, a progressing process stays running and the result says
still-starting; verification retains recovery backups and avoids another recovery restart, rollback, and keep-stopped guidance. A dead child or an observed wrong serving version/build still fails verification.The already-running 2026.9.4 parent retains its ten-second wait after installing new files. This respawn fix applies when the repaired runtime drives a subsequent update. Candidate-side verification uses the repaired owner when an older driver delegates that work to the installed runtime.
Why This Change Was Made
The run loop duplicated readiness policy with a TCP-only poll. The existing restart-health owner now observes either a service or the actual child process, and callers preserve its final outcome. Unknown startup identity remains unknown until a serving version is observed. The existing shutdown watchdog is rearmed after old-server cleanup so that cleanup cannot consume the replacement's readiness allowance. Existing revision-checked sentinel writes preserve newer outcomes and definite errors. Under the shipped
OPENCLAW_UPDATE_IN_PROGRESS=1marker, a progressing managed restart retains the published exit-1/restart-health-failedresponse envelope so both old and current updater parents continue readiness verification. The diagnostic text and current verifier retainstill-starting; standalone restart keeps exit 2/still-starting.Thanks to @freshxiaoyao for the Windows report and process timeline, and @DrToNy1 for the measured Linux startup delay and investigation of the respawn loop.
ClawSweeper dispositions
Peter Steinberger explicitly accepts the remaining upgrade-integration evidence gap for this landing. The September 19 14:06 UTC review on
36be5bb374a5f33664b7d16569c7cf1936e9f213reports no actionable code finding; the earlier response-contract defect is resolved.The accepted merge evidence is three scoped-clean lead reviews (latest confidence 0.81), the campaign's 967 passing local tests, green exact-head CI run 35447375444 with
openclaw/ci-gatesuccessful and zero real CI failures, and range-diff proof against reviewed r2 headdf6b39eb87644f8d529cc521ae69d7c757da9ffe: commits 1, 2, and 4 are patch-identical; commit 3 changes only the test fixture. Production patches remain byte-identical to r2. The historical failed CI run below belongs to the superseded head.Evidence
Re-stacked onto fetched main
07cd92b5772b31a237c8225dacd73564ece6e23eafter #151387 landed. New head:df6b39eb87644f8d529cc521ae69d7c757da9ffe. The carried parent commit was dropped; all four L702 author identities, author dates, and commit messages are preserved.git range-diffmarks the three follow-up commits patch-identical. The first commit changed only inrestart-health.tsand its progress/wait tests during conflict resolution. It retains main's first-observation tracking, same-process migration completion, 60-second heartbeat cadence plus five-second observation allowance, and rejection of foreign or anonymous progress. L702's bounded update wait andstill-startingclassification now use that landed algorithm. Heartbeat freshness remains separate from the overall update budget, so a stalled early heartbeat cannot remain current until the five-minute cap. Main's single-host probe defaults are unchanged. All landed progress/wait cases remain, alongside the child/update-cap regressions.The integration also retains #151465's recorded rollback-health verdict and restored serving version/build, #151360's sidecar cleanup budget, and #141011's Homebrew handling. The combined rollback regression covers repair remaining
still-startingwithout losing the verified rollback receipt or starting another recovery attempt.The rebased head passed 953 focused tests across 26 files: 109 readiness-owner tests and 844 tests covering lifecycle/respawn, updater verification/reporting, service transitions, rollback, Doctor, and sentinel consumers. Both focused invocations exited 0; no tests were rerun. Full
pnpm check:changedpassed all 31 stages on the same head, including production/test types, lint, dead-export scans, schema/storage/auth guards, and zero runtime import cycles. No warning/error diagnostics or extension-lint substitution were needed.Fresh committed-branch API-route Codex autoreview (
--mode branch --base origin/main --max-priority P1, private macOSTMPDIR) is scoped-clean on this head. Main's line-growth requirements are handled by the existing sibling test-support extractions; no baseline or lint suppression changed.The new head was pushed with an explicit lease against
a1e74b1e2236d617e297849679b02c38930d7093. GitHub confirms this head is mergeable and the PR is ready for review.Exact-head CI run 35406829876, attempt 1, completed FAILING (native watcher exit 15): all 157 jobs completed, with 139 successful, 15 skipped, and 3 failing. Every failing job:
Timeout waiting for worker to respondwhile terminating the worker forsrc/transcripts/library.query-budget.test.ts. There were no failed test assertions. The transcript/fleet sources, test runner, Vitest configuration, lint launcher, dependencies, and CI workflow are unchanged from the fetched base. The cause of the teardown timeout was not established; no numeric failure-class mapping is claimed.The complete run and failure logs were inspected. No CI jobs were rerun, no test expectations were weakened, and no unrelated repair was added. Previous-head CI is not proof for this re-stack. Nothing has been landed.
The boundary regressions cover binding at 12.5 seconds and health at 20 seconds, continuing progress at the cap, leaving the service running without a keep-stopped directive, definite child failure, a foreign healthy listener after child death, old-server teardown consuming the outer watchdog, and unknown/old/target serving identity. They exercise the shared readiness owner, its respawn caller, update verification, and result/report handling. The ClawSweeper response-compatibility finding is addressed with real lifecycle output and its actual exit code carried through a subprocess and the updater parser: progressing at the cap, healthy after the cap, and progressing after service repair all failed before the fix (three failures, six controls passing) and pass after it. The fixture previously hardcoded exit 1, which hid the incompatible response. No database schema or migration behavior changes are introduced.
The Linux Testbox attempt on pre-rebase candidate
ea96e656379d2fea642b490119948acdc4dc1b09successfully synced the exact candidate and exercised the unmanaged Gitopenclaw gateway call update.runpath with 80 synthetic skills, eight credential-free channel stubs, and a 13-second startup preload. Warming the pushed branch avoided the earlier 120-second full-checksum transport failures.Live proof remains partial: published 2026.9.4 activated this candidate, and a subsequent candidate-driven update genuinely rebased its two commits onto an existing disjoint canonical upstream commit. Both then returned
doctor-failed,restart: null, and a failed terminal ledger because Doctor reportedStateDatabaseCoordinatorContentionError: another OpenClaw process owns gateway-lifecycle. Both Gateways remained serving. Neither flow reached restarting/verifying, spawned a replacement, or wrote an observed keep-stopped recovery directive; no maintenance check was bypassed.The installed candidate's separate startup logged HTTP listening at 22.965 seconds and readiness at 23.183 seconds from process start, including a 13.022-second preload.
/readyzreturned ready and health returnedok: true, with agent-schema migration and degraded-secrets warnings. These are logged startup timings, not external first-bind measurements or successful post-update verification. The respawn repair is therefore proven by the boundary regressions, not claimed as a live end-to-end pass. The Testbox and all fixture processes were stopped and independently verified.The earlier published 2026.9.4 native systemd baseline used 80 synthetic skills, eight credential-free channel stubs, and a 10% CPU limit. It succeeded: binding at 59.854 seconds and readiness at 83.007 seconds from restart CLI invocation, with the port unavailable for 57.641 seconds. This managed restart did not execute the ten-second child loop. The separate published global-npm foreground
update.runsafely refused before mutation withmanaged-service-handoff-unavailable.An earlier local run hit three native-handoff test failures outside this fix; they are report-only for this PR: the timed-out native-request fixture acknowledgement race, and the two
guards validating repair effects with the current chat requestercases (revoked=falseandrevoked=true) hitting 120-second host-load timeouts. They were not rerun or weakened; hosted CI is the proof of record for those cases.Published 2026.9.4 caller map and affected flows
The integrity-verified npm artifact contains the timeout at
dist/run-fzUO4BXB.mjs:582,waitForHealthyGatewayChildat:606, and its only spawned-child call at:842(failure reason at:851). Published source: constant, standalone call.update.run, restart enableddist/update-C1wfgEl4.mjs:719runs the update;:830-832schedulesupdate.run;dist/run-fzUO4BXB.mjs:838selects standalone update;dist/cli/gateway-lifecycle.runtime.js:71,83,94spawns;dist/run-fzUO4BXB.mjs:842waits. Linux-reachable.dist/run-fzUO4BXB.mjs:828,854; Scheduled Task selection atdist/cli/gateway-lifecycle.runtime.js:50,57. No ten-second child loop.managed-service-handoff-unavailablebefore mutation (dist/update-C1wfgEl4.mjs:705).external-supervisor-update-required(dist/update-C1wfgEl4.mjs:610).not-git-install(dist/update-runner-Bzy-GVSl.mjs:3725).There is no literal shipped
--no-serviceoption in these command definitions. Absence of a manager is necessary but the install kind also selects the flow. Managed CLI verification independently uses the readiness owner atdist/update-command-service-CdsWC6-T.mjs:971and classifies failures at:1046in theverifyingpath (:1151).The published keep-stopped writers are recovery guidance and managed handoff recovery logging. Pending readiness avoids the unsafe-recovery path; these writers retain their behavior for definite failure.
LOC relative to fetched main: production +168/-99, tests/support +794/-371, docs +16/-0 (28 files, +978/-470 total). Compared with the previous incremental diff, production changed from +161/-95 to +168/-99: three additional net lines for the landed heartbeat reconciliation. No new options, environment variables, timeout values, dependencies, schema changes, suppressions, or baseline exceptions. Nothing has been landed by this lane.