Skip to content

fix: report when update repair leaves an already stopped Gateway offline - #153409

Closed
RomneyDa wants to merge 1 commit into
mainfrom
fix/update-repair-offline-outcome
Closed

RomneyDa wants to merge 1 commit into
mainfrom
fix/update-repair-offline-outcome

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Sep 20, 2026 •

Copy link
Copy Markdown
Member

Related: #153401

What Problem This Solves

Fixes update repair reporting successful finalization without explaining that an already stopped managed Gateway was not started. It also dropped maintenance-restoration warnings from the terminal JSON outcome.

User Impact

Standalone repair now reports that it did not start the previously stopped Gateway and names openclaw gateway start. The terminal result carries this warning, including readiness warnings from restoration. A Gateway explicitly stopped outside update custody is not started by guessing earlier operator intent.

This applies to standalone repair across dev, beta, stable, and package/Git installs; it does not change the installed old updater's preflight. Existing custody still restores services stopped by this repair, and parent-owned activation remains with the update parent.

Why This Change Was Made

Maintenance already knows whether it stopped the service and owns restoration. Its warning list now records the intentional non-start outcome and reaches finalization's existing Doctor warnings, so the final message agrees with the service action.

Evidence

  • 43 tests pass across doctor-maintenance.settlement.test.ts and update-command-lifecycle.test.ts, covering no unexpected restart, warning propagation, parent-owned activation, and cleanup/restoration boundaries.
  • Independent AutoReview P0–P2: scoped-clean.
  • All service operations in the new tests use synthetic boundaries. No live Gateway was modified.
  • Full changed-path checks (core and core-test types, lint, dependency/dead-export checks) and pnpm build pass. The pre-rebase CI completed successfully; CI is rerunning for the rebased head.
  • Published 2026.9.4 driver e46e3746bb5 created an isolated failed activation ledger and an unloaded, uniquely named profile LaunchAgent. The built candidate CLI ran openclaw --profile <isolated> update repair --json --yes --timeout 120: exit 0, terminal status warning, restart: false, and the profile-specific start guidance in postUpdate.doctor.warnings. The native service remained unloaded before/after; task profile and plist were removed. This is a recovery-boundary compatibility run using real old-driver state, not a claim of running a complete old-driver installation. No persistent schema changes are introduced.

Data-model compatibility

There is no persistent data-model, schema, migration, receipt, key, or serialized-format change in this PR. doctor-maintenance.ts changes only an in-memory warning list and log output; finalization passes that string into the existing warning collector. Existing update-run warning storage is used without changing its shape.

Upgrade compatibility is verified at the actual recovery boundary: the published 2026.9.4 e46e3746bb5 ledger implementation wrote an isolated failed activation record, then the built candidate 6495307d493 read and repaired it successfully (exit 0, warning result). The supplied terminal trace verifies the current candidate can consume that old-driver recovery state, keep the native service unloaded, and deliver the new warning through the existing JSON warning array. No new backfill or downgrade conversion is required.

Rebase validation (September 20)

Rebased onto main 8b8d1c5597d, resolving the stopped-service conflict. Main's specific installation-drift remediation takes precedence when drift exists; the ordinary owned/offline case keeps this PR's start guidance. Head: 6ec91f99c87.

  • 45 repair/finalizer regression tests and three installation-drift cases passed.
  • Fresh independent P0–P2 review: scoped-clean; conflict resolution also peer-reviewed.
  • Direct changed-file lint passed with a file-length warning (709 lines versus 700); normal lint preparation is blocked by main's unchanged update-triage-resolution.ts:92 formatter/Array.map type error.
  • GitHub confirms conflict-free and non-draft; CI is rerunning.

@clawsweeper

clawsweeper Bot commented Sep 20, 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 cli CLI command changes commands Command implementations size: XS maintainer Maintainer-authored PR labels Sep 20, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 20, 2026
@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 20, 2026, 2:37 PM ET / 18:37 UTC (Revision 5).

ClawSweeper review

What this changes

Update repair now explains when an already stopped Gateway remains offline and includes maintenance warnings in its terminal JSON result.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open as a useful, focused fix absent from current main. No blocking defect found; the previous migration-compatibility blocker is resolved by the actual diff and supplied recovery evidence.

