Skip to content

fix(plugins): avoid Gateway stalls during source preparation - #200320

Merged
steipete merged 3 commits into
mainfrom
steipete/perf-2535-plugin-capture-custody
Nov 17, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/perf-2535-plugin-capture-custody

Conversation

@steipete

@steipete steipete commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes Gateway event-loop stalls when plugin preparation creates source/native capture directories and their physical staging tokens on a filesystem waiting for a transaction commit.

Related: #200136, #200193, #200216. The motivating Team incident (25c9790, 2026-11-16 05:02 PST) blocked the Gateway MAIN thread for 1.97 seconds in openat2(O_CREAT) under scheduler:update.remote-model-catalog; the kernel waited in btrfs_create → start_transaction → wait_current_trans. The catalog's redundant lock was removed separately. This change handles the remaining physical capture-root owner.

User Impact

Plugin preparation can wait on filesystem creation while the Gateway event loop remains responsive. There is no configuration or schema change and no operator action required.

The tradeoff is explicit: measured cold owner time increases from 183.267 to 453.257 ms, warm owner time from 141.459 to 182.479 ms, and whole process-tree CPU from 1,050 to 1,310 ms. A separate loaded-addon profile on the preceding revision observed 127.828 MiB RSS in the retained broker (summed process RSS increased 120.922 MiB; shared pages and profiling overhead included). The final revision proves ordinary same-process restarts reuse that broker; it does not remeasure that RSS observation. These costs are accepted for removing filesystem-transaction stalls from the Gateway thread, not described as an overall speedup.

Why This Change Was Made

The existing broker resource owner now creates and retains the physical source/native roots and staging tokens. Preparation workers borrow paths; host cache and recovery leases retain the physical custody after execution ends. Loaded native code keeps its token until host exit. Ordinary Gateway restarts reuse the existing broker, and a fresh source replaces permanently failed or sealed authority without reopening old claims or inventing cleanup receipts.

This is the smallest complete root-custody cutover: moving only mkdir would leave token creation and lifetime operations on MAIN. Production grows by 685 lines across 21 production modules plus a net-zero build import adjustment. Twenty of those lines complete the shared lease type and preserve source-acquisition error classification across the new broker boundary. The growth is the private resource adapter and lifetime handoff; the old parent allocation callback and duplicate independent-resource count are removed. Existing pool/dependency declarations are moved intact to keep their owning modules within the repository's limits. No new manager, cache, database table or public protocol is introduced.

This does not claim all Gateway filesystem work is asynchronous. Recovery-copy/binding, runtime-selected synchronous JS/CJS/native imports, and the existing native-load realpath observation remain separate work.

Evidence

The real preparation boundary records 28 synchronous root operations on the exact parent, including seven mutations, and zero on the candidate. Actual two-second source/native mkdtempSync faults move from the Gateway process into the broker: fault-interval heartbeat gaps are 2,029/2,010 ms before and 7/7 ms after; whole-operation candidate maxima are 14/12 ms. Existing physical custody and cleanup assertions remain active.

The timing and injected-delay results below were measured on runtime source corresponding to 03b70d95e1d71ab021158898cbcc06eaea7568a1. Subsequent CI repairs preserve the create algorithm while correcting error projection, the shared lease type, and a broker sender binding, and removing an unnecessary await of a synchronous commit. These are prior-revision performance measurements, supported by focused regression proof of the changed paths, rather than a claim that final-head bytes were remeasured.

Canonical built Node 26.12.1/APFS proof used a synthetic surrounding 35 GiB agent database, 5,000 sessions and 62,000 workspace files; this owner does not scan those unrelated files. No Team data was copied. Five A1/A2 controls and five A/B pairs each include cold and warm phases (20 processes); four additional processes exercise the actual source/native faults. All 24 processes, observed brokers and source/artifact verification joined successfully. No samples were discarded. Host one-minute load was 9.376–11.450; tails are retained rather than attributed to noise.

