Repository navigation
fix(update): build adopted immutable releases without an isolated build account - #176532
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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs real behavior proof before merge. What this changesThis PR lets adopted immutable installations build as the operator when no separate build account is recorded and exposes that provenance in update status and Doctor. Example: A root operator prepares another official-main release on an adopted Linux installation without descriptor.build.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 5 items remain Keep open: this maintainer-owned PR addresses a current immutable-update refusal, but its new cgroup mock violates the required CI ratchet. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe immutable updater takes an adopted installation and exact official commit, builds in private staging, settles descendants, verifies and seals the artifact, and publishes a prepared generation for the activation owner. flowchart TD
A[Update CLI] --> B[Immutable preparation owner]
B --> C[Build identity selection]
C --> D[Restricted systemd worker]
D --> E[Descendant settlement]
E --> F[Materialize and record provenance]
F --> G[Verify seal and publish]
G --> H[Activation owner]
Technical reviewBest possible solution: Keep the approved fallback in the existing build owner, repair the mock ratchet violation, and establish native isolation before merging. Do we have a high-confidence way to reproduce the issue? Current main explicitly rejects preparation without descriptor.build, while CLI adoption does not provision that identity; no target code was executed during this read-only review. Is this the best way to solve the issue? Using the existing worker and publication owner is the smallest coherent implementation of the approved fallback, with artifact provenance avoiding a competing control-state representation. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d390c9c9dee5. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: The accepted root fallback still needs native evidence that candidate execution cannot cross the retained filesystem and publication boundaries. EvidenceWhat I checked:
PR surfaceSource +78, Tests +214, Docs +7. Total +299 across 15 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 Reviewed October 18, 2026, 6:10 PM ET / 22:10 UTC. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7b4e50c59f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| } | ||
| throw new Error( | ||
| `No non-root immutable build owner could be determined; no changes were made. Run openclaw update as the service user, or provision the isolated build account: ${provisioning}.`, |
There was a problem hiding this comment.
Stop recommending a caller mode that preparation rejects
When root cannot resolve a non-root build owner, this error tells the operator to retry as the service user, but every non-dry-run preparation calls requireUpdater() first, which rejects any effective UID other than 0. The documented non-root branch is therefore unreachable through openclaw update, leaving affected users with a recovery step that can never succeed; either support that invocation path or provide an actionable root-side remedy.
AGENTS.md reference: AGENTS.md:L73-L76
Useful? React with 👍 / 👎.
Use the existing sealed staging worker when no isolated build identity is provisioned, and warn on operator builds. Record build provenance in the sealed release for status and Doctor without changing immutable control descriptors. Refs #168237
Resolve a non-root owner before writer admission, emit the selected-account warning immediately, and retain the identity in sealed release provenance. Restore the build worker root guard and verify staging access under its actual identity. Refs #168237
73557a4 to
ed106a3
Compare
…enclaw#176532) Immutable-layout installs adopted via adopt-immutable have no isolated build account (descriptor.build, openclaw#168237), so every update refused. When no build account is provisioned, the update now builds the candidate as a proven non-root account (the invoking operator, or when run as root, the install's non-root owner from the service definition or install ownership), warns at selection time, and records the build account/UID/GID in the sealed build-info.json for status and Doctor. If no non-root account can be established the update refuses before any mutation; the build worker independently rejects root. Provisioned build accounts and seal verification are unchanged. The fallback runs with that account's own authority (including its groups); provisioning the isolated build account restores full isolation. Refs openclaw#168237
Refs #168237
What Problem This Solves
Adopted immutable installations cannot provision the separate build identity yet, so requiring it makes every update fail. Preparation now falls back to an unprivileged operator account and warns about the missing isolation. Candidate dependency installation and build scripts never run as root through this fallback.
Behavior
A non-root caller keeps its identity. A root updater resolves a non-root owner from the recorded Gateway service account or actual installation/state-directory ownership, resolves its numeric UID/GID and account home, and uses the verified service toolchain path. If no non-root owner can be resolved, preparation refuses before acquiring the writer or creating staging, with instructions to run as the service user or provision the isolated build account. The worker independently rejects UID 0. Provisioned isolated-account checks and malformed/unreadable descriptor refusals remain intact.
Both account choices use the existing restricted systemd worker, private build/home/temp directories, exact-SHA acquisition, cgroup settlement, verification, sealing and publication owners. The root-owned outer directory permits traversal during the build, then becomes private before materialization. The warning names the selected account, appears immediately on stderr (including JSON mode), and remains in the update result. Sealed
dist/build-info.jsonrecordsbuiltBy: operator,isolation: none, account, UID and GID; Status and Doctor read those facts. No config option, dependency, SQLite schema or descriptor-version change.Evidence
Rebased head:
ed106a361c4763cf7a394a14c8f5e69c84b10df2, based on6a43904e70446a7c9793f5e12e301c7e1f622ce5.The conflict with #176488 was confined to
src/cli/update-cli.immutable.test.ts. The resolution retains main's consolidated preparation/refusal tests and helpers, adds the warning callback to its preparation expectation, and preserves immediate human/JSON warning assertions. The production patches are unchanged; the SQLite/mock repair commit is patch-identical after rebase.--no-merge-base. Targeted tsgo, oxlint, oxfmt andgit diff --checkpassed. The default typecheck selection lackedtsrs/package.json; the repository-supportedOPENCLAW_TYPECHECKER=tsgoselection passed without modifying dependencies.Clean-main comparison
After committing all work, the same assigned worktree was temporarily detached at clean main
6a43904e70446a7c9793f5e12e301c7e1f622ce5; no stash was used. The exact same full-file Node command ran to completion on main and on the rebased branch:Main exited 1: 1 passed / 30 failed, 180.47 s Vitest / 366.37 s wrapper. Its first failure was
src/cli/update-cli/status.test.ts > local replacement (JSON: false, remote: false)(34.583 s):SQLite read-only worker snapshot cleanup failed, caused bySQLite snapshot still belongs to an active readerinsqlite-readonly-location-cleanup.ts(assertSnapshotReadersRetired/sealRetainedSnapshotTempDirectory). The retained cleanup failure cascaded through subsequent cases and teardown. That test passes on this branch, and the whole branch status file passes. The previously observedlocal replacement (JSON: true, remote: false)history omission did not reproduce on either checkout: main 19.006 s, branch 27.850 s. The clean-main cleanup failure is outside this PR; the old JSON-omission observation is not claimed as reproduced or fixed.Regression and cost notes
The prior unsafe-history CI failure came from fixture setup:
vi.resetModules()does not clear safe native SQLite admission retained in worker environment data. The fixture now saves, clears and restores that admission, following the SQLite owner's test pattern. All existing unsafe-version refusal, diagnostics, availability and retained-history assertions remain. Four mocks spreadimportOriginal, and exactly three obsolete mock-export baseline entries were removed.Current focused coverage includes non-root operator, root/service owner, stat-based owner, root-only refusal before writer admission, unchanged provisioned builds, invalid/unreadable descriptors, immediate human/JSON warnings, recorded identity, worker root rejection and seal-failure preservation. The immutable-install dry-run case took 42.543 s under Node and 45.975 s under Bun; the CLI file took 136.35 s with 88% transformation. These costs are recorded without timeout, retry or assertion changes. The full
check:changedSQLite inventory is omitted under the campaign's host-time budget; PR CI supplies broad proof.All runs use isolated
HOMEandOPENCLAW_STATE_DIR. Linux/systemd identity and execution are projected at the OS boundary; real fixture files exercise staging, provenance, verification/sealing and publication preservation. This is not a live Linux install/build/activation claim. No live Linux run was repeated for this rebase.Focused commands:
Pre-publish
git fetch origin maincompleted at77a403f1c15380ce71fcc53f0bb68ce5f4f2794e. No commits since the tested rebase base touched this PR's production/test owners or documentation. The later mock-export baseline change indc6b38a0d98eremoves an unrelated cron entry. The PR remained open/non-draft at the expected old head before the single force-with-lease push.Whole-PR LOC against the rebased main: production +311/-72, tests +440/-13, docs +21/-5, baseline 0/-3; +772/-93 total. This rebase adds no production behavior beyond the reviewed feature and safety repair.