Priority: P2
Reviewed head: 6ec91f99c87b6cc5eaa50da36a5399ffffa46687

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused implementation with meaningful recovery-boundary evidence and no identified blocking defect.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The supplied real macOS repair trace exercises Doctor maintenance and finalization against published-driver recovery state, showing warning JSON and an unchanged unloaded service. It covers the earlier candidate; source review confirms the rebased patch retains that ordinary path while preserving installation-drift guidance, supplemented by reported focused regression checks.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The supplied real macOS repair trace exercises Doctor maintenance and finalization against published-driver recovery state, showing warning JSON and an unchanged unloaded service. It covers the earlier candidate; source review confirms the rebased patch retains that ordinary path while preserving installation-drift guidance, supplemented by reported focused regression checks.
Evidence reviewed 10 items Pinned introduced change: The introduced production changes add an offline warning and forward maintenance warnings after finish. They do not change service activation, authorization, schemas, or serialized formats.
Warning propagation uses the existing owner: Finalization collects warnings after maintenance finishes, before constructing the terminal result. The existing collector normalizes and deduplicates warnings and records them using the unchanged lifecycle warning format.
Current main still needs the fix: Fetched main retains installation-drift guidance but has no ordinary already-stopped warning; its finalizer still discards maintenance warnings after finish.
Findings None None.
Security None None.

How this fits together

Update repair runs Doctor and plugin reconciliation after an interrupted update. Doctor maintenance preserves service custody, and finalization converts its outcomes into terminal output and update history.

flowchart TD
  A[Update repair command] --> B[Doctor maintenance]
  B --> C{Service condition}
  C --> D[Preserve stopped service]
  C --> E[Restore service stopped by repair]
  D --> F[Maintenance warnings]
  E --> F
  F --> G[Finalization warning collector]
  G --> H[Terminal result and update history]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +13, Tests +36. Total +49 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 13 0 +13
Tests 2 36 0 +36
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 49 0 +49

Review metrics

None.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-maintenance.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep service activation with its existing owner while consistently exposing maintenance warnings and the appropriate profile-specific recovery command.

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

Yes, from source: an owned, already offline service produces no ordinary maintenance warning on current main, and finalization omits maintenance warnings. No runtime reproduction was executed during this review.

Is this the best way to solve the issue?

Yes. Reporting through the existing maintenance owner and warning collector fixes the misleading result while preserving operator intent and installation-drift guidance.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This fixes misleading repair outcomes and omitted warnings without changing service activation behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The supplied real macOS repair trace exercises Doctor maintenance and finalization against published-driver recovery state, showing warning JSON and an unchanged unloaded service. It covers the earlier candidate; source review confirms the rebased patch retains that ordinary path while preserving installation-drift guidance, supplemented by reported focused regression checks.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied real macOS repair trace exercises Doctor maintenance and finalization against published-driver recovery state, showing warning JSON and an unchanged unloaded service. It covers the earlier candidate; source review confirms the rebased patch retains that ordinary path while preserving installation-drift guidance, supplemented by reported focused regression checks.

Evidence

