Repository navigation
Host: durable delegated execution ownership guard - #166475
yaoxiaoyang448 wants to merge 2 commits into
Conversation
… mainline Forward-port of the release-line Host Guard semantics onto current main (state schema v20 -> v21), preserving behavior rather than file structure. Uses current-main generated schema infrastructure instead of obsolete checked-in generated files. - Block 1: durable registry/state machine, v21 migration, startup rehydration, downgrade refusal (userVersion === 20 && !tableExists detection). - Block 2: Host delegation establishment + agent/tool outer enforcement; fail-closed on delegate absence/failure. - Block 3: lineage propagation + child inheritance + signed cross-process transport on the trusted Gateway execution identity. - Block 4: trusted-human fallback/revoke via ChannelAdmissionEvidence and CommandOwnerAuthority. Authority composition is one-way: durable Host Guard (outer) runs before the existing AgentRunDelegatedAuthority admission (inner); durable denial wins. Native Swift max schema version aligned to v21; package.json metadata bumped.
|
🦞👀 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: needs real behavior proof before merge. What this changesAdds persistent ownership reservations for delegated tasks, plugin-driven establishment, agent and tool guards, child-run lineage transport, and a shared-state database migration. Review scores
Merge readiness⛔ Blocked before merge - 24 items remain The new plugin entrypoint makes establishment reachable, but substantial authorization and lifecycle defects remain. Current main does not implement this durable task guard, and the earlier submission closed unmerged. Priority: P2 Decision needed
Before merge
Findings
Agent review detailsHow this fits togetherInbound dispatch lets plugins take responsibility for a task. The proposed ownership registry then controls whether OpenClaw may run agents or tools for that task, including child executions and recovery after restart. flowchart TD
A[Inbound task] --> B[Plugin handoff]
B --> C[Durable ownership registry]
C --> D[Agent and tool guards]
D --> E[Allowed execution or refusal]
B --> F[Child execution lineage]
F --> D
G[Human recovery or delegate completion] --> C
Technical reviewBest possible solution: Use an accepted task-ownership contract with exact-owner dispatch, worker-owned storage, live final-effect checks, and visible completion and human recovery. Do we have a high-confidence way to reproduce the issue? Yes, the patch defects have concrete source-backed triggers involving direct release, context copying, ownership changes during awaited policy work, and multi-plugin dispatch. No runtime reproduction or tests were executed. Is this the best way to solve the issue? No, the current patch does not enforce its ownership invariant through the complete production lifecycle. The new task contract needs integrated recovery and enforcement at the final effect boundary. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against de38a0454825. Merge-risk optionsMaintainer options:
SecurityNeeds attention: The proposed persistent authority boundary has reachable release, wrong-owner, lineage-loss, and stale-operation defects; no unrelated supply-chain change was identified. EvidenceSecurity concerns:
What I checked:
PR surfaceSource +2830, Tests +2708, Docs +34, Config 0. Total +5572 across 50 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
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 HistoryReview history (1 earlier review cycle)
Reviewed October 7, 2026, 7:24 AM ET / 11:24 UTC (Revision 2). |
## What Problem This Solves A repeat captured Doctor still performs two full generation observations around shared-state readability even when no catalog or orphan repair is needed. Its readability helper also opens two empty immediate transactions on that clean path. The existing schema-repair owner now returns its prepared `needed` fact with `apply`. The prepared schema-repair owner owns its catalog repair transaction and exposes the same prepared apply operation to the generator. The generator consumes the needed fact once. Clean, artifact-free readability can finish without an attributed write phase; retained WAL/journal still use the original initial envelope, and catalog/orphan repair still resumes through capture before writing. The superseded forwarding helper is deleted. Full Doctor still invokes `apply` unconditionally inside its write transaction, retaining the ownership check after `BEGIN`. Actual repair still checks live authority at effect; original generation baseline, untouched-path final comparison, source custody, cancellation, awaited credentials and closure, and separate state/agent commits remain. No `capture.accept`, `openedSqlitePaths` shortcut, new cache, schema, generation, dependency or finalizer change. ## Acceptance rule (before count runs) Flow: repeat captured Doctor through committed `scripts/perf/doctor-captured-pass.mts`, starting from the same migrated four-agent/4096-session synthetic fixture at the same absolute path. Baseline must contain landed B1; candidate differs only by the readability owner simplification. Keep the retained-WAL native update flow as a separate compatibility cohort. Counts first, one matched base/candidate pair: clean no-companion readability removes one before/after generation observation pair (2 generation workers and 2 size workers), its 22 inspection SQL statements, and two empty immediate transactions; measure the remaining SQL/read/request deltas rather than assigning all totals to the deletion. Existing WAL or journal retains the initial envelope. Dirty catalog/orphan repair still enters the original capture before its first write; no skipped path calls capture.accept or marks itself opened. Full Doctor still executes the prepared ownership check unconditionally after BEGIN. Win: at least the two redundant readability observations removed in the actual repeat flow, total SQL/requests and runtime Gateway MAIN hold or improve, source/refusal/restoration/cleanup behavior unchanged, production net <=0 and test net <=0. Counts for main threads across child processes are labeled separately from runtime Gateway MAIN. No timing result from an instrumented profile is treated as a speedup. Timing: the campaign timing deadline expired at 2026-11-05T07:08:34Z. This PR uses deterministic worker/SQL/copied-byte counts only; it claims no CPU or wall-time speedup. The retained-WAL native update is a distinct compatibility cohort and is not timed for performance acceptance. Proof: red/green clean readability transaction/worker counts adapted into existing tests; retain same/different-content outside-write refusal, empty reader transition, malformed catalog plus preserved orphan recovery, synchronous and asynchronous behavior, and full Doctor post-BEGIN authority. Two isolated reviews, PG checklist and approval for exact head, matched native retained-WAL update, exact-head CI including three PG shards and published-driver cell, peer overlap audit. Expected remaining generation observations after the bounded cut: inventory 3; quick-index 2; readability 0; shared-state/credential opens 6; additive-agent schemas 8; legacy/schema/credential repair 6; total 25. Confirm with the production run; do not infer savings from source alone. The parameterized migration tests retain direct full-Doctor and readability-first routes for both synchronous SDK and asynchronous Doctor entrypoints. Malformed catalog, preserved orphan payload/BigInt/export, integrity, current version, refusal, and repeat-repair idempotency assertions remain. Production net -8 LOC; tests net -5 LOC. ## Evidence Current integration head: `e489ad6e51aa7775961d485eda51d7e501e4035a`. Merged current main `f34fb556b7ba6abdeedf102730b9214d61db299d` once to include the auth fake-clock fixture fix from #193451. All six B2 file blobs and B2’s diff against main are identical to the reviewed `e5ede773` patch. Count, native-update and published-driver evidence below therefore carry forward; the new normal pull-request [CI run42024239906](https://github.com/openclaw/openclaw/actions/runs/42024239906) passed, including all three PostgreSQL shards, static checks and the affected Node test groups. Required `openclaw/ci-gate`, dependency-review and security-sensitive-review are successful on this exact head. The prior auth-timer failure did not recur; no rerun was needed. No bypass will be used. Exact-head PostgreSQL review was carried by the coordinator after verifying the unchanged six B2 blobs. One matched repeat-Doctor pair on Node26.12.1/macOS restored the same pristine four-agent/4096-session synthetic fixture at its original absolute path (1,190files/428,490,104bytes; SHA256 `38f500c594546a577e093b58b3956dc42e3e85ef6d593b6acf15a84c98eadd34`). Both arms passed product/restoration checks and cleaned the fixture. | Scope | SQL base → candidate | Process-main SQL | Worker SQL | Requests | Copied bytes | |---|---:|---:|---:|---:|---:| | Doctor | 118,284 → 117,672 | 117,696 → 117,084 | 588 → 588 | 271 → 271 | 1,066,041,712 → 1,062,633,960 | | Parent/other | 4,321 → 4,321 | 4,302 → 4,302 | 19 → 19 | 18 → 18 | 427,888,640 → 427,888,640 | | Whole | 122,605 → 121,993 | 121,998 → 121,386 | 607 → 607 | 289 → 289 | 1,493,930,352 → 1,490,522,600 | Doctor generation/size27/27→25/25; whole32/32→30/30; process starts184→180. Open/close/execute/task request deltas all0. Process-main is CLI/child thread0, not runtime Gateway MAIN. SQL−612 is the observed pair result; the fixed deletion is22 inspection statements plus two empty transactions, with remaining authority/lease work dependent on elapsed progress. After normalizing elapsed busy_timeout values,34 SQL shapes decrease and none increases. Doctor main copy−3,428,352bytes, WAL prefix+20,600bytes, journal unchanged; total−3,407,752bytes. No timing saving is inferred. Remaining25 observations: inventory/settlement3, quick-index2, shared-state/credential opens6, additive-agent schemas8, legacy/schema/credential repair6. Readability pair2→0; other categories unchanged. No process/SQL ancestry gaps or PID reuse. The offline comparator initially omitted the four source .ts generation workers per arm; an independent spawn/lifetime audit confirmed them, and accepting only the exact .js/.ts entrypoints fixed comparison without changing raw records or rerunning either product arm. Historical B1 SQL totals are not directly comparable because this baseline includes inherited plugin-preparation work. The separate retained-WAL native update pair passed exact activation/build identity, deferred-to-completed retirement, real Gateway transport, process stop and zero cleanup errors. Both arms started with identical main/WAL byte counts and identical three Doctor WAL/SHM boundaries. | Native scope | SQL base → candidate | Requests base → candidate | Generation / size processes base → candidate | |---|---:|---:|---:| | Whole flow | 296,063 → 294,567 | 155,714 → 155,716 | 68 / 65 → 64 / 61 | | Preflight Doctor | 3,608 → 3,580 | 119 → 119 | 0 / 0 → 0 / 0 | | Installed Doctor | 146,880 → 146,269 | 351 → 351 | 32 / 32 → 30 / 30 | | Final Doctor | 121,076 → 120,464 | 166 → 166 | 21 / 21 → 19 / 19 | Direct runtime Gateway MAIN holds: canary 44→44; final Gateway 53→53 (startup/readiness48 + shutdown5). Whole process-main SQL290,019→288,520 is a different metric; workerSQL6,044→6,047. Whole-flow SQL is cadence-dependent, not a fixed per-invocation saving. Native copied bytes are unmeasured, not zero; no CPU/wall speedup or warm-steady claim. All adverse native movements remain counted: one Doctor lease heartbeat; a shutdown plugin-catalog cache task/read; one canary sandboxRegistry.list schema-version read; and a final startup-integrity completion followed by its database open. Outside-Doctor cache scan0→1 and cache_size2→3 are disclosed. All12 relevant owners are blob-identical base/head. These are timing-dependent background progress differences, cause not proven. The coordinator explicitly accepted +2requests/+3workerSQL and the new cells after source attribution; none is subtracted as noise. Two raw macOS leaf PIDs were each reused in disjoint process lifetimes. A strict offline split preserves all2,850 process events and62 affected SQL records, every raw hash and total. An isolated independent audit reconciles294,567SQL/155,716requests. Unobserved shell parents leave an ancestry coverage gap; all observed children remain counted (598SQL/0requests each arm, before Doctor). Validation:132 owner tests passed on the production-equivalent head, including retained artifacts, outside-write refusal, empty readers, credential preparation/close and retirement. The B1 red control performs2 observations versus expected0; B2 passes. Final4 ownership cases, typed lint, format and line-cap pass. Two full isolated Codex reviews plus required production-delta/test corrections are clean. Exact-head PostgreSQL approval is recorded. Local broad check:changed was canceled143 and is not a pass; CI supplies broad gates. Original proof-head CI run [42003968887](https://github.com/openclaw/openclaw/actions/runs/42003968887) passed all three PostgreSQL shards, types, typed lint, source contracts, ratchets, SDK API diff and the [published-driver/native-systemd cell](https://github.com/openclaw/openclaw/actions/runs/42003968887/job/127173500397). The run is not reported green: its original auth timer, deferred-project marker and UI timeout failures remain recorded. The single approved projects retry [127208432932](https://github.com/openclaw/openclaw/actions/runs/42003968887/job/127208432932) passed (11:08:56–11:34:54Z). The original marker ENOENT remains disclosed; no source fix or weakened assertion was introduced. The corrected PR body also passed its context/evidence check [127216156959](https://github.com/openclaw/openclaw/actions/runs/42018847897/job/127216156959). The auth retry reproduced a leftover fake timer at `auth-controller.test.ts:226` and a separate cleanup-authority timeout. After the single Testbox allocation queued and was stopped without executing tests, the coordinator authorized one exact 19-file Node24.22.1/macOS replay per arm, with CI's three workers and isolation configuration unchanged. Both base and candidate reproduce the same timer assertion (base377pass/1fail; candidate382pass/1fail); all other18files pass, and worker cleanup completes. All source archive bytes verified before/after. This establishes matching-signature baseline evidence on macOS, not a Linux result, a fix, or a green suite. The follow-up #193451 attributed this timer to tsx disk-cache initialization captured by the fake clock and prepares it before the clock starts, retaining all assertions. That test-only fix is now included by the main merge; the new normal CI must confirm it on this integration head. The source-identical90s cleanup timeout remains disclosed. No assertion or timeout was weakened. The UI timeout has no assertion failure and is coordinator-dispositioned as unrelated. Knip's sole `handleUpgradeRequest` export finding is independently reproduced in scheduled main run41994726590/job127135524057, then fixed on main by73145; the prospective merge retains the exact fixed blob. No new static findings are accepted. Production net−8 LOC; tests net−5 LOC. Benchmark +12 lines adds a freshly created explicit scratch root so arms run at the same absolute path; default path and cleanup are unchanged. No B2 file changes followed final review; the current head additionally contains the unchanged main merge described above. Overlap refreshed on the integrated head through the shared PR index: #193393 at `f545ae3d` merges cleanly both before and after B2; #192228/#188492/#166475/#149882/#146868 add no conflicts (7/34/18/92/7 inherited paths respectively). #192698 retains 2,751 conflicting paths in both arms and no new conflict relation. The repair-owner block is resegmented inside its already-conflicted file, covered by the coordinator’s explicit standing disposition for that draft. The previous 2,912-path count belonged to the earlier base. No per-PR census was used. Acceptance marker: `DOCTORGEN-B2-COUNTS-e5ede7735ee5d56033c3a5a8f36383190fcbcaa3`. Measured candidate: `e5ede7735ee5d56033c3a5a8f36383190fcbcaa3`; exact base: `ef81b2545c8cf6f20f1b2723628fc5291d45bde0`. The same existing migrated fixture is restored at one path for each count arm; the native retained-WAL cohort is separately restored at its own fixed path. Final test-only correction restores the baseline DatabaseSync.exec descriptor capture after typed lint rejected the direct unbound method reference. Four ownership-injection cases pass; an isolated delta review is clean. Production is byte-identical to the PostgreSQL-approved 24a93d8 head. The earlier CI runner also hit a documented 8 GiB fixture disk requirement with only 7.2–7.3 GiB free; this is retained as environment evidence, not claimed as a passing test. The final exact-head CI outcomes and their dispositions are recorded above. Count setup correction (before the replacement pair): the first baseline ran 39 generation/size processes because moving the byte-identical migrated fixture invalidated its existing absolute-path daemon-runtime-pin receipt, adding six migration envelopes. That attempt is excluded from repeat-Doctor acceptance. Candidate attempts stopped before repair because the temporary artifact observer matched only a single-line repair initializer. B2 emits that initializer over multiple lines; the observer crashed the child during import, and its parent correctly refused the exited process identity. A small direct module import reproduced the observer error. The corrected bounded multiline observer imports both exact repair-owner modules successfully; no product authority behavior changed. The replacement pair restores the unchanged pristine fixture at its original path for both arms. The original 27→25 projection and all acceptance thresholds remain unchanged. The canceled second attempt stopped during preflight and executed no Doctor. Final landing check: current main includes #193393. Its additive standing-advisories benchmark changes merge cleanly with B2; all five reviewed production/test files remain byte-identical. This is main-owned benchmark integration only; B2 head and its own diff have not changed.
…193360) ## What Problem This Solves A repeat captured Doctor still performs two full generation observations around shared-state readability even when no catalog or orphan repair is needed. Its readability helper also opens two empty immediate transactions on that clean path. The existing schema-repair owner now returns its prepared `needed` fact with `apply`. The prepared schema-repair owner owns its catalog repair transaction and exposes the same prepared apply operation to the generator. The generator consumes the needed fact once. Clean, artifact-free readability can finish without an attributed write phase; retained WAL/journal still use the original initial envelope, and catalog/orphan repair still resumes through capture before writing. The superseded forwarding helper is deleted. Full Doctor still invokes `apply` unconditionally inside its write transaction, retaining the ownership check after `BEGIN`. Actual repair still checks live authority at effect; original generation baseline, untouched-path final comparison, source custody, cancellation, awaited credentials and closure, and separate state/agent commits remain. No `capture.accept`, `openedSqlitePaths` shortcut, new cache, schema, generation, dependency or finalizer change. ## Acceptance rule (before count runs) Flow: repeat captured Doctor through committed `scripts/perf/doctor-captured-pass.mts`, starting from the same migrated four-agent/4096-session synthetic fixture at the same absolute path. Baseline must contain landed B1; candidate differs only by the readability owner simplification. Keep the retained-WAL native update flow as a separate compatibility cohort. Counts first, one matched base/candidate pair: clean no-companion readability removes one before/after generation observation pair (2 generation workers and 2 size workers), its 22 inspection SQL statements, and two empty immediate transactions; measure the remaining SQL/read/request deltas rather than assigning all totals to the deletion. Existing WAL or journal retains the initial envelope. Dirty catalog/orphan repair still enters the original capture before its first write; no skipped path calls capture.accept or marks itself opened. Full Doctor still executes the prepared ownership check unconditionally after BEGIN. Win: at least the two redundant readability observations removed in the actual repeat flow, total SQL/requests and runtime Gateway MAIN hold or improve, source/refusal/restoration/cleanup behavior unchanged, production net <=0 and test net <=0. Counts for main threads across child processes are labeled separately from runtime Gateway MAIN. No timing result from an instrumented profile is treated as a speedup. Timing: the campaign timing deadline expired at 2026-11-05T07:08:34Z. This PR uses deterministic worker/SQL/copied-byte counts only; it claims no CPU or wall-time speedup. The retained-WAL native update is a distinct compatibility cohort and is not timed for performance acceptance. Proof: red/green clean readability transaction/worker counts adapted into existing tests; retain same/different-content outside-write refusal, empty reader transition, malformed catalog plus preserved orphan recovery, synchronous and asynchronous behavior, and full Doctor post-BEGIN authority. Two isolated reviews, PG checklist and approval for exact head, matched native retained-WAL update, exact-head CI including three PG shards and published-driver cell, peer overlap audit. Expected remaining generation observations after the bounded cut: inventory 3; quick-index 2; readability 0; shared-state/credential opens 6; additive-agent schemas 8; legacy/schema/credential repair 6; total 25. Confirm with the production run; do not infer savings from source alone. The parameterized migration tests retain direct full-Doctor and readability-first routes for both synchronous SDK and asynchronous Doctor entrypoints. Malformed catalog, preserved orphan payload/BigInt/export, integrity, current version, refusal, and repeat-repair idempotency assertions remain. Production net -8 LOC; tests net -5 LOC. ## Evidence Current integration head: `e489ad6e51aa7775961d485eda51d7e501e4035a`. Merged current main `5166bef057aecf7c139598ad0d1ce3ac53cbd626` once to include the auth fake-clock fixture fix from openclaw#193451. All six B2 file blobs and B2’s diff against main are identical to the reviewed `e5ede773` patch. Count, native-update and published-driver evidence below therefore carry forward; the new normal pull-request [CI run42024239906](https://github.com/openclaw/openclaw/actions/runs/42024239906) passed, including all three PostgreSQL shards, static checks and the affected Node test groups. Required `openclaw/ci-gate`, dependency-review and security-sensitive-review are successful on this exact head. The prior auth-timer failure did not recur; no rerun was needed. No bypass will be used. Exact-head PostgreSQL review was carried by the coordinator after verifying the unchanged six B2 blobs. One matched repeat-Doctor pair on Node26.12.1/macOS restored the same pristine four-agent/4096-session synthetic fixture at its original absolute path (1,190files/428,490,104bytes; SHA256 `38f500c594546a577e093b58b3956dc42e3e85ef6d593b6acf15a84c98eadd34`). Both arms passed product/restoration checks and cleaned the fixture. | Scope | SQL base → candidate | Process-main SQL | Worker SQL | Requests | Copied bytes | |---|---:|---:|---:|---:|---:| | Doctor | 118,284 → 117,672 | 117,696 → 117,084 | 588 → 588 | 271 → 271 | 1,066,041,712 → 1,062,633,960 | | Parent/other | 4,321 → 4,321 | 4,302 → 4,302 | 19 → 19 | 18 → 18 | 427,888,640 → 427,888,640 | | Whole | 122,605 → 121,993 | 121,998 → 121,386 | 607 → 607 | 289 → 289 | 1,493,930,352 → 1,490,522,600 | Doctor generation/size27/27→25/25; whole32/32→30/30; process starts184→180. Open/close/execute/task request deltas all0. Process-main is CLI/child thread0, not runtime Gateway MAIN. SQL−612 is the observed pair result; the fixed deletion is22 inspection statements plus two empty transactions, with remaining authority/lease work dependent on elapsed progress. After normalizing elapsed busy_timeout values,34 SQL shapes decrease and none increases. Doctor main copy−3,428,352bytes, WAL prefix+20,600bytes, journal unchanged; total−3,407,752bytes. No timing saving is inferred. Remaining25 observations: inventory/settlement3, quick-index2, shared-state/credential opens6, additive-agent schemas8, legacy/schema/credential repair6. Readability pair2→0; other categories unchanged. No process/SQL ancestry gaps or PID reuse. The offline comparator initially omitted the four source .ts generation workers per arm; an independent spawn/lifetime audit confirmed them, and accepting only the exact .js/.ts entrypoints fixed comparison without changing raw records or rerunning either product arm. Historical B1 SQL totals are not directly comparable because this baseline includes inherited plugin-preparation work. The separate retained-WAL native update pair passed exact activation/build identity, deferred-to-completed retirement, real Gateway transport, process stop and zero cleanup errors. Both arms started with identical main/WAL byte counts and identical three Doctor WAL/SHM boundaries. | Native scope | SQL base → candidate | Requests base → candidate | Generation / size processes base → candidate | |---|---:|---:|---:| | Whole flow | 296,063 → 294,567 | 155,714 → 155,716 | 68 / 65 → 64 / 61 | | Preflight Doctor | 3,608 → 3,580 | 119 → 119 | 0 / 0 → 0 / 0 | | Installed Doctor | 146,880 → 146,269 | 351 → 351 | 32 / 32 → 30 / 30 | | Final Doctor | 121,076 → 120,464 | 166 → 166 | 21 / 21 → 19 / 19 | Direct runtime Gateway MAIN holds: canary 44→44; final Gateway 53→53 (startup/readiness48 + shutdown5). Whole process-main SQL290,019→288,520 is a different metric; workerSQL6,044→6,047. Whole-flow SQL is cadence-dependent, not a fixed per-invocation saving. Native copied bytes are unmeasured, not zero; no CPU/wall speedup or warm-steady claim. All adverse native movements remain counted: one Doctor lease heartbeat; a shutdown plugin-catalog cache task/read; one canary sandboxRegistry.list schema-version read; and a final startup-integrity completion followed by its database open. Outside-Doctor cache scan0→1 and cache_size2→3 are disclosed. All12 relevant owners are blob-identical base/head. These are timing-dependent background progress differences, cause not proven. The coordinator explicitly accepted +2requests/+3workerSQL and the new cells after source attribution; none is subtracted as noise. Two raw macOS leaf PIDs were each reused in disjoint process lifetimes. A strict offline split preserves all2,850 process events and62 affected SQL records, every raw hash and total. An isolated independent audit reconciles294,567SQL/155,716requests. Unobserved shell parents leave an ancestry coverage gap; all observed children remain counted (598SQL/0requests each arm, before Doctor). Validation:132 owner tests passed on the production-equivalent head, including retained artifacts, outside-write refusal, empty readers, credential preparation/close and retirement. The B1 red control performs2 observations versus expected0; B2 passes. Final4 ownership cases, typed lint, format and line-cap pass. Two full isolated Codex reviews plus required production-delta/test corrections are clean. Exact-head PostgreSQL approval is recorded. Local broad check:changed was canceled143 and is not a pass; CI supplies broad gates. Original proof-head CI run [42003968887](https://github.com/openclaw/openclaw/actions/runs/42003968887) passed all three PostgreSQL shards, types, typed lint, source contracts, ratchets, SDK API diff and the [published-driver/native-systemd cell](https://github.com/openclaw/openclaw/actions/runs/42003968887/job/127173500397). The run is not reported green: its original auth timer, deferred-project marker and UI timeout failures remain recorded. The single approved projects retry [127208432932](https://github.com/openclaw/openclaw/actions/runs/42003968887/job/127208432932) passed (11:08:56–11:34:54Z). The original marker ENOENT remains disclosed; no source fix or weakened assertion was introduced. The corrected PR body also passed its context/evidence check [127216156959](https://github.com/openclaw/openclaw/actions/runs/42018847897/job/127216156959). The auth retry reproduced a leftover fake timer at `auth-controller.test.ts:226` and a separate cleanup-authority timeout. After the single Testbox allocation queued and was stopped without executing tests, the coordinator authorized one exact 19-file Node24.22.1/macOS replay per arm, with CI's three workers and isolation configuration unchanged. Both base and candidate reproduce the same timer assertion (base377pass/1fail; candidate382pass/1fail); all other18files pass, and worker cleanup completes. All source archive bytes verified before/after. This establishes matching-signature baseline evidence on macOS, not a Linux result, a fix, or a green suite. The follow-up openclaw#193451 attributed this timer to tsx disk-cache initialization captured by the fake clock and prepares it before the clock starts, retaining all assertions. That test-only fix is now included by the main merge; the new normal CI must confirm it on this integration head. The source-identical90s cleanup timeout remains disclosed. No assertion or timeout was weakened. The UI timeout has no assertion failure and is coordinator-dispositioned as unrelated. Knip's sole `handleUpgradeRequest` export finding is independently reproduced in scheduled main run41994726590/job127135524057, then fixed on main by73145; the prospective merge retains the exact fixed blob. No new static findings are accepted. Production net−8 LOC; tests net−5 LOC. Benchmark +12 lines adds a freshly created explicit scratch root so arms run at the same absolute path; default path and cleanup are unchanged. No B2 file changes followed final review; the current head additionally contains the unchanged main merge described above. Overlap refreshed on the integrated head through the shared PR index: openclaw#193393 at `f545ae3d` merges cleanly both before and after B2; openclaw#192228/openclaw#188492/openclaw#166475/openclaw#149882/openclaw#146868 add no conflicts (7/34/18/92/7 inherited paths respectively). openclaw#192698 retains 2,751 conflicting paths in both arms and no new conflict relation. The repair-owner block is resegmented inside its already-conflicted file, covered by the coordinator’s explicit standing disposition for that draft. The previous 2,912-path count belonged to the earlier base. No per-PR census was used. Acceptance marker: `DOCTORGEN-B2-COUNTS-e5ede7735ee5d56033c3a5a8f36383190fcbcaa3`. Measured candidate: `e5ede7735ee5d56033c3a5a8f36383190fcbcaa3`; exact base: `3a560c82e47ad5d8283886b4a17601a0dc8ddf67`. The same existing migrated fixture is restored at one path for each count arm; the native retained-WAL cohort is separately restored at its own fixed path. Final test-only correction restores the baseline DatabaseSync.exec descriptor capture after typed lint rejected the direct unbound method reference. Four ownership-injection cases pass; an isolated delta review is clean. Production is byte-identical to the PostgreSQL-approved 24a93d8 head. The earlier CI runner also hit a documented 8 GiB fixture disk requirement with only 7.2–7.3 GiB free; this is retained as environment evidence, not claimed as a passing test. The final exact-head CI outcomes and their dispositions are recorded above. Count setup correction (before the replacement pair): the first baseline ran 39 generation/size processes because moving the byte-identical migrated fixture invalidated its existing absolute-path daemon-runtime-pin receipt, adding six migration envelopes. That attempt is excluded from repeat-Doctor acceptance. Candidate attempts stopped before repair because the temporary artifact observer matched only a single-line repair initializer. B2 emits that initializer over multiple lines; the observer crashed the child during import, and its parent correctly refused the exited process identity. A small direct module import reproduced the observer error. The corrected bounded multiline observer imports both exact repair-owner modules successfully; no product authority behavior changed. The replacement pair restores the unchanged pristine fixture at its original path for both arms. The original 27→25 projection and all acceptance thresholds remain unchanged. The canceled second attempt stopped during preflight and executed no Doctor. Final landing check: current main includes openclaw#193393. Its additive standing-advisories benchmark changes merge cleanly with B2; all five reviewed production/test files remain byte-identical. This is main-owned benchmark integration only; B2 head and its own diff have not changed.
Summary
Adds a Host-owned durable delegated-execution ownership guard for delegated agent work.
The guard prevents ordinary OpenClaw execution from silently resuming when a delegated
owner/plugin becomes unavailable.
Core properties
Authority composition
This does not replace or duplicate
AgentRunDelegatedAuthority.AgentRunDelegatedAuthority= the inner run/claim/lease authority (unchanged)into the existing run-authority admission -> both must pass
Schema
Current upstream state schema 20 -> 21.
Migration detection is intentionally limited to direct predecessor shape:
to avoid false-positive migration classification of older/legacy databases.
Validation
establishment, real-path authority composition A-F, cross-process signed carrier,
trusted-human fallback, v21 detection, delegated-ownership preflight) — all green
(46 + 71 + 3 passing, 0 failures)
src/state/openclaw-state-db.test.ts— 58/58 passingsrc/state/openclaw-database-preflight.test.ts— 15/15 passingcheck-native-state-schema-version.test.ts— 2/2 passingpnpm tsgo:core— exit 0git diff --check— cleanKnown unrelated environment issue: the two managed-worktree subagent
production-boundarycases also fail on the unmodified upstream base
6041559b4(reproduced by restoring theunmodified
subagent-spawn.ts); they are not introduced by this change.No production deployment is part of this PR.