Skip to content

feat(update): support root-owned foreground FreeBSD updates - #149882

Draft
vincentkoc wants to merge 94 commits into
mainfrom
feat/freebsd-foreground-update
Draft

vincentkoc wants to merge 94 commits into
mainfrom
feat/freebsd-foreground-update

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Related: #45233 and #147681

What Problem This Solves

FreeBSD needs a foreground update path owned by the installation account. Package, state and history writes must stop when their canonical ownership changes, including across asynchronous staging, Doctor/finalizer workers and restart notices. Diagnostic failures must preserve the original cause without leaking transactions or granting write authority.

Current signed head: aca8f05544e2f77f255fb411b1298974c20f60af, tree dd92b4bf50f2aa05d44e289bfd4fbed1f7e0ea5e. This correction composes the preserved implementation with frozen main c6b21f6f086a8f3c16bbd37eb143906c9035a09e.

User Impact and Ownership

The installation-owning account, including an ordinary account, can use openclaw update and openclaw update --dry-run. --no-restart remains optional. Stop a foreground Gateway through its existing process owner first; active Gateway/state leases and foreign installation owners still exclude writes. Pkg/Ports installations retain their package-manager owner.

FreeBSD rc.d discovery is advisory. It adds no service start/stop/restart, automatic-update or API/campaign authority. An older installed updater that refuses FreeBSD before staging still needs the documented manual package-manager replacement; a candidate cannot patch an already-running parent.

The existing executor owns admission and worker grants. One synchronous SQLite transaction owner, admission registry and terminal-handle fence serve reporters and heartbeat. A run-owned ledger binding pins environment, selectors, run identity and canonical file generation. Replacement latches the first refusal; restart notices and fresh worker receivers enforce it before publication. Deferred parents cannot recapture a replacement.

Both executor activation boundaries revoke authority on canonical nested cleanup failure and rethrow the original error. Direct pre-release refusal and plain-timeout behavior remain distinct. Canonical c6b retained-history initialization, cloned worker environment/admission, immediate SQLite freshness and preactivation recovery remain in place.

Warning delivery uses one logging-free helper at the connected transaction/coordinator sites. It cannot replace SQL, admission, commit, rollback or service errors. FreeBSD package inspection preserves native causes and exposes only a bounded operation/error-code or shared-budget summary. These diagnostics do not establish the cause of earlier ARM failures.

Canonical upstream fixture fixes, including Peter Steinberger’s Gateway fixture correction, retain their author and commit provenance. The separate S fixture backport retains its upstream co-author credits.

The official 2026.9.6 compatibility row preserves older rows and carries all 39 required members. The bridge resolver excludes the separate native-hook-relay graph while retaining canonical aliases and genuine ambiguity refusal. The emitted callGateway bridge resolves to the root runtime graph.

Validation

  • Exact P tree dd92: canonical Gateway pair 16 PASS and executor settlement 26 PASS, zero skips/errors; 130-file lint, core, seven selected test graphs, root and scripts types passed. Source-before/tests-after/source-after inventories match. Command/archive/native exits were 0; independent custody and complete lease settlement were authenticated.
  • Historical source: a9 had 30 focused files / 2,187 PASS and runtime-postbuild 136 PASS. The final four-file owner/type move was +41/-39 and its three affected tests reran on dd92. The earlier full run is not relabeled as an exact-dd92 run.
  • Fresh combined build/package: producer 35952629437, attempt 1 succeeded for signed composite dc432efeb910a26f15156fc2961265c75c79ff2c, tree 726f72214c70e9a5d5829092ae32d044f5a67150, ordered parents P aca8 and S 5dd54332e20fdb92a8621bd88a338470b0ae2e03. Full custody verified 49,166 source entries before=after, 12,814 package files, all 39 bridges and emitted finalizer bytes. Candidate: 98,546,657 bytes, SHA-256 dcaff69b99ce02a670312c76e0717f4c6c89a317a6328c471d9be856aae86fea; seal 6dcf9cb1363a54573bc11ad967e9eb11064d4dc14592cfad21b9f25052f3e7fc. This is combined P/S build evidence, not an isolated P build.
  • Actual published 2026.9.6 first hop: the released eb377 launcher updated to that sealed product using a fixture that changes only three metadata members. All 14 steps succeeded, including package swap and Gateway verification; the real Gateway PID changed, canonical installed content checked 10,917 entries with no errors, residue was empty, and service/mock cleanup completed. The positive lane itself returned 0 with qualified=true and matching post-lane source. Scope: Linux x64, Node 24.19, manager shim.
  • Retained failure boundaries: the enclosing two-lane command returned 1 because its later timing observer missed the worker and sent no signal. A subsequent invocation-only preload also sent no signal; its archive omitted two unreadable evidence copies. Both remain unqualified. The corrected service-owned preload control independently passed with one guarded worker fault, exact S reason and complete cleanup, but that control did not run an updater. The actual updater refusal-only successor is now in progress; no negative-result pass is claimed.
  • Separate test-source correction: S's canonical two-test-file backport is 4c226077e8dd7b4db2a5312fec2b8506e4694a0b. Independent full-tree comparison confirms all other 49,139 paths and all package/build/dependency inputs are unchanged from S 5dd. The frozen runtime target remains dc432; no old source/build receipt is relabeled as the new S test head.