What I checked:

  • Pinned introduced change: The introduced production changes add an offline warning and forward maintenance warnings after finish. They do not change service activation, authorization, schemas, or serialized formats. (src/commands/doctor-maintenance.ts:216, 6ec91f99c87b)
  • Warning propagation uses the existing owner: Finalization collects warnings after maintenance finishes, before constructing the terminal result. The existing collector normalizes and deduplicates warnings and records them using the unchanged lifecycle warning format. (src/cli/update-cli/update-command-finalize.ts:285, 6ec91f99c87b)
  • Current main still needs the fix: Fetched main retains installation-drift guidance but has no ordinary already-stopped warning; its finalizer still discards maintenance warnings after finish. (src/cli/update-cli/update-command-finalize.ts:285, 7a255e31e8ac)
  • Latest release comparison: The v2026.9.5 finalizer also awaits maintenance finish without collecting its warnings. Local release-blob retrieval failed; the release source was successfully inspected through GitHub's contents API. (src/cli/update-cli/update-command-finalize.ts:263, ec9c1a13db89)
  • Real recovery-boundary evidence: The supplied contributor comment records published 2026.9.4 ledger code creating failed activation state, followed by candidate 6495307 running the real profile-specific repair CLI against an isolated native LaunchAgent. Exit status was zero, terminal status was warning, restart was false, the profile-specific start instruction reached postUpdate.doctor.warnings, and the service remained unloaded. This proves the recovery boundary, not a complete historical installation upgrade. (6495307d493b)
  • Re-review continuity: The earlier reviewed commit's patch was retrieved through GitHub after local historical-object inspection failed. Warning forwarding and ordinary offline guidance remain in the current patch; the rebase gives existing installation-drift guidance precedence. The prior review recorded no code findings. Its generic migration checkbox does not describe an introduced storage change. (src/commands/doctor-maintenance.ts:213, 6495307d493b)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

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 (4 earlier review cycles)
  • reviewed 2026-09-20T04:02:32.033Z sha 6495307 :: blocked before merge. :: none
  • reviewed 2026-09-20T04:17:26.443Z sha 6495307 :: blocked before merge. :: none
  • reviewed 2026-09-20T04:23:31.658Z sha 6495307 :: blocked before merge. :: none
  • reviewed 2026-09-20T04:39:49.423Z sha 6495307 :: blocked before merge. :: none

@RomneyDa

Copy link
Copy Markdown
Member Author

Added published-driver-to-candidate recovery evidence to the PR body. Published 2026.9.4 e46e3746bb5 created the actual failed activation ledger (its createUpdateRun, phase recording and finish functions) plus an unloaded, uniquely named native LaunchAgent with an isolated profile. After a successful full pnpm build, candidate 6495307d493 ran the real CLI:

openclaw --profile <isolated> update repair --json --yes --timeout 120
exitCode: 0
serviceLoadedBefore: false
serviceLoadedAfter: false

Terminal JSON excerpt:

{
  "status": "warning",
  "mode": "finalize",
  "restart": false,
  "postUpdate": {
    "doctor": {
      "status": "warning",
      "warnings": [
        "Gateway was already stopped before repair; repair did not start it. Run openclaw --profile <isolated> gateway start to bring it online."
      ]
    }
  }
}

The excerpt omits two expected synthetic-profile node-onboarding warnings. This verifies actual terminal warning delivery and preserved offline service behavior across the old ledger/candidate repair boundary. It does not claim a full historical updater installation run. The task-owned profile and plist were removed after verifying the native service remained unloaded; the default Gateway was never modified. No stored schema or migration policy changes are introduced. Full changed-path validation and all 43 focused tests pass.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 20, 2026
@RomneyDa

Copy link
Copy Markdown
Member Author

The latest review accepts the published-driver recovery proof and states that no persisted formats change, but the remaining generic data-model checkbox still classifies the file by migration/backfill/repair: src/commands/doctor-maintenance.ts. Added an explicit Data-model compatibility section to the PR body to make the distinction concrete: no schema/migration/receipt/key/format changes; the warning uses existing record storage unchanged. The already accepted real run also shows candidate repair successfully reading the failed activation ledger written by published 2026.9.4 e46e374.

Please reassess that remaining compatibility checkbox against the actual delta and this evidence.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete

Copy link
Copy Markdown
Contributor

Landed on main via #157134 (merge af2ab18, 2026-09-24 08:19Z), which carries this PR's commits with your authorship onto current main; the branch here had conflicted with the Doctor signal-ownership and maintenance-execution changes from #156854 and #156761. Behavior as specified: standalone repair records and logs that it left an already-stopped, owned Gateway offline and names openclaw gateway start; maintenance warnings reach the finalize JSON; installation-drift guidance keeps precedence. Proof on the landed head: three negative controls failing pre-fix, 35 importer files / 1,231 tests, full check:changed. Closing this one as superseded. Thanks @RomneyDa.

@steipete steipete closed this Sep 24, 2026
@RomneyDa
RomneyDa deleted the fix/update-repair-offline-outcome branch October 22, 2026 03:19
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 maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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.

2 participants