Skip to content

fix(update): keep dev campaigns running after restart - #121328

Merged
steipete merged 1 commit into
mainfrom
steipete/admin-update-settings-access-c6719b
Aug 10, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/admin-update-settings-access-c6719b

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where a successful pinned dev update campaign left the checkout on the intended detached commit, but a service restart then made Updates report no-upstream and stopped future hourly dev campaigns. This was observed in a live managed dev-channel deployment after a successful pinned campaign and restart, without depending on any host- or user-specific behavior.

Why This Change Was Made

Pinned dev updates must preserve the exact detached target while retaining the canonical upstream that produced it. The update flow now carries both facts in a versioned encoding through the existing single environment field, validates that the frozen SHA is an ancestor of the declared upstream before mutation, verifies the final detached HEAD, and persists upstreamRef only in a successful receipt. After restart, that receipt is used only when its canonical install root and SHA match the current detached checkout; active branch tracking still wins.

User Impact

Updates continues to show whether the installed dev checkout is current or behind after restart, and hourly dev campaigns can continue from verified campaign-managed detached installs. Unmanaged detached checkouts still report no upstream. This adds no live config, protocol field, or public CLI flag.

Evidence

  • Focused codec, update-check, runner, startup, Gateway, CLI, receipt, and managed-handoff tests passed before publication.
  • The changed gate passed through the trusted local fallback.
  • Fresh targeted formatting and git diff --check passed after rebasing onto current origin/main.
  • Fresh Codex branch autoreview against origin/main reported no findings and rated the patch correct (0.98 confidence).
  • Production LOC: +332/-110 (net +222), justified by typed target handoff, cross-restart receipt provenance with canonical-root isolation, exact upstream/final-HEAD validation, and continued campaign capability. Tests: +606/-44.
  • Independent focused reruns and Testbox proof were blocked by an owned shared local heavy-check lock and an unavailable Blacksmith CLI, respectively; these were infrastructure blockers, not test failures.

No changelog edit: the PR body carries the release-note context for this focused fix.

@clawsweeper

clawsweeper Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime cli CLI command changes size: XL maintainer Maintainer-authored PR labels Aug 10, 2026
@steipete
steipete marked this pull request as ready for review August 10, 2026 01:33
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for exact head 835da62dd424fe813f9eb190956adcdb35d1154e:

  • Required exact-head CI is green with pending=0: https://github.com/openclaw/openclaw/actions/runs/31347405388
  • Focused codec, update-check, runner, startup, Gateway, CLI, receipt, and managed-handoff suites passed before publication; the changed gate, formatting, and diff checks also passed.
  • Fresh branch/uncommitted autoreview is clean with no P0/P1 findings.
  • Latest ClawSweeper state is the opened/queued acknowledgement only, with no actionable finding or Rank-up move; the publisher is not a landing blocker.
  • No proof gaps remain for the native prepare/merge guards.

@steipete
steipete merged commit f4e6252 into main Aug 10, 2026
185 checks passed
@steipete
steipete deleted the steipete/admin-update-settings-access-c6719b branch August 10, 2026 01:50
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete

Copy link
Copy Markdown
Contributor Author

OpenClaw pinned dev update live proof

Date: 2026-08-09
PR: #121328
Merge: f4e62523afe8c98aba0c36ff36cfc8d3ab11d316

Isolation

  • Disposable local bare Git remote and clones under /tmp
  • Isolated HOME, OPENCLAW_STATE_DIR, config, logs, and loopback port
  • Foreground Gateway only; no launchd/systemd service
  • No Team gateway or operator state/config access

Scenario

  1. Gateway clone started on tracked main at A (f4e62523afe8c98aba0c36ff36cfc8d3ab11d316).
  2. Local remote main advanced to B (107f50395c52fe6aa4b71fecf615f779eeb02218).
  3. Live update.status reported one commit behind and announced a pinned B campaign with upstreamRef: origin/main.
  4. Live update.run performed preflight, dependency install, build, doctor, exact-SHA verification, receipt persistence, and SIGUSR1 restart.
  5. Restarted Gateway ran detached at B. update.status reported status: current, preserved installedAtMs, and did not report no-upstream.
  6. Local remote advanced to C (f00b4b88d07dbbb20a9c3f8242dce706b828c6b2).
  7. The detached B Gateway reported one commit behind. On startup it announced a second pinned campaign targeting exact C.
  8. A second live update.run applied B→C, persisted upstreamRef: origin/main, and restarted automatically.
  9. Restarted Gateway ran detached at C and reported status: current with the new verified install time.