Metric, median (p95) Parent Candidate
Cold owner ms 183.267 (188.857) 453.257 (520.810)
Warm owner ms 141.459 (145.714) 182.479 (199.514)
Warm preparation ms 135.386 (139.533) 136.144 (147.538)
Warm retirement ms 6.073 (6.310) 47.427 (57.649)
Cold MAIN CPU ms 30.188 (31.737) 26.220 (30.325)
Warm MAIN CPU ms 14.153 (15.320) 7.827 (9.243)
Cold MAIN allocation MB 30.943 (31.248) 14.589 (16.491)
Warm MAIN allocation MB 22.608 (25.778) 6.557 (8.737)
Whole process-tree CPU ms 1,050 (1,340) 1,310 (1,440)

Main allocation excludes the broker, so it is not a global memory-saving claim. A/A cold owner medians were 186.086/184.935 ms, warm 147.092/145.145 ms, and tree CPU 1,060/1,050 ms.

Rerunnable workload: build each pinned checkout with pnpm build sourcePerformance, then run node --expose-gc scripts/perf/plugin-capture-custody-measure.mjs --repo <built-checkout> --fixture <synthetic-fixture> --label <arm>. Use --fault source or --fault native with --delay-ms 2000 and candidate --expect-off-main for the injected faults. The driver and preload are included in this PR.

Synthetic fixture setup and repeatable workload

Create the surrounding fixture once with the existing generator, outside the measured window:

node --expose-gc --import ./scripts/tsx.mjs scripts/perf/catalog-publication-measure.mjs \
  --state-dir /absolute/new-fixture --create --sessions 5000 --database-gib 35 \
  --workspace-files 62000 --workspace-file-bytes 17742 --samples 1
node --import ./scripts/tsx.mjs --input-type=module - /absolute/new-fixture/physical <<'NODE'
import fs from 'node:fs';
import path from 'node:path';
const root = path.resolve(process.argv[2]);
fs.mkdirSync(root, { recursive: true });
process.env.OPENCLAW_STATE_DIR = path.join(root, 'fixture-setup-state');
process.env.OPENCLAW_CONFIG_PATH = path.join(root, 'absent-config.json');
const { createFixture, nativeSize } = await import('./src/plugins/plugin-generation-artifact.admission.test-support.ts');
const { bytes, ...fixture } = createFixture(path.join(root, 'source'), false);
if (bytes.length !== nativeSize) throw new Error('Unexpected synthetic native payload size');
fs.writeFileSync(path.join(root, 'fixture.json'), JSON.stringify({ fixture, nativeSize }) + '\n');
NODE

Build baseline and candidate separately. Invoke the candidate's committed driver against each built --repo, with unique labels and the same --fixture /absolute/new-fixture/physical. Run A1/A2/A/B five times serially, then A/B for each source/native fault. Wrap each process in /usr/bin/time -l for the whole-tree CPU column. Preserve source/build hashes and every JSON row. The synthetic payload is 2 MiB; real addon loading and post-exit reclaim are separately proven by the focused lifecycle test.

Focused proof covers the original main-thread guard, preparation cancellation/deadline/settlement, physical cache retention, real addon loading and reclaim exclusion, old-lease/successor overlap, ordinary same-process restart reuse, and actual broker-loss recovery. The sealed-only intermediate candidate failed the real process-loss regression; the final owner predicate passes all 17 lifecycle and 18 transport-retirement cases. A test-only watcher barrier timed out during validation; it now uses a bounded async sentinel wait under the unchanged deadline, and all four affected/cascading cases passed. Final affected types, lint, formatting and independent Codex reviews pass.

Before the CI-repair commit, full pnpm check:changed --staged --base 2435c1faa791de766688ba27ca7a14a92e30b7e4 passed every gate except dead exports: 113 identities match the exact parent, plus one task-owned benchmark export. The benchmark now uses an explicit shared installer; its targeted script-export scan, lint/format and all four baseline/candidate source/native fault qualifications pass. The 113 parent findings remain a failed local gate, not a green result or an automatic CI waiver. Exact-head CI and final-head zero-open ClawSweeper review are required before landing.

The first exact-head CI run, 43987530227, found incomplete consumer migrations: a missing wrapper inventory entry, stale capture-root observations and low-space injection, an overbroad physical commit return type, an unregistered fixed protocol export, a new lint suppression, and test-line growth. The repair restores the existing contracts. The real broker low-space test also exposed lost source-acquisition classification before session creation; forwarding that existing fact restores startup containment while leaving transport and cleanup failures fatal. No failures from that CI run are claimed inherited. Repair head d82c6f178d6b4cb1c09de4974664cd5140fb3f88 passes focused regressions, production types and all affected test type graphs, type-aware lint, formatting, the export-owner guard, the 400-line test budget without allowance, and independent Codex review. Its CI run completed with only the static type-cycle failure described below; ClawSweeper cleared all six items on that head.

Local provisioning covers 16 of the 17 Linux CI failures; the remaining filesystem case is platform-specific and remains CI proof. The selector also included a Darwin-only full cold/warm sibling case already known to have an unexplained timeout: it exceeded its 120-second deadline, reporting 202.398 seconds while synchronous subprocess work finished. That local failure is retained and is not classified inherited; its passing sibling cases are not a claimed fix. No full provisioning replay or blind CI rerun was performed.

CI run 43995776480 on d82c6f1 passed the previously failing checks but exposed one static type dependency cycle between admission state and the lease module. Head 274e2ab300d4866700dec1891bf67dbe2e60568f moves the unchanged contract into an import-free type leaf and updates all four consumers. The exact Madge guard now reports zero cycles; core types, type-aware lint, format and independent Codex review pass. This five-file change contains no executable behavior change and does not require remeasuring the prior performance results. Final-head CI and ClawSweeper re-review remain required; no inherited-failure exception is claimed.

Move source/native capture root and staging-token custody into the existing
broker resource owner. Preserve cache/recovery retention and loaded-addon
custody across execution shutdown, ordinary Gateway restarts, and broker loss.

The actual root boundary now performs zero main-thread metadata calls instead
of 28; two-second create faults leave the Gateway event loop responsive.
Cold/warm preparation and whole-process CPU costs are measured and disclosed
in the PR. No schema, config, cache, or public protocol changes.
@clawsweeper

clawsweeper Bot commented Nov 17, 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 scripts Repository scripts agents Agent runtime and tooling size: XL labels Nov 17, 2026
@steipete
steipete marked this pull request as ready for review November 17, 2026 00:25
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T01:57:28.657117Z 274e2ab New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 17, 2026
@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR moves plugin source and native capture-root creation and physical custody into the existing resource broker.

Example: Plugin preparation encounters a two-second source-directory creation delay.

  • Before: The reported main-thread heartbeat gap reaches 2,029 ms.
  • After: The broker absorbs the delay while the reported heartbeat gap stays at 7 ms.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful production-boundary repair with explicit tradeoffs, resolved prior findings, and a behavior-preserving final delta; exact-head CI remains unfinished.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Supplied built Node/APFS results exercise the production preparation owner, actual broker transport, physical source/native creation faults, and joined retirement; focused lifecycle evidence covers loaded addons, restart reuse, and broker loss, while the final delta only relocates a type.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Gateway requests can pause while plugin preparation waits for filesystem creation.
Reason: The maintainer-authored direction accepts the measured resource costs for removing this specific foreground stall, without claiming universal filesystem responsiveness.

Merge readiness

✅ Ready for maintainer review

This PR addresses a concrete Gateway responsiveness problem, and the earlier findings remain resolved; no actionable defect was found in the final type-only repair, while exact-head CI is still pending.

Priority: P2
Reviewed head: 274e2ab300d4866700dec1891bf67dbe2e60568f

Before merge

None.

Findings

None.

Agent review details

How this fits together

Plugin and catalog preparation turn installed source into captured artifacts; the broker now owns physical roots and staging tokens while existing host leases retain cache, recovery, and loaded-native custody.

