Repository navigation
fix: handle endpoint-protected plists during Gateway activation - #149307
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: needs maintainer review before merge. Reviewed September 22, 2026, 11:31 PM ET / September 23, 2026, 03:31 UTC (Revision 11). ClawSweeper reviewWhat this changesThe PR repairs macOS Gateway activation around endpoint-protected service definitions and fixes Gateway test teardown and synchronization. Merge readiness✅ Ready for maintainer review This remains a useful, well-supported fix that current main does not fully provide. The earlier extraction finding is resolved, and no blocking introduced defect remains. Priority: P1 Review scores
Verification
How this fits togetherBefore activating a user Gateway service, OpenClaw checks whether a system service already owns its label. The detached restart helper and standalone updater inspect installed service definitions and either permit activation or report a conflict. flowchart TD
A[Gateway restart or update] --> B[System ownership check]
C[Loaded system services] --> B
D[Installed service definitions] --> E[Read bytes and parse label]
E --> B
B -->|Absent| F[Activate user Gateway]
B -->|Conflict or unverifiable| G[Refuse and report reason]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +61, Tests +399, Docs +2, Other +50. Total +512 across 16 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. Technical reviewBest possible solution: Keep native structural parsing and actual-read error classification consistent across activation paths, preserving exact-label conflicts and the documented unreadable-file policy. Do we have a high-confidence way to reproduce the issue? Yes, at the source boundary: on current main, readable foreign definitions whose pathname parsing fails still block detached activation. Recorded macOS before/after evidence exercises that path; this review did not execute it. Is this the best way to solve the issue? Yes. The patch repairs the remaining package-independent readers while retaining main's shared runtime decoder, exact-label checks, and activation refusal for malformed or unverifiable input. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e072e5af596b. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (10 earlier review cycles; latest 8 shown)
|
7e41426 to
c38474e
Compare
|
Reviewed and reconciled against current main in c38474eb42f4, preserving @PollyBot13's author credit. Both ClawSweeper integration items and the rank-up move are addressed: main's shared runtime decoder stays intact; the obsolete parallel decoder and exec-input plumbing are removed. Detached restarts and the package-independent updater now classify actual bounded reads and preserve structural, exact-string ownership. Review also caught and repaired valid date/data metadata rejection, newline-label conflation, and interrupted native queries (including exit-zero timeouts). Validation on macOS arm64, Node 24.19.0:
Production/tooling: +120/-14, net +106; tests: +297/-20, net +277; docs: +2. The production increase supplies the bounded package-independent reader and actual read/completion classification. The updater uses one snapshot and the runtime retains its existing shared decoder. No config, protocol, or database surface changes. Actual flinco/Elastic-host recovery, endpoint alerts, a full package swap, and an existing live-service upgrade remain unverified because no affected host was available. The controlled native proof is scoped to the changed boundary; #139813 remains open for affected-host validation. Existing pre-generated restart scripts are unchanged. Exact-head hosted CI is pending. Native prepare/merge will run only after its required gates pass. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
CI attempt 1 found three failed shards outside the changed paths:
Named follow-ups: native relay token-binding test includes an unrelated cold-worker deadline; investigate temporary Gateway state deletion before SQLite worker retirement. The latter is a source-backed hypothesis, not a diagnosed cause. Additional investigations: Gateway history fixture reset before borrower release and capture orphan-recovery terminal failure diagnostics under CI load. No assertions, timeouts, or production behavior have been weakened for this PR. Only failed/cancelled CI jobs are being retried on the unchanged reviewed head |
|
Addressed the ClawSweeper extraction finding in f1161d2b8408. Both shell lint paths now require the extraction command's documented ordinary failure status ( Before/after proof: four snapshot tests (exit 2, 126, 127, and actual SIGTERM) and the complete generated update-restart script all fail on the previous reviewed commit and pass after this correction. The generated script now exits 78, records the refusal, and requests zero activation. Existing foreign/non-string, exact-owner, malformed, permission-denied, and newly-loaded-owner cases continue to pass. All 212 focused tests pass on this commit. Fresh autoreview is clean at its configured P0 scope; an independent source review found no P1/P2 defects. Production growth from this correction is two explanatory comment lines; the status checks replace existing branches. The new native shell/generated-restart files took 23.39s wall with one worker, including cold compiler preparation; the SIGTERM handoff case took 437ms. Native parser cases skip on Linux. The separate published-driver upgrade proof is in progress using an untouched npm 2026.9.5 installation and a package built from this exact candidate, with isolated home/state/prefix and preserved pre-generated restart-script bytes. Exact-head CI is also running again. No claim of actual endpoint-protection-host recovery is made. |
f1161d2 to
9ea5aaf
Compare
|
Both actionable items from the latest ClawSweeper review are addressed at
The package was built from
All 15 native cells pass; fixture bytes are unchanged. The pre-update script also retained its exact SHA-256 across the completed package swap ( Proof boundaries: temporary HOME/account adapter and a strict launchctl simulator, real installed packages, real Gateway processes/RPC, system Perl, and Apple plutil. Absolute launchctl interception was verified in both driver children and both managed Gateway runtimes; unknown targets/paths refuse. Pathname denial and interruption were injected. Initial fixture attempts exposed an overbroad bundled-plugin disable and a custom-label mismatch; those fixtures were corrected before the final successful run. This is installed-updater and native-parser proof, not evidence from an actual Elastic/EDR-protected host or of alert suppression. Affected-host validation remains on #139813. Final local guards, type checks, lint, dead-code scans and import-cycle checks pass. CI is still running on the exact final head: https://github.com/openclaw/openclaw/actions/runs/35804272567. The earlier unrelated CI failures remain documented follow-ups, not claimed fixed. |
|
Published The exact failing job reports an active native SQLite borrower while The CI log is the failing baseline. After the repair, all 69 tests in task history, the context-helper consumer suite, projection worker reads, and backfill pass. Targeted type checking, lint, formatting, and fresh autoreview pass. No production code, assertion, timeout, or retry changes. The previously published package-upgrade and native ownership proof remains applicable: only two test files differ from packaged production commit |
|
Resolved the repeated chat-history cursor CI teardown failure at its fixture owner.
This test-only repair leaves the previously published native restart and installed-package upgrade evidence valid. Endpoint-protection host behavior remains the explicit follow-up on #139813. Candidate: |
58af9ce to
8e64fec
Compare
|
Reconciled the new conflict with main's task-history repair, b21237a. The PR now retains main's disposal ordering and failure cleanup; the redundant task-history commit was dropped. Rebased candidate: The prior native/package upgrade proof exercised the pre-rebase build. All PR production changes remain identical; the entire package was not rebuilt after this mechanical rebase. Exact-head CI is running for the new commit. |
|
Resolved the file-size ratchet failure from run 35807797363/job 107012900171 without weakening its limits or reducing coverage.
Candidate: |
|
Repaired the catalog-queue synchronization defect exposed by CI run 35808453930/job107014917851 in commit 88cd92dc6afd3f2bb4a41f958d569917e4d5ed6a. Vitest defaults Paired proof: the same temporary 1,100ms delay before the real independent mutation reproduces both CI failures before the repair and passes both afterward. The delay is absent from the patch. All 14 catalog/diagnostic tests, type checking, formatting, lint, and fresh review pass. Test-only +17/-18; production unchanged. The separate task-list failure in job107014917828 remains unexplained: one full-file diagnostic replay produced the intended three selections, nine invalidating writes, and UNAVAILABLE response. Its exact-count and response assertions remain intact. This is a named follow-up, not a claimed fix. The new CI run is required for the concrete catalog change. |
88cd92d to
48f75ad
Compare
|
Rebased to resolve the actual modify/delete conflict with #155355, which retires the updater-generated restart helper. Current candidate:48f75ad09a582c72d621e5dce30617a3acb560ca; base:d88a97ad748. The deletion is preserved. The loaded-owner and real SIGTERM/no-activation regression now uses the existing daemon handoff harness. Both changed production blobs are unchanged. Paired proof of the migrated case: old owner exits0; repaired owner exits78, logs refusal, and requests no activation. All14 handoff siblings pass. On the rebased tree, all208 tests in five ownership/current-updater suites pass (170.36s total), along with the canonical build, services type graph, formatting, isolated lint, and fresh review. CI run35810052928 is fully green on pre-rebase88cd92, including catalog, cursor, and task-list shards. New-head CI is required for this conflict resolution. No test assertion or timeout was weakened. Proof attribution: the historical f116 package upgrade used target-CLI install, native bootstrap, then health verification; it did not separately invoke target-CLI restart. Main preserves that exercised path. The old candidate updater-script matrix remains historical; current generated-script coverage is at the surviving daemon handoff. The complete rebased package has not been rerun through the published-driver upgrade. |
|
Merged via squash.
|
…claw#149307) * fix: handle endpoint-protected plists during Gateway activation * fix: refuse interrupted launchd label extraction * test: drain direct chat projections before fixture teardown * test: extract oversized gateway fixture helpers * test: await owned catalog queue mutations --------- Co-authored-by: Patrick Erichsen <[email protected]>
Backport #155433: e0dc76b Backport #149307: 8a53ee3 Adapted backport #156584: a1107a5 Preserve authenticated pre-stop restart intent and exact cleanup receipts. Probe protected launchd plists through the existing runtime owner. Require a helper cleanup receipt plus unsignalled closure before replacement; same-unit dueling installs retain system restrictions without changing global user-first policy. 143 original focused passes and 50 review-repair passes retain their bindings. Both findings are resolved. Composed native/CLI/restart checks and frozen guards pass; 16 native macOS cases and live system-unit/driver proof remain open. Report credit for the system-service issue: @ion-developing. Co-authored-by: Jason (Json) <[email protected]> Co-authored-by: PollyBot13 <[email protected]> Co-authored-by: Patrick Erichsen <[email protected]> Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> Co-authored-by: steipete <[email protected]> Co-authored-by: jalehman <[email protected]>
Related: #139813. Preserves the runtime decoder from #151432 and the updater simplification from #155355.
What Problem This Solves
macOS detached Gateway restarts and the standalone source updater can refuse activation when endpoint protection denies pathname-based plist parsing, even when the definition is readable and belongs to another service.
Why This Change Was Made
The detached ownership probe retains its pathname fast path, then reads a bounded regular-file snapshot through macOS system Perl and asks the native parser to inspect those bytes. The standalone updater reads one bounded snapshot and extracts only the top-level string
Label, avoiding whole-plist JSON conversion. Both paths classify actual read errors and reject incomplete native commands. Shell lint fallback is accepted only after the parser's documented ordinary failure status.Same-label owners, malformed readable definitions, unrelated I/O errors, and interrupted queries still block activation. Main's shared runtime decoder remains canonical. No configuration, schema, protocol, or installed dependency changes. Production/tooling net +108 supplies the bounded package-independent readers and completion/error classification; the original duplicate runtime parser and extra execution plumbing are removed.
User Impact
Readable foreign definitions and actual permission-denied reads follow the existing non-owner policy. An unloaded same-label definition hidden by read denial remains the accepted visibility limitation. Missing system Perl refuses unverifiable detached activation. This does not change endpoint-protection policy or suppress alerts. Already-generated scripts retain their original bytes.
Main retired the updater's generated restart helper in #155355. That deletion is preserved; the real SIGTERM/no-activation regression now exercises the surviving daemon handoff. Managed package updates use the target installation's Gateway CLI.
Evidence
Candidate:
48f75ad09a582c72d621e5dce30617a3acb560ca, rebased ontod88a97ad748. Both changed production blobs are identical to the earlier proof build.ETIMEDOUT; the updater now rejects that incomplete result. Native shell fixtures skip on Linux. Focused native tests used Node 24.19.0.Published-driver upgrade proof: registry-verified npm 2026.9.5 completed an installed-service update into the f116 candidate package. Detached driver/finalizer exited 0; Doctor, target-CLI install, native bootstrap, RPC, readiness, settled state, and exact build checks passed with real Gateway processes and a strict launchctl simulator. The retained old script hash remained unchanged. This package proof predates the subsequent main rebases and updater-helper retirement; it is historical package evidence, not a fresh run of the complete rebased package. The successful run used install followed by healthy verification, with no separate target-CLI restart invocation; main retains that exercised path. Actual flinco/Elastic-host recovery and alerts remain unverified; issue139813 remains open for that follow-up.
CI-exposed test repairs, each recorded with before/after evidence:
Final CI on exact head48f75ad completed successfully: all161 selected jobs passed or skipped, including openclaw/ci-gate. The pre-rebase head88cd92 also completed all selected CI jobs successfully, including the formerly failing catalog, cursor, and task-list shards. The earlier unexplained task-list count failure remains a named uncertainty, not a claimed fix; its assertions and timeout remain unchanged. Initial CI diagnostics and other named follow-ups are retained.
Final delta: production/tooling +123/-15 (net +108); tests/test-support +576/-174 (net +402, including mechanical moves); docs +2. AI-assisted contributor implementation and maintainer reconciliation; original author credit preserved.