Current Gates and Limits

Exact aca8 ordinary CI, the protected-main AWS publisher and final exact-head review are pending. The streaming publisher repair landed as 81fdcbd01c2288954b1983e0251ec3a479c2397c; this publication is its first actual protected-main continuation. Publication alone is not a successful publisher rollout or landing proof.

The existing three-cell FreeBSD matrix remains pending: ARM root fresh, ARM ordinary fresh, and x64 ordinary seeded. Its source/package custody stays bound to dc432; the reviewed S test head is a separate identity. No native FreeBSD, rc.d restart, native systemd, ARM source Vitest or model-inference qualification is inferred from Linux/package evidence.

Earlier f7 native failures remain historical: ARM root package inspection lost its original errno/budget cause; ARM ordinary reported candidate Doctor lint refusal before later cancellation and lacked final updater/source-after/guest-settlement receipts. Earlier 892e native results and their startup, lock and interrupted-capture gaps are not current-head proof. Recovery-wait and S diagnostic work retain their separate scopes: #156523 and #156547.

Auto-merge remains disabled. No merge, release, deployment or repair of an unobserved ARM cause is claimed. The temporary proof PR remains unmerged.

Scope

Final production/tooling +2,522/-1,598 (net +924); tests/test support net +3,828; metadata net +1,194, counted separately. Production growth owns foreground installation custody, worker/ledger write authority, canonical transaction/error handling and installed-updater compatibility. The final owner move is net +2 and adds no runtime branch. No duplicate transaction engine, environment-keyed authority registry or compatibility re-export remains.

@vincentkoc vincentkoc self-assigned this Sep 16, 2026
@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 gateway Gateway runtime cli CLI command changes commands Command implementations size: XL maintainer Maintainer-authored PR labels Sep 16, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 24, 2026, 3:58 AM ET / 07:58 UTC (Revision 56).

ClawSweeper review

What this changes

The branch adds foreground FreeBSD update admission and package-ownership checks, revises update history and worker authority handling, and changes shared SQLite transaction reporting, diagnostics, tests, and documentation.

Merge readiness

⛔ Blocked before merge - 11 items remain

This maintainer-owned draft remains useful as source work, but its author has explicitly parked the combined branch. Current main still lacks the foreground FreeBSD update path, and a previously reported live-lease gap remains in the proposed history writer.