flowchart LR
  A[Gateway preparation] --> B[Existing resource broker]
  B --> C[Capture roots and tokens]
  C --> D[Preparation workers]
  D --> E[Host artifacts]
  E --> F[Cache and recovery leases]
  F --> B
Loading

Technical review

Best possible solution:

Complete the broker custody cutover while preserving existing admission, independent leases, restart behavior, and joined cleanup.

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

Current-main source reaches synchronous capture-root allocation, and the supplied built-runtime fault results isolate the resulting event-loop stall; this read-only review executed no target code.

Is this the best way to solve the issue?

The existing broker is the appropriate physical owner because moving directory creation alone would leave staging-token operations and custody on main.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against af9d6236b33f.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 9c93bc3 adds src/infra/worker-native-lifecycle.ts:254 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9c93bc347cec; files: src/infra/worker-native-lifecycle.ts)
  • Krzysztof Kisiel: Raw commit a99f797 adds src/plugins/plugin-generation-worker.ts:38 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a99f797f39ce; files: src/plugins/plugin-generation-worker.ts)
  • Vincent Koc: Raw commit 99f5d0f adds src/plugins/plugin-generation-native-roots.ts:23 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 99f5d0f8e4e0; files: src/plugins/plugin-generation-native-roots.ts)
  • Dallin Romney: Raw commit d0e09e4 adds src/plugins/plugin-generation-worker.ts:405 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d0e09e419d7e; files: src/plugins/plugin-generation-worker.ts)

PR surface

Source +685, Tests +400, Docs +14, Other +401. Total +1500 across 40 files. Added test files: 3.

View PR surface stats
Area Files Added Removed Net
Source 21 937 252 +685
Tests 13 487 87 +400
Docs 1 14 0 +14
Config 0 0 0 0
Generated 0 0 0 0
Other 5 404 3 +401
Total 40 1842 342 +1500

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit. Replaced prior rating: 🦪 silver shellfish.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Filesystem creation during plugin preparation can stall Gateway foreground work, with a bounded, measured repair.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit. Replaced prior rating: 🦪 silver shellfish.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-11-17T00:43:30.853Z sha 03b70d9 :: needs changes before merge. :: [P1] Include the extracted manifest in the trusted wrapper inventory | [P2] Observe broker-created roots in snapshot cleanup tests | [P2] Move the low-space fault to the capture owner | [P2] Track the host recovery root separately from broker scratch | [P2] Register the required resource-factory export with the guard | [P2] Register the broker-port suppression in its existing inventory
  • reviewed 2026-11-17T01:34:35.058Z sha d82c6f1 :: needs maintainer review before merge. :: none

Reviewed November 16, 2026, 9:00 PM ET / November 17, 2026, 02:00 UTC (Revision 3).

Complete capture-root consumer migration, restore low-space setup
containment through the existing source-acquisition classification, and
keep physical commit typing distinct from asynchronous leases.

Preserve actual cleanup and yielding proof, update wrapper and fixed
factory inventories, and remove the redundant broker-port suppression.
@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Nov 17, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Addressed all six items from review 6934080805 in head d82c6f1:

  1. Wrapper inventory: wrapper-components.txt:1236 includes the extracted dependency manifest. Both eager-closure cases and the 16 applicable Linux provisioning cases pass locally; the platform-specific case remains CI proof.
  2. Snapshot cleanup: snapshot test:111 injects both failures into actual private immutable capture output. Lines 149–152 assert one non-installed root, completed removal and no synchronous Atomics wait. Both variants and the existing raw-source classification consumers pass.
  3. Low-space owner and containment: disk test:132 injects into the fresh broker and retains startup continuation/cached refusal. This exposed a real classification regression, now repaired at resource:165, client:75, and preparation:544. Only existing classified acquisition failures are contained; transport and cleanup failures remain fatal. The broker regression is red before and green after this repair.
  4. Recovery root and yielding: Gateway test:80 gates the real async copy, proves independent event-loop progress while it is unsettled, then checks its actual destination, joined removal, surviving original source and callable provider. The finally block releases and joins the operation. The final regression passes.
  5. Required factory name: collision guard:703 recognizes only the two actual native-resource implementations. The existing parameterized contract:49 still rejects unrelated modules and exports. Both regression and production guard pass.
  6. Suppression removed: resource:59 binds the serialized sender using the existing SQLite sibling pattern; line 116 calls it. This removes the suppression rather than expanding its inventory. Suppression inventory and type-aware lint pass.