Fault injection

The first A→B attempt intentionally exposed a scenario dependency mismatch: copied node_modules required a noninteractive purge, and pnpm install refused without CI=true. The updater failed visibly, wrote an error sentinel, and restored clean tracked A/main. After aligning the isolated dependency tree and running the Gateway with noninteractive CI semantics, the exact same product path passed. No product change was needed.

Result

PASS — pinned dev updates retain exact detached SHAs, restart receipts preserve the authoritative upstream, update status remains current/behind, and subsequent automatic campaigns continue across repeated update/restart cycles.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 10, 2026
steipete added a commit that referenced this pull request Aug 10, 2026
…ails

A campaign apply that succeeds at the git level but fails its managed-service
handoff (e.g. a post-restart health-probe false negative under SQLite load)
marked the update sentinel "error", so the #121328 receipt-backed upstream
fallback never engaged and dev campaigns stalled silently on "no-upstream"
until manual branch re-attach. The receipt now records the install fact
proven by the running process (git mode, root + revision verified, install
changed) regardless of sentinel status; the reader and store drop their
redundant success gates; the concept is renamed Successful* -> Verified*.
Receipt writes are scoped to git mode (the only mode ever read), so dead
npm-mode rows can no longer clobber a valid git receipt.

Fixes #121634
steipete added a commit that referenced this pull request Aug 10, 2026
…ails (#121664)

A campaign apply that succeeds at the git level but fails its managed-service
handoff (e.g. a post-restart health-probe false negative under SQLite load)
marked the update sentinel "error", so the #121328 receipt-backed upstream
fallback never engaged and dev campaigns stalled silently on "no-upstream"
until manual branch re-attach. The receipt now records the install fact
proven by the running process (git mode, root + revision verified, install
changed) regardless of sentinel status; the reader and store drop their
redundant success gates; the concept is renamed Successful* -> Verified*.
Receipt writes are scoped to git mode (the only mode ever read), so dead
npm-mode rows can no longer clobber a valid git receipt.

Fixes #121634
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 11, 2026
…ails (openclaw#121664)

A campaign apply that succeeds at the git level but fails its managed-service
handoff (e.g. a post-restart health-probe false negative under SQLite load)
marked the update sentinel "error", so the openclaw#121328 receipt-backed upstream
fallback never engaged and dev campaigns stalled silently on "no-upstream"
until manual branch re-attach. The receipt now records the install fact
proven by the running process (git mode, root + revision verified, install
changed) regardless of sentinel status; the reader and store drop their
redundant success gates; the concept is renamed Successful* -> Verified*.
Receipt writes are scoped to git mode (the only mode ever read), so dead
npm-mode rows can no longer clobber a valid git receipt.

Fixes openclaw#121634
Rorqualx pushed a commit to Rorqualx/cortex that referenced this pull request Aug 13, 2026
…ream

The 2026-08-12 resync left this file a hybrid merge that dropped upstream's
handoff rework while its callers and tests already expected the new API:

- root-mismatch binding (openclaw#121288): concurrent handoffs across distinct install
  roots silently coalesced instead of rejecting; single-flight test failed
  ("promise resolved 'joined' instead of rejecting").
- tag threading (openclaw#121328): callers pass `tag` via a conditional spread that
  bypasses TS excess-property checking, so the pinned/adopted target version was
  silently dropped and a moving channel could update to the wrong version.
- externally-supervised state-drift guard (openclaw#121069): the detached update helper
  could write/migrate an externally-supervised gateway's shared SQLite.

Take upstream's file wholesale — no fork-specific logic in it; callers and all
four handoff test files are already byte-identical to upstream. Verified: repro
test now passes, all 4 handoff test files green (28 passed), tsgo:core update
surface clean, autoreview clean.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes gateway Gateway runtime maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant