Repository navigation
fix(update): PostgreSQL update spends minutes validating the candidate before refusing a Gateway it cannot stop - #196157
Conversation
- Probe PostgreSQL capture ownership before candidate validation unless the owner can still be released before activation - Exempt running services the updater stops (owned or unresolved) and Gateway-started foreground runs, which park their Gateway after validation - Share the foreground parking condition with the activation handoff - Pass the pre-stop service state into candidate validation - Keep the existing probe before activation for owners that start later - Add tests: held owner refuses before validation for Git and package installs; owned and unresolved running services and a foreground run still reach validation
|
🦞👀 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: needs maintainer review before merge. What this changesCheck PostgreSQL backup ownership before expensive candidate validation when the updater has no planned shutdown that could release it. Example: Run openclaw update --yes --no-restart --json while a managed PostgreSQL Gateway holds state ownership.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR provides a useful, focused fix with no actionable findings; the new installed-CLI evidence resolves the previous proof hold. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe update CLI prepares Git or package candidates, validates them, coordinates Gateway shutdown and checks database ownership before activating the installation. flowchart TD
A[Update CLI] --> B[Prepare candidate]
B --> C[Check ownership and planned shutdown]
C --> D[Refuse with retry guidance]
C --> E[Validate candidate]
E --> F[Stop or park Gateway]
F --> G[Recheck ownership]
G --> H[Activate and capture databases]
Technical reviewBest possible solution: Retain this focused early refusal while preserving planned shutdowns, foreground parking and the final preactivation ownership check. Do we have a high-confidence way to reproduce the issue? Current-main source validates the candidate before checking PostgreSQL capture ownership, matching the reported wasted work; supplied installed-CLI evidence exercises the corrected refusal path. Is this the best way to solve the issue? This is the smallest complete fix: reuse the existing ownership probe at candidate validation, exempt only planned shutdown paths and preserve its package error classification. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 474b4cebd95f. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +45, Tests +188, Other +2. Total +235 across 7 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
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 HistoryReview history (4 earlier review cycles)
Reviewed November 10, 2026, 2:45 PM ET / 19:45 UTC (Revision 5). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
- The early PostgreSQL owner probe throws inside candidate validation; the package runner reported that as global-install-failed - Extend the existing validation try block over the config read and candidate validation so the refusal keeps database-engine-preflight - The package test's runner mock now returns a failed result for a thrown validation error, as the real package runner does - Raise the test-lines allocation from 172 to 181
f82b55e to
1d5061e
Compare
|
@clawsweeper re-review Please review exact head |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Exact head f8d69b2 is unchanged. New proof resolves the existing hold: actual installed CLI against real native user-systemd PostgreSQL17 Gateway under --no-restart refused database-engine-preflight before canary validation (55.911s);24042core file hashes, native PID/start identity, authenticated RPC/readiness and PGmarker unchanged. Canonical future fixture changed only package/build-info/content-inventory metadata; compiled runtime unchanged.102focused tests, full build and required exact-head CI passed. Body has exact receipts and limitations. Please assess the remaining proof hold; no source changes or new scope. |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…e before refusing a Gateway it cannot stop (openclaw#196157) * fix(update): refuse unreleasable PostgreSQL owner before validation - Probe PostgreSQL capture ownership before candidate validation unless the owner can still be released before activation - Exempt running services the updater stops (owned or unresolved) and Gateway-started foreground runs, which park their Gateway after validation - Share the foreground parking condition with the activation handoff - Pass the pre-stop service state into candidate validation - Keep the existing probe before activation for owners that start later - Add tests: held owner refuses before validation for Git and package installs; owned and unresolved running services and a foreground run still reach validation * test: allocate test lines for PostgreSQL owner refusal regressions * fix(update): keep owner refusal reason for package installs - The early PostgreSQL owner probe throws inside candidate validation; the package runner reported that as global-install-failed - Extend the existing validation try block over the config read and candidate validation so the refusal keeps database-engine-preflight - The package test's runner mock now returns a failed result for a thrown validation error, as the real package runner does - Raise the test-lines allocation from 172 to 181 * fix(update): only exempt owners the updater will stop * test(update): provide complete managed owner verdict --------- Co-authored-by: Vincent Koc <[email protected]>
Related: #193163
Related: #196154
Follow-up to #193190
What Problem This Solves
openclaw updatecan spend minutes running candidate validation before refusing atdatabase-engine-preflightwhen a PostgreSQL Gateway holds state ownership and the updater will not stop it.User Impact
Refuse before canary validation with the existing ownership reason and next step, preserving the installation and running Gateway. Runtime retention and candidate installation still occur first. Managed services the updater will stop, separately parked foreground updates, stopped Gateways and SQLite-only installs retain their behavior.
Why This Change Was Made
The existing preactivation probe protects the installation, but runs after validation. Reuse it at the candidate-validation owner boundary when neither a future managed stop nor foreground park can release ownership. Keep the final probe for an owner that starts later. Keep the probe inside the validation error boundary so package installs retain
database-engine-preflightrather thanglobal-install-failed.Maintainer correction
f8d69b280dd8de97718898bbd5e73d19c2b10194passes the managed exemption only whenshouldRestartis true. A running owned or unresolved service under--no-restarttherefore refuses early. The foreground parking exemption remains separate.Full PR production delta: +45 net lines for this early ownership boundary; correction production delta: 0. Tests: +188, allocated in the task's own test-line record; shared cap unchanged. No schema, auth, restart-policy, cancellation or capture-durability change.
Evidence
f8d69b280dd8de97718898bbd5e73d19c2b10194.tbx_01m73e8gxsc0atpmskka05jv9s, allocation run, exact head verified:update-command-execution.test.ts,update-command-foreground.test.tsandupdate-command-candidate-validation.test.tsall passed, 102 tests in 3 files (77.91 s).pnpm buildpassed on that exact source; installed CLI reportsOpenClaw 2026.11.2 (f8d69b2). The build also reported CSS/chat-boot budget warnings; no claim that every asset budget passed. The PR changes only update CLI source/tests and its allocation record.Corrected-head installed CLI behavior
On the same isolated Linux Testbox, the canonical package helper produced and installed the exact-head package into a separate npm prefix. A uniquely named canonical profile was installed through the real user-systemd owner with PostgreSQL 17, a file SecretRef and normal token auth.
The repository's existing
packFirstHopUpdateFixtureproduced a distinct2026.11.3-first-hop.0candidate from that package. Its complete member-digest receipt changed onlypackage.json,dist/build-info.jsonanddist/postinstall-content-inventory.json; compiled runtime bytes were unchanged. An earlier identical-artifact run correctly returned already-current and is excluded from defect proof.Actual installed entry point:
Preliminary candidate admission ran; canary snapshot/Doctor/lint/config/plugins/recovery/Gateway validation did not. Before and after refusal:
Native installation initially refused the runner's existing world-writable ancestor. Only the absent private service directories were created; existing permissions, manager configuration and the guard were unchanged.
Review follow-through and limits
The previous exact-head review had zero source findings and required the installed managed PostgreSQL
--no-restartproof above. That proof is now complete. Native preparation, enforced checks and landing remain required.Credit: @etzelm for the original repair and historical qualification. No Team deployment, production-instance, cross-host continuity or crash/remote-acceptance claim.