Production and affected test types, scoped lint/format, the 400-line test budget and independent Codex review pass. The PR body retains the unexplained extra Darwin-only provisioning timeout and identifies all performance numbers as prior-03b measurements. Exact-head CI is still required; no inherited-CI exception is claimed.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete

Copy link
Copy Markdown
Contributor Author

Head 274e2ab fixes the one remaining CI failure from run43995776480: the new shared type created a static import back-edge between admission state and the lease module.

The unchanged contract now lives in an import-free type leaf, with direct type-only imports from all four consumers. No executable statement, physical operation, error policy, or guard allowance changed. The exact failed Madge guard reports zero cycles; core types, scoped type-aware lint, formatting and independent Codex review pass.

All six findings addressed in the numbered response remain resolved. Your completed d82 review had zero open items; please check this final type-only delta. The body retains prior-revision measurement labels, adverse costs and the unexplained local Darwin timeout. New exact-head CI remains required, with no inherited-red exception.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete merged commit 907e17b into main Nov 17, 2026
148 of 149 checks passed
@steipete
steipete deleted the steipete/perf-2535-plugin-capture-custody branch November 17, 2026 02:24
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Nov 17, 2026
…200374)

* fix(plugins): keep reload recovery metadata off the Gateway thread

Move the complete asynchronous recovery copy into the existing capture
broker, including root creation, copy filtering, native link validation,
and cleanup. Reuse one physical copy algorithm for the retained sync fork.

Follow up on #198262 and Wes (@akmad)'s original #181491 recovery work.
Preserve the independent native leases established by #200320.

A synthetic two-second create delay reduces the median MAIN heartbeat
gap from 2010 to 10 ms. Cold owner time rises 94.750 to 124.388 ms;
that cost and the remaining synchronous fork/import contracts are recorded
in the PR evidence. No configuration or schema changes.

* fix(tooling): include recovery imports in the PR wrapper

* test: prepare runtime build graph workers before test launch

A cold full Vitest worker compilation took 76 seconds inside the first 60-second heartbeat build-graph test. Enroll this selection in the existing runner preparation owner; preserve graph selection, test limits and assertions. Direct and projects runner regressions fail before the correction and all 55 runner cases pass afterward. Changed checks retain only the previously attributed Slack/UI dead exports.

* test: provide compiler artifacts for eager tooling admission

Use the existing controlled compiler for the unrestricted tooling selection. The eight-case admission table reproduces the missing manifest before this fixture migration and passes after it; retain the compiler count, receipt and selection assertions. No production behavior or timeout changes.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 17, 2026
…w#200320)

* fix(plugins): avoid Gateway stalls during source preparation

Move source/native capture root and staging-token custody into the existing
broker resource owner. Preserve cache/recovery retention and loaded-addon
custody across execution shutdown, ordinary Gateway restarts, and broker loss.

The actual root boundary now performs zero main-thread metadata calls instead
of 28; two-second create faults leave the Gateway event loop responsive.
Cold/warm preparation and whole-process CPU costs are measured and disclosed
in the PR. No schema, config, cache, or public protocol changes.

* fix(plugins): preserve capture failure contracts across broker custody

Complete capture-root consumer migration, restore low-space setup
containment through the existing source-acquisition classification, and
keep physical commit typing distinct from asynchronous leases.

Preserve actual cleanup and yielding proof, update wrapper and fixed
factory inventories, and remove the redundant broker-port suppression.