Priority: P2
Reviewed head: aca8f05544e2f77f255fb411b1298974c20f60af

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The branch has substantial focused validation and a linked Linux upgrade result, but the live-authority finding and absent native final-effect proof keep it below merge readiness.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: Authority-chain proof required: the branch changes the FreeBSD executor and SQLite history-write authority. The PR body describes a Linux x64 published-updater package swap and Gateway restart, but reports no current native FreeBSD allowed-owner and nearest revoked-owner final-effect result; the three native cells remain pending. No stored-data shape change was identified. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦪 silver shellfish (2/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: Authority-chain proof required: the branch changes the FreeBSD executor and SQLite history-write authority. The PR body describes a Linux x64 published-updater package swap and Gateway restart, but reports no current native FreeBSD allowed-owner and nearest revoked-owner final-effect result; the three native cells remain pending. No stored-data shape change was identified. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 10 items Introduced history-write boundary: The new FreeBSD history callback checks its local admission latch, run selectors, and database identity, but does not check the live executor lease.
Live lease owner: The executor has a separate native ownership check against the current lease; the history callback does not invoke it.
History commit path: The existing-state transaction calls the supplied assertion before and during its synchronous write, so the callback's missing live-lease check reaches the final write boundary.
Findings 1 actionable finding [P1] Recheck the native lease before writing update history
Security Needs attention Stale executor can retain history-write authority: The local admission latch can remain true after the native lease is replaced, allowing the former owner to write update history before another executor check revokes it.

How this fits together

The update command checks the installation, package, service, and state owners before staging a replacement. Its executor and workers then perform the update and publish history, diagnostics, and restart outcomes.

flowchart LR
A[Update command] --> B[Installation and package checks]
B --> C[Live executor lease]
C --> D[Package update and Doctor]
C --> E[History writer]
D --> F[Result and restart notice]
E --> F
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: Authority-chain proof required: the branch changes the FreeBSD executor and SQLite history-write authority. The PR body describes a Linux x64 published-updater package swap and Gateway restart, but reports no current native FreeBSD allowed-owner and nearest revoked-owner final-effect result; the three native cells remain pending. No stored-data shape change was identified. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Recheck the native lease before writing update history (P1) - The new writer callback checks the local admission latch and database identity but never calls the live executor lease assertion. A lease replaced after preflight can therefore remain writable through a progress, heartbeat, or terminal-history commit until another path observes the replacement. Bind live executor authority into the final write check, including initial run creation; this remains the prior review's unresolved finding.
  • Resolve security concern: Stale executor can retain history-write authority - The local admission latch can remain true after the native lease is replaced, allowing the former owner to write update history before another executor check revokes it.
  • Resolve merge risk (P1) - A replaced native executor lease can remain unobserved by the new history writer and permit a stale owner to commit update history.
  • Resolve merge risk (P1) - The current-source FreeBSD allowed-owner and revoked-owner final effects remain unqualified on native FreeBSD; the Linux published-updater result does not establish those outcomes.
  • Resolve merge risk (P1) - The branch changes shared update and SQLite transaction paths, while exact-head native and published-upgrade compatibility across the affected platforms remains unestablished.
  • Complete next step (P2) - Keep the combined branch parked; if it is revived, repair the history-write lease check and provide native authority and upgrade proof before merge.
  • Improve patch quality - Bind initial and subsequent history writes to the current native executor lease at the final SQLite write.
  • Improve patch quality - If this work is revived, show native FreeBSD allowed-owner and revoked-owner final effects for the changed update path.
  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.

Findings

  • [P1] Recheck the native lease before writing update history — src/cli/update-cli/update-command-ledger.ts:48-49
  • [medium] Stale executor can retain history-write authority — src/cli/update-cli/update-command-ledger.ts:48
Agent review details

Security

Needs attention: The new FreeBSD history admission does not revalidate live executor authority at its final write boundary.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

None.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/state/openclaw-state-ownership-error.ts, migration/backfill/repair: src/state/openclaw-state-ownership.ts, unknown-truncated-pull-files. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Keep the scope reset (recommended)
    Preserve this draft for reference and evaluate the needed updater, service, and SQLite changes as separate owner-scoped work.
  2. Revive only after requalification
    Repair the final-write lease check and establish native allowed and revoked outcomes plus upgrade compatibility before resuming this branch.

Technical review

Best possible solution:

Keep the combined draft as source material and develop small owner-scoped changes against current main, with live executor authority checked at each final write and native FreeBSD update outcomes proved before landing.

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

No direct native reproduction is recorded for the proposed FreeBSD path or lease-replacement failure. Source inspection identifies the final history-write path and its missing live-lease assertion.

Is this the best way to solve the issue?

No. The combined branch spans several owners and retains an authority gap; the author's proposed scope reset to narrower owner-scoped changes is the safer path.

Full review comments:

  • [P1] Recheck the native lease before writing update history — src/cli/update-cli/update-command-ledger.ts:48-49
    The new writer callback checks the local admission latch and database identity but never calls the live executor lease assertion. A lease replaced after preflight can therefore remain writable through a progress, heartbeat, or terminal-history commit until another path observes the replacement. Bind live executor authority into the final write check, including initial run creation; this remains the prior review's unresolved finding.
    Confidence: 0.89

Overall correctness: patch is incorrect
Overall confidence: 0.9

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 163cd10bfa83.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The proposed FreeBSD improvement has a bounded platform scope, but its authority gap and missing native qualification prevent landing.
  • merge-risk: 🚨 security-boundary: The introduced history callback can reach a SQLite write without rechecking the current native executor lease.
  • merge-risk: 🚨 compatibility: Shared updater and transaction changes affect existing update paths, and the current combined branch lacks complete native and upgrade qualification.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Authority-chain proof required: the branch changes the FreeBSD executor and SQLite history-write authority. The PR body describes a Linux x64 published-updater package swap and Gateway restart, but reports no current native FreeBSD allowed-owner and nearest revoked-owner final-effect result; the three native cells remain pending. No stored-data shape change was identified. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Security concerns:

  • [medium] Stale executor can retain history-write authority — src/cli/update-cli/update-command-ledger.ts:48
    The local admission latch can remain true after the native lease is replaced, allowing the former owner to write update history before another executor check revokes it.
    Confidence: 0.88

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Dallin Romney: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; 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 (55 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-23T06:02:59.647Z sha 6df9d25 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-23T09:56:06.779Z sha f7ad18d :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-23T10:24:13.568Z sha f7ad18d :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-23T13:04:01.474Z sha 2b6f87f :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-23T13:41:32.724Z sha d165d04 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-23T15:45:30.635Z sha 273d7aa :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-23T16:19:58.252Z sha 3c8392a :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-24T07:35:01.184Z sha aca8f05 :: needs real behavior proof before merge. :: [P1] Recheck the native lease before active history writes

@vincentkoc
vincentkoc force-pushed the feat/freebsd-foreground-update branch from c927eb9 to 8af5c0a Compare September 16, 2026 08:32
@vincentkoc
vincentkoc force-pushed the feat/freebsd-foreground-update branch from 8af5c0a to f9a7c11 Compare September 16, 2026 09:03
@vincentkoc
vincentkoc force-pushed the feat/freebsd-foreground-update branch from f9a7c11 to ae2fc1d Compare September 16, 2026 09:07
@vincentkoc
vincentkoc force-pushed the feat/freebsd-foreground-update branch from ae2fc1d to cf932c2 Compare September 16, 2026 10:21
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 16, 2026

This branch has not been deployed

No deployments
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 dependencies-changed PR changes dependency-related files docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants