Repository navigation
fix(update): prevent stale children from changing native services - #143905
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. |
Keep original-root and immediate-spawner custody through native command and capability-probe lifetimes. Nest child keys for subtree exclusion, bind actual process identities before input, and fence native process, file, and configuration effects. Preserve ordinary commands and reject unsupported update-owned fallbacks.
5e3fe4c to
a465b4d
Compare
|
Codex review: blocked before merge. Reviewed September 11, 2026, 1:09 PM ET / 17:09 UTC (Revision 13). ClawSweeper reviewWhat this changesBind updater-launched native service commands and configuration writes to live update ownership, preserve older finalizer completion, and accept successfully settled cooperative capability probes. Merge readiness⛔ Blocked before merge - 2 items remain This PR remains necessary: current main lacks the native-child authority handoff. Earlier compatibility findings are repaired, and the latest cooperative-cleanup correction preserves the rejection safeguards. No blocking correctness finding remains. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s updater launches the target installation’s CLI to manage Gateway services. Installation leases and registered child processes determine whether those commands may change service files, processes, or configuration. flowchart TD
A[Update or Doctor request] --> B[Original installation lease]
B --> C[Registered target CLI child]
C --> D{Target supported and owners current?}
D -->|Yes| E[Native service and config effects]
D -->|No| F[Refuse mutation]
E --> G[Join descendants and release leases]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +807, Tests +2632, Docs +21. Total +3460 across 55 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the maintainer-accepted updater-only refusal boundary, with one live ownership chain through native effects and proven completion for shipped legacy finalizers. Do we have a high-confidence way to reproduce the issue? Yes: current-main source exposes the unbound native-child path, and recorded real-process controls demonstrate stale-owner effects and their refusal after repair. This read-only review did not execute those controls. Is this the best way to solve the issue? Yes: extending the existing installation lease owner avoids competing authority stores, and accepting cooperative cleanup matches the runner’s joined-extinction contract without accepting forced or uncertain cleanup. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7af0464ba960. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (12 earlier review cycles; latest 8 shown)
|
Qualified landing candidate; publication awaiting signingLanding continuation for our native-child custody component, reconciled with main through The fresh finite composed proof uses the actual original executor, intermediate delegated process, registered private-stdin Gateway receiver, and real disposable native/configuration sinks. It covers healthy changed-root execution, real original-owner and immediate-spawner row replacement, actual spawner death with a surviving registered receiver, config pre-commit revocation, retained exclusion at both roots, and fresh ownership after settlement. Earlier isolated upgrade/finalizer recovery coverage is preserved, not presented as installed-service proof. Scoped integration review found receiver-root and original-lineage substitution gaps. Both reproduced and are fixed. Follow-up real receiver tests also reproduced and now refuse equal-row database copies and stripped database pins. Admission correlates original/spawner/active-root and the captured physical database identity with the recorded registrations; it still requires current rows and actual PID/start identity. Shipped plain grants retain their old fence-only behavior without gaining the new native/nested capability. No lease schema or second store was introduced. Final-source checks:
Review disposition is findings resolved with preserved red/green evidence, not a second clean-review claim. Main's retired post-activation stop branch remains retired. Operator services and shared installed HOLD were untouched; disposable definition/config writes are not a claim of installed recovery or completion of the broader recovery journey. The native publisher refused the unsigned merge because its GitHub API path cannot preserve merge ancestry. The remote remains |
|
@clawsweeper re-review The signing blocker is resolved. The native publisher verified the remote head and exact qualified tree. The signed commit preserves the unsigned checkpoint's tree, parents and message. The PR is now mergeable. Landing continuation for our native-child custody component, reconciled with main through The fresh finite composed proof uses the actual original executor, intermediate delegated process, registered private-stdin Gateway receiver, and real disposable native/configuration sinks. It covers healthy changed-root execution, real original-owner and immediate-spawner row replacement, actual spawner death with a surviving registered receiver, config pre-commit revocation, retained exclusion at both roots, and fresh ownership after settlement. Earlier isolated upgrade/finalizer recovery coverage is preserved, not presented as installed-service proof. Scoped integration review found receiver-root and original-lineage substitution gaps. Both reproduced and are fixed. Follow-up real receiver tests also reproduced and now refuse equal-row database copies and stripped database pins. Admission correlates original/spawner/active-root and the captured physical database identity with the recorded registrations; it still requires current rows and actual PID/start identity. Shipped plain grants retain their old fence-only behavior without gaining the new native/nested capability. No lease schema or second store was introduced. Final-source checks:
Review disposition is findings resolved with preserved red/green evidence, not a second clean-review claim. Main's retired post-activation stop branch remains retired. Operator services and shared installed HOLD were untouched; disposable definition/config writes are not a claim of installed recovery or completion of the broader recovery journey. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Published 4255c6b through native preparation, with verified signature and exact qualified tree. CI34623288834 passed the real v2026.9.3 published-upgrade Docker test. Its compact18 failure stopped a legacy revoked control at capability admission before receiver. A new actual-child/descendant regression proved a false refusal: code0/exit, exact real receiver capability output, cooperative cleanup and confirmed group/descendant extinction, yet unsupported. Forced cleanup still refused. The caller now accepts only normal/cooperative successful settled exits, also requiring null signal/not killed and all prior output/current-authority checks. No timeout or cleanup implementation change.
Revision12 already accepted the terminal component authority and legacy compatibility proof. Retain the documented updater-only fail-closed compatibility boundary; no lease schema/store change and no full installed/HOLD recovery claim. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
install.test.ts crossed the 1000-line cap when #143905 added an authority case, so every pull request merging main now fails lint on a file it never touched. expectFields asserts named fields and touches none of this suite's mocks, so it belongs in the existing sibling helper module rather than here.
…enclaw#143905) * fix(update): prevent stale children from changing native services Keep original-root and immediate-spawner custody through native command and capability-probe lifetimes. Nest child keys for subtree exclusion, bind actual process identities before input, and fence native process, file, and configuration effects. Preserve ordinary commands and reject unsupported update-owned fallbacks. * test(update): separate lifecycle transport from executor custody * fix(update): admit native targets before activation * fix(update): preserve Doctor executor through native recovery * fix(cli): preserve upstream service install guidance * test: run native custody controls in process lane * fix(update): preserve native completion for legacy finalizers * fix(update): restore legacy finalizer lease domain * fix(update): accept settled cooperative capability probes
rebase 時のコンフリクト解決 (onto 92635da, 元コミット 119f95fdaa6): - 上流 openclaw#143905/openclaw#147242 で safe RPC restart 分岐に assertGatewayServiceFallbackAllowed("safe RPC restart") が追加された。 本コミットは safe 分岐を external-supervisor 判定より前へ移し暗黙 safe 判定を 足しているため、移動先の分岐に上流のガードを取り込み、旧位置の重複分岐は削除
rebase 時のコンフリクト解決 (onto 92635da, 元コミット 119f95fdaa6): - 上流 openclaw#143905/openclaw#147242 で safe RPC restart 分岐に assertGatewayServiceFallbackAllowed("safe RPC restart") が追加された。 本コミットは safe 分岐を external-supervisor 判定より前へ移し暗黙 safe 判定を 足しているため、移動先の分岐に上流のガードを取り込み、旧位置の重複分岐は削除 rebase 時のコンフリクト解決 (onto 57fd13e, 元コミット 21f40bf994c): - 上流 8b680f3 (openclaw#178163) が createSafeGatewayRestartPreflight の inspectors 引数と SafeRestartInspectors 型を削除。引数なしの形に合わせ、 session admission / mutation を 0 に固定するスタブだけを外して実数で数える - 上流 c268b9d (openclaw#181608) が SafeRestartTarget 型を引数へインライン化。 インライン型のまま transport 引数を追加 - 上流がテストを describe なしのトップレベル it と、実モジュールの spy による カウンタ差し替えに書き直したため、両テストファイルは上流版を基に 本コミットのケースを追加。restart-coordinator.test.ts は session-controller.lifecycle.js を spy して admitted turn を 1 件にする rebase 時の調整 (onto 258d034, 元コミット 76c4af4b6cc): - restart-suspension.test.ts: 上流 36e277d (openclaw#175837) が session-lifecycle-admission.js を session controller へ統合して削除し、 上流 f27df1d (openclaw#165330) が scheduleGatewayRestart の skipCooldown を 削除していた。どちらも前回のベース (57fd13e) より前の変更で、 このファイルは読み込みに失敗し上流分を含む全テストが動いていなかった。 後継の beginSessionEffect / getSessionControllerWorkCount (session-controller.lifecycle.js) へ置き換え、skipCooldown を外した。 クールダウンは直前に再起動を発信した場合だけ掛かるため、外しても挙動は同じ rebase 時のコンフリクト解決 (onto 638a185, 元コミット a06162363f5): - 上流が lifecycle-safe-restart.ts に restartFlagConflictError / assertNativeRestartFlags を追加し、runDaemonRestart の冒頭で呼ぶ形にした (--preserve-definition と --safe、 --skip-deferral の組み合わせ検査)。上流の2関数と呼び出しを残したまま shouldUseImplicitSafeRestart と requestSafeGatewayRestartIfNeeded の呼び出しを その直後に並べた (フラグ検査 → 暗黙 safe 判定 → external-supervisor の順)。 旧位置の `if (opts.safe)` 分岐は本コミットが既に削除済みで、重複は残っていない。
Latest: settled capability-probe correction (
4255c6b1d18e)CI34623288834 passed the actual published-upgrade Docker lane, but compact18 refused the legacy revoked case at its capability probe. A focused real-process control exposed a normal-only predicate: valid code-zero/exit capability output was refused after cooperative descendant cleanup, even with the actual process group and descendant extinct. The forced-cleanup control remained refused.
The caller now requires code zero, exit termination, null signal, not killed, complete exact capability output, current original authority, and normal or fully joined cooperative cleanup. It still requests complete process-tree extinction. Forced, uncertain, cancellation, timeout, stale authority, incomplete output and unsupported capabilities remain failures. No timeout or cleanup mechanism changed.
Eight affected native/legacy controls passed; both new controls passed on final source after a test-only shadowed-local rename. The changed runtime was rebuilt and all three affected compiled finalizer cases passed. Typed lint passes. The two-file scoped P0-P2 review was clean before that identifier-only correction; production bytes remain exactly reviewed. The final full canonical local gate is finishing, and fresh exact-head hosted CI is required. An unrelated unchanged Windows worker-artifact tooling test timed out in the old CI and is not being edited here. Earlier proof and failures remain preserved.
Related: #143791
Problem and scope
An interrupted update can leave a target-native command alive after its original owner or immediate spawner is revoked. This PR binds native receiver admission, process/file/signal effects, and configuration commits to the original update's live lease and registered process lineage. Unsupported targets refuse before stop/publication.
This is the native-child custody component and its public Doctor caller, not complete recovery-journey acceptance. The lease-store schema is unchanged.
Current published head:
231835929f940faaac8d273a8fcd441a2e6798a6, tree7cb9e913997da02ae3c0c770a136db1290e74552. The native publisher verified exact-tree equality and preserved the signed reconciliation parent7793e227. GitHub reports the PR mergeable.Mainline reconciliation
The landing continuation integrates main through
86cd546d0bbe5110e813961430e9c0d3946c768e, including #144778. A changed package generation retains both the original/spawner hierarchy and the active candidate-generation lease. The actual child PID/start identity binds both registrations before private input is delivered. Original revocation now refuses child effects, not merely eventual parent settlement. Root release remains blocked by surviving descendants.The already-landed #144328 retirement of the obsolete post-activation stop path is retained. The selected native caller supports install/restart, and its real-process fixture now uses restart/restarted. Ordinary Gateway stop remains supported by its own CLI registry.
Review correction
The scoped integration review found two related gaps. Both reproduced through the actual receiver: a target different from the active grant root, and a candidate mirror substituted for the original owner. The receiver now requires the active grant root to match its loaded target. Original/spawner/active-root records and the captured physical lease-database identity are correlated in the existing registered child names, with the same correlation on both root registrations. Current row and actual PID/start checks remain required; transported fields alone cannot select a replacement lineage. No lease schema or separate store was added. Stripping lineage fields from a modern registration refuses. The shipped UUID-only finalizer format now captures its existing physical database and retains its real original/registered-child authority before issuing fully bound modern descendants; see the correction below.
Review status is findings-resolved after the red/green corrections, not a second clean review.
Fresh composed proof
The new test in
update-command-executor-native.test.tsuses a real original executor, a real intermediate delegated process, a separately registered receiver, the actual private-stdin Gateway receiver, and actual disposable native/configuration sinks:execFileUtf8,publishLaunchAgentPlist, andcreateConfigIO().writeConfigFile; prior port/auth settings survive the config transition.All five distinct composed cases passed across preserved runs. The three new real-receiver substitution controls reproduced both review findings before correction. Two further real receiver controls reproduced and now refuse equal-row database copies, including stripped database pins. All 19 receiver/nested/composed cases and three rebuilt finalizer cases pass on final tree
4ccc401163a0afbbccd411c16ff9377304d41bbb. The earlier legacy probe established the historical fence-only behavior; the corrective section below supersedes that behavior to preserve shipped finalizer completion. Separate finalizer/upgrade-recovery controls passed 7 cases; owner/generation controls passed 19. The selected receiver fixture and final static checks are recorded in the landing comment at the exact published head. Earlier test setup and type failures remain preserved; they are not product passes.This proof performs real native command execution and definition/configuration writes in disposable paths. It does not install, stop, or replace an operator service. Finalizer/upgrade tests retain their existing isolated service-backend fixtures. It makes no claim of full recovery, later publication ordinals, or installed-service/HOLD acceptance.
Shipped finalizer correction
ClawSweeper revision 10 exposed a real v2026.9.4 compatibility failure: the admitted legacy finalizer could not create its nested native restart. CI 34618659283 also failed the actual v2026.9.3 published-upgrade lane because that older transport has no executor field. Both defects reproduced through the actual worker and native caller before repair.
The exact UUID-only legacy grant now pins the existing physical database and retains its live original/registered-child process lineage before creating fully bound descendants. The older grantless worker acquires exclusive original ownership before run adoption/effects; an incumbent prevents admission. Modern stripped-lineage and copied-database refusal remain intact. No lease schema, second store, global setting, or operator-service change.
On the current corrective source: 25 affected controls pass (19 modern and six legacy); rebuilt runtime and three finalizer controls pass; the canonical changed-source gate passes. A scoped independent P0–P2 review is clean for this four-file correction only. Earlier integration findings remain findings-resolved. Fresh exact-head CI, including the real published-upgrade Docker lane, is required before merge. Explicit disposable fixtures are not installed acceptance.
Grantless scratch-domain follow-up
Revision 11 correctly identified that v2026.9.3 overrides the child TEMP/TMP/TMPDIR for scratch work. Both normal-incumbent bypasses reproduced through actual worker/native effects. The one-shot worker now restores those selectors from the retained producer environment (
ownedManagedUpdateEnv ?? run.env) using the existing platform-aware lookup before lease admission. No alternative lease domain or caller-selected path is added.The new tests retain real
os.tmpdir()/secure filesystem resolution. Only the preferred-root location is a disposable unavailable path to exercise fallback on POSIX; Windows takes its normal fallback. Four final scratch-domain controls pass for both environment sources and healthy/incumbent cases. No scratch-local lease DB may appear. Seven affected checks passed before the platform lookup refinement; the rebuilt runtime and three compiled finalizer controls pass on final source. The complete changed-source gate and scoped P0–P2 correction review pass.CI34621166786 passed the real published-upgrade Docker lane. Its only failure was the composed healthy fixture requiring cleanup
normaldespite code0 and cooperative cleanup. The fixture now accepts normal/cooperative success and explicitly checks actual group/receiver extinction, root release, and fresh ownership. No timeout or production cleanup changed. That old failed CI is preserved; new exact-head hosted checks remain required.Checks and release-note context
The previous exact head
5690dd25a9a9f44812b3af894c113b4b6a1d266fpassed all 129 jobs in CI 34497808062. That evidence remains tied to that head. New exact-head hosted checks are required before landing this reconciliation.User-visible change: updates reject unsupported or stale native children before protected mutations, preserve original authority across destination-generation changes, and retain exclusion until descendant settlement. No package/launcher ownership or installed recovery HOLD is changed by this PR.
Preserved prior-head evidence and qualification history
Related: #143791
What problem this solves
An interrupted update could leave a target-native service command running after another update was admitted. The surviving command could still change service files, process state, or configuration under the old update.
Why this change was made
Reuse installation child grants for target-CLI native install, restart, stop, and capability-probe lifetimes. Nested callers retain both the original update owner and immediate spawner, bind actual PID/start identity before input, and retain exclusion until descendants settle. Hierarchical child keys keep descendants visible to intermediate and root release checks. Native process, file, signal, and config commit boundaries recheck authority.
The target receiver is bound separately to its destination package root; it does not replace the original installation's lease domain. Supported root/channel transitions retain original authority. Foreign destinations refuse. Candidate validation requires explicit destination-binding capability before native stop or package/Git activation, and the selected native caller rechecks capability later. Targets advertising only the earlier capability refuse before activation.
The public Doctor Git-update caller now owns one real executor across candidate validation, stop, update, same-owner recovery, and settlement. An additive runner callback probes native capability after existing config validation and before stop. History, failure reporting, and triage follow the complete outer executor result, including release failure. Recovery forwards the same original run/environment/fence instead of creating a restart-only lease.
Unsupported update-owned detached/unmanaged fallbacks refuse rather than starting unowned work. The missing-target old-runtime installer fallback is removed. Ordinary user-invoked Gateway commands retain their behavior.
User impact
Supported target-native update commands retain the original update's authority through completion. Revoked owners cannot start another protected native mutation or commit pending configuration. Replacement updates stay excluded while registered descendants remain live. Unsupported targets refuse before stop/publication rather than failing only after activation.
Evidence
targetRootBinding: trueadmission fixes it. The legacy response caused an accepted disposable effect in RED; all eight selected receiver/registered-CLI controls pass after correction. Review status is findings-resolved, not a new clean review.32da4b0cand again with compact6/18 in completed run34476330534.check:changedpassed on committed headadf04247f68f312b424b9156f3d792fc9a461380(treec63de19ea09f007d8db7d95c7abba27d06451a20), with normal commit hooks preserving the checked tree. That prior result is retained; hosted CI/native landing qualification must complete on the new integrated head.Current correction evidence
check:changedpassed on tree9a3747448f6fb295745ab6d4e17d0ec6b40574f1, committed unchanged as4b30bc680ac0d21db130fe0eaca5de5bac2f5efa.1e68cdd8; this does not substitute for composed authority-chain proof.4b30bc68: previous code findings addressed, no new blocking code defect; composed authority and upgrade evidence remain required.1e68cdd8899f2992a5cfef58cb629b079a3b3a60: both upstream install help strings and the unchanged hidden executor option are preserved. No runtime logic or assertion changes. The one-file required gate passed on exact committed tree057beb9a32cf57a86b5e26a9b5823e80873cbda7. All 13 correction files and the executor remain byte-identical.Navigation CI correction at
2fbc1a5b20cbd761c1cffc157559fb3f246c76ca1670c5a1) and fix(docs): detect missing navigation routes #144075 (46ffd899) through pinned mainecf8371c. The locale overlay and exact ordered navigation assertions match the split Releases/Contributing tabs; the hidden QA route is removed from public navigation, with its catalog assertion intact.2f5c96ac5a524aadf99aed549c6863a01f9c92022f114f605ef3cc774bb063be. Its embedded commit is2fbc1a5b20cb; the old package remains preserved.Source-process fixture ownership follow-up at
5690dd25a9a9Compact31 and compact33 passed in CI
34495320499. Compact18 exposed the earlier intermittent foreign-receiver refusal again: capability checking failed before the unchanged installation-binding assertion. The raw failed run is retained. Bounded local pass-through diagnostics returned valid capability and normal cleanup, so they do not establish the precise hosted refusal cause.The concrete test-owner mismatch is corrected by adding the unchanged
update-command-service-custody.test.tsto the existing CLI-process test list. That lane supplies isolated, serial execution and the already-establishedESBUILD_WORKER_THREADS=0source-child setting. The test is still executed, not skipped or disabled. No new runner, assertion edit, timeout increase, mock, capability-policy change, or production change. All five real receiver cases and the existing lane-ownership contract pass; independent P0/P1/P2 review is scoped-clean. Required tooling checks passed, and the normal commit hook preserved checked tree916d093b9a9db4517617c10b8f574f006ffdd7ab. Published commit:5690dd25a9a9f44812b3af894c113b4b6a1d266f. New exact-head CI attached automatically: 34497808062. No old-run retry or duplicate dispatch. The exact-head canonical build and package integrity passed: 67,942,400 bytes, SHA-256fdb06feffe56744a8710457546b9e204d18aca61719ec5eb68495e5da6bd88e7. The embedded build-info commit matches5690dd25a9a9f44812b3af894c113b4b6a1d266f; the earlier packages remain preserved.Hosted compact22/job
102941031293(actual hybrid profile) passed all five unchanged receiver cases, including foreign-installation refusal. Its process group passed 37/37 tests and cleanup verification. The test did not disappear from CI. The initial local default-profile mapping to compact27 was incorrect and is not used as evidence. Exact-head CI 34497808062 completed SUCCESS at5690dd25a9a9f44812b3af894c113b4b6a1d266f: 129/129 jobs complete, zero failures, including the requiredopenclaw/ci-gate, compact6/16/18/31/33, both Windows test jobs and the receiver process lane. No old-run retry or duplicate dispatch.Remaining qualification and boundaries
The genuine compact6 public-Doctor missing-executor defect is corrected by the qualified caller/runner/helper contribution in this head. This does not qualify all package/Git Doctor mutation children or plugin/fresh-finalizer paths. Exact new-head CI passed; old-head failures are preserved, not relabeled passing. The existing composed-proof requirement is still open.
Scope is target-CLI native custody and its public Doctor caller. Doctor/plugin children, in-process preparation/autostart, the separate deferred-load protocol, original-domain recovery continuity, and durable retirement remain tracked dependent work. This patch does not change package/launcher swap ownership, rollback, finalization history, terminal-result retirement, or the lease-store schema.
Canonical build and package integrity passed at
4b30bc68: 67,727,360 bytes, SHA-256124a45220829c043a0577f7f4701f80d45a9e9eb0d28de3353583c041b1ffcae. That package is preserved. The separate canonical package for conflict-resolved1e68cdd8passed build and tarball integrity: 67,737,600 bytes, SHA-25615661e5ce4e71809783db8d0db8fb227d77a6ad5a054e807f81d5c7b0df94799. The source-bound artifact/contract has been delivered to the existing parent/cbbe qualification owners; their installed hold is unchanged. Composed/installed proof remains pending; the older artifact is not rebound to the new head. No universal Doctor/plugin, whole-journey, or installed-service closure is claimed. PR remains unmerged.