* refactor(plugins): keep native capture contract in a type leaf
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 17, 2026
…penclaw#200374)

* fix(plugins): keep reload recovery metadata off the Gateway thread

Move the complete asynchronous recovery copy into the existing capture
broker, including root creation, copy filtering, native link validation,
and cleanup. Reuse one physical copy algorithm for the retained sync fork.

Follow up on openclaw#198262 and Wes (@akmad)'s original openclaw#181491 recovery work.
Preserve the independent native leases established by openclaw#200320.

A synthetic two-second create delay reduces the median MAIN heartbeat
gap from 2010 to 10 ms. Cold owner time rises 94.750 to 124.388 ms;
that cost and the remaining synchronous fork/import contracts are recorded
in the PR evidence. No configuration or schema changes.

* fix(tooling): include recovery imports in the PR wrapper

* test: prepare runtime build graph workers before test launch

A cold full Vitest worker compilation took 76 seconds inside the first 60-second heartbeat build-graph test. Enroll this selection in the existing runner preparation owner; preserve graph selection, test limits and assertions. Direct and projects runner regressions fail before the correction and all 55 runner cases pass afterward. Changed checks retain only the previously attributed Slack/UI dead exports.

* test: provide compiler artifacts for eager tooling admission

Use the existing controlled compiler for the unrestricted tooling selection. The eight-case admission table reproduces the missing manifest before this fixture migration and passes after it; retain the compiler count, receipt and selection assertions. No production behavior or timeout changes.
RomneyDa added a commit that referenced this pull request Nov 18, 2026
…0216)

Move private socket directory creation and cleanup to the existing broker
process. Keep exclusive admission, private permissions, startup errors,
and joined cleanup. Parent crash cleanup follows successful readiness.
Accept the recoverable private directory orphan before readiness.

(cherry picked from commit 775be7a)

Release adaptation: retain the stable inline 103-byte socket path bound
instead of importing the newer socket-directory helper. Reuse the saved
real cold-resource regression with direct filesystem spies instead of
introducing the later all-filesystem observation helper.

Required companion: #200453 (22d5c87)
will follow to preserve the parent-decided directory in broker bootstrap.
#200320 source capture, #200370 host/readiness interface, #200567 retired
request cleanup, and 4a9273a export correction are separate owners,
not prerequisites for this stable private-directory lifetime.

Co-authored-by: RomneyDa <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 18, 2026
Backport #200320 to the stable preparation owner. Physical roots and tokens stay independent of execution-worker lifetimes; native commit joins publication settlement. Preserve source filters, native authority, and failure custody.

(cherry picked from commit 907e17b)
Co-authored-by: RomneyDa <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 19, 2026
* fix(plugins): avoid Gateway stalls during source preparation

Move source/native capture root and staging-token custody into the existing
broker resource owner. Preserve cache/recovery retention and loaded-addon
custody across execution shutdown, ordinary Gateway restarts, and broker loss.

The actual root boundary now performs zero main-thread metadata calls instead
of 28; two-second create faults leave the Gateway event loop responsive.
Cold/warm preparation and whole-process CPU costs are measured and disclosed
in the PR. No schema, config, cache, or public protocol changes.

* fix(plugins): preserve capture failure contracts across broker custody

Complete capture-root consumer migration, restore low-space setup
containment through the existing source-acquisition classification, and
keep physical commit typing distinct from asynchronous leases.

Preserve actual cleanup and yielding proof, update wrapper and fixed
factory inventories, and remove the redundant broker-port suppression.

* refactor(plugins): keep native capture contract in a type leaf

(cherry picked from commit 907e17b)
Co-authored-by: RomneyDa <[email protected]>
Release adaptation: #200320 is required by #200374 because the baseline async recovery path still performs root creation, filtering and link metadata synchronously on the Gateway. Retain the coherent existing broker-resource migration rather than invent a second worker owner.:
(cherry picked from commit a7feea3b844d37918527cca29e9f9812b61b156a)
RomneyDa added a commit that referenced this pull request Nov 19, 2026
…200374)

* fix(plugins): keep reload recovery metadata off the Gateway thread

Move the complete asynchronous recovery copy into the existing capture
broker, including root creation, copy filtering, native link validation,
and cleanup. Reuse one physical copy algorithm for the retained sync fork.

Follow up on #198262 and Wes (@akmad)'s original #181491 recovery work.
Preserve the independent native leases established by #200320.

A synthetic two-second create delay reduces the median MAIN heartbeat
gap from 2010 to 10 ms. Cold owner time rises 94.750 to 124.388 ms;
that cost and the remaining synchronous fork/import contracts are recorded
in the PR evidence. No configuration or schema changes.

* fix(tooling): include recovery imports in the PR wrapper

* test: prepare runtime build graph workers before test launch

A cold full Vitest worker compilation took 76 seconds inside the first 60-second heartbeat build-graph test. Enroll this selection in the existing runner preparation owner; preserve graph selection, test limits and assertions. Direct and projects runner regressions fail before the correction and all 55 runner cases pass afterward. Changed checks retain only the previously attributed Slack/UI dead exports.

* test: provide compiler artifacts for eager tooling admission

Use the existing controlled compiler for the unrestricted tooling selection. The eight-case admission table reproduces the missing manifest before this fixture migration and passes after it; retain the compiler count, receipt and selection assertions. No production behavior or timeout changes.

(cherry picked from commit 5275f43)
Co-authored-by: RomneyDa <[email protected]>
Release adaptation: apply after #200320 native capture owner prerequisite; retain source recovery copy and regression contracts unchanged. Follow-up #200571 detaches the independent owner from retired caller context.:
(cherry picked from commit b1d97f0a472874e12bbfb3a0e429f97f509d3710)
RomneyDa added a commit that referenced this pull request Nov 19, 2026
…#200983)

(cherry picked from commit 929f2e7)
Co-authored-by: RomneyDa <[email protected]>
Release adaptation: required #200320 companion; safely abandon native factories that never dispatched and retain cleanup obligations after broker startup failure.:
(cherry picked from commit f2af7017a4995544bfcdca0001076661681fa6c3)
maplel pushed a commit to maplel/openclaw that referenced this pull request Nov 24, 2026
* fix(workers): preserve missing-module startup errors

Render non-Error diagnostic causes before forwarding native worker failures so loader host objects cannot replace the original error with DataCloneError. Keep primitive causes and structured Error metadata, and verify the real supervisor error and join path on stock Bun, the pinned fork, and Node.

Removes the native error-forwarding dependency on oven-sh/bun#46711.

* fix(workers): narrow serialized diagnostic scalars explicitly

* test(workers): consolidate native failure regressions

Reuse one shared and cyclic error graph, extend the downlevel value table, and cover missing worker entries inside the existing supervisor recovery flow before its healthy sibling control. Preserve the original cases while reducing test lines by two against the PR base; remove the now-unneeded allocation.

(cherry picked from commit 058133d)

Release adaptation: Only cloneable diagnostic normalization and encoder/lifecycle regressions. Later inherited-code fix 416b357 is independent, not prerequisite; supervisor timing and plugin startup rewrites excluded.

Follow-up dispositions: d82e097 test(process): wait for broker failure before retained replacement (openclaw#202539); 416b357 fix: preserve the real reason a worker failed; 907e17b fix(plugins): avoid Gateway stalls during source preparation (openclaw#200320); adb660f fix: allow retrying refused native worker cleanup (openclaw#198240)

Validation: Direct exported encoder/decoder: baseline fails 3 non-Error diagnostic cases; fixed passes 3; primitive and Error graph regression retained. Normal wrapper lifecycle proof pending compiled-worker setup. diff --check passes.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit cb68af332a1182ed21b39c10b53b1f6e3036461c)
(cherry picked from commit 7a4af04d616ab677c58fa1f369b947bef45c382a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant