Skip to content

fix(plugins): prevent Gateway stalls while copying reload recovery - #200374

Merged
steipete merged 4 commits into
mainfrom
steipete/perf-2535-recovery-copy-final
Nov 17, 2026
Merged

steipete merged 4 commits into
mainfrom
steipete/perf-2535-recovery-copy-final

Conversation

@steipete

@steipete steipete commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Keeps plugin reload recovery from blocking the Gateway event loop while creating and copying its private recovery source.

Follow-up to #198262, #200320 and #200136. #198262 already adapted and credited Wes (@akmad)'s rollback-capture work from #181491; this change addresses the remaining physical metadata inside that asynchronous copy, while preserving its synchronous fork contract. The motivating Team incident (25c9790, 2026-11-16 05:02 PST) held MAIN in openat2(O_CREAT) for 1.97 seconds while btrfs waited for a transaction. After physical preparation custody moved to the broker, the real serving-plugin reload recovery path still performed synchronous root creation and metadata work in the copy filter on MAIN. Awaiting fs.promises.cp did not move those filter callbacks off the event loop.

User Impact

Reload recovery still waits for its source copy, but unrelated Gateway work can continue during a filesystem stall. No configuration, schema or operator action changes.

The measured tradeoff is explicit: normal cold owner time increases by about 30 ms, from 94.750 to 124.388 ms. Warm median owner time is 87.023 versus 86.476 ms, but its maximum increases from 227.783 to 266.447 ms. These costs are accepted for removing the foreground filesystem boundary; this is not an overall speedup claim.

Why This Change Was Made

The existing broker resource now owns the complete asynchronous recovery copy: root creation, copy/filter work, link relocation, native-reference validation and physical cleanup. The host retains native leases and path mappings. Failed-copy roots stay recorded under the same owner until cleanup succeeds; sequential release/close settlement preserves both failures.

The retained synchronous fork and broker-owned asynchronous copy share one physical copy algorithm. No second manager, cache, schema, configuration switch or public protocol is introduced. Production grows by 159 lines for the private command/adapter and complete lifetime handoff; duplicated copy/filter policy is removed. Existing synchronous recovery forks and runtime-selected synchronous imports remain separate contracts, so this PR does not claim every Gateway filesystem path is asynchronous.

Evidence

The existing main-thread filesystem observer reproduces the defect through the real loaded serving-plugin recovery owner. In five compiled fault pairs, the baseline executes 28 selected MAIN sync calls and records heartbeat gaps of 2,007–2,014 ms; the candidate executes zero and records 7–14 ms while the actual broker create is delayed for about two seconds. Median heartbeat gap is 2,010 versus 10 ms. The recovery operation itself still waits: fault owner medians are 2,132.034 versus 2,164.273 ms.

The synthetic plugin actually imports 199 companion payloads and proves their evaluated lengths through its retained provider callback. Every run copies 202 regular files totaling 1,647,404 bytes, verifies copied entry bytes, joins removal and retains the serving callback. A minimal three-file qualification exposed an undersized workload and was replaced before accepted measurements; the unused 2 MiB native fixture input is not counted as copied work. Surrounding 35 GiB/5,000-session/62,000-file fixtures are synthetic and are not scanned by this owner. No Team data was copied.

Canonical built Node 26.12.1/APFS proof ran 20 normal processes (five A1/A2 controls and five A/B pairs, each cold/warm), then five two-second A/B fault pairs. All 30 processes and observed brokers exited; source/build/driver/fixture hashes were verified and every row retained. The baseline is the physical-custody revision 03b70d9; the candidate also includes its later source-acquisition error projection and sender/type repair. The error projection is inactive on successful samples, and the subsequent pure type-leaf move changes no executable behavior. These dependency differences are explicit rather than described as identical bytes.

Normal metric Baseline median Candidate median
Cold owner ms 94.750 124.388
Warm owner ms 87.023 86.476
Cold MAIN CPU ms 44.200 6.504
Warm MAIN CPU ms 35.311 5.224
Cold MAIN allocation MB 32.651 5.297
Warm MAIN allocation MB 30.196 5.642
Whole process-tree CPU ms 3,440 3,440

MAIN counters exclude broker work. Whole-tree CPU includes fixture generation, imports and initial plugin loading; it is not an exclusive recovery CPU measure or a global savings claim. A/A cold owner medians were 123.342/101.710 ms, warm 105.621/111.534 ms. Host one-minute load ranged from 27.257 to 41.711 despite pausing this task's other local work. Variability limits precision; no tail is dismissed as noise. Candidate warm capture maximum was 255.886 ms versus 171.691 ms, while cold capture maximum improved from 145.623 to 117.785 ms.

Rerun using the committed scripts/perf/plugin-capture-custody-measure.mjs and fixture setup from #200320. Build each pinned checkout with pnpm build sourcePerformance, then invoke the candidate driver against each --repo with the same fixture and a fresh label:

node --expose-gc scripts/perf/plugin-capture-custody-measure.mjs \
  --repo <built-checkout> --fixture <synthetic-fixture> --label <arm> --operation recovery

Add --fault recovery --delay-ms 2000, plus candidate --expect-off-main, for the fault arms. Run A1/A2/A/B five times serially, followed by five A/B fault pairs; wrap processes in /usr/bin/time -l for whole-tree counters. Fixture generation, initial loading and byte verification are outside the owner timing intervals.

Focused consumer proof passes 56 tests with one existing cross-filesystem skip. The final Gateway regression gates the actual broker copy, proves the event loop advances while it is pending, checks the real source/destination and exact copy count, and observes zero selected MAIN sync calls through capture and joined disposal. Core and affected test types, scoped lint/format/line limits and the static import-cycle guard pass. Independent final publication Codex review is scoped-clean; its complete source receipt includes the adapted Gateway gate, scaled workload and error-cause fields.

The earlier full pnpm check:changed retained 14 production/108 full-tree dead-export identities identical to its exact parent, with no added or removed identities. Its task-owned style issues were fixed and rechecked. This is a recorded local failure, not an all-green census or an inherited-CI exception. Exact-head CI and final-head zero-open ClawSweeper review remain landing gates.

The final 14 reviewed file hashes apply unchanged to main 53278c30303, which contains #200320. The dependency lock and scoped instructions are unchanged. Both current-main Gateway cases pass. The final pnpm check:changed run passes every gate except the unused-export scan: five production findings and three full-tree findings in Slack/UI, outside this patch. Both scans reproduce identically on exact clean parent 53278c30303. The Slack exports were introduced by abdc09f1355 (#143882), browser approval by 1ce9df608b4 (#200088), and the two other UI exports lost their last production consumers in c3baf0d8484 (#199111). These are named main regressions for follow-up, not ignored noise. No inherited-CI exemption is claimed; exact-head green CI remains required. This is a current-main follow-up, not a rewrite of the older contributor fork.

CI repair: the first exact-head run 44005730906 found four newly reachable modules missing from the extracted PR-wrapper inventory. Both closure tests failed locally before the correction and passed afterward. The two applicable provisioning cases pass on macOS; the third case requires Linux and remains covered by the new CI run. Four inventory entries complete the existing extraction contract, with no production change or exception. Fresh independent Codex review of this correction is scoped-clean.

The live entry-point proof now passes through an isolated built Gateway and the public plugins.reload RPC. With exactly one successful recovery-root create held for two seconds, the baseline blocked Gateway MAIN and overlapping HTTP/WebSocket health requests took up to 1,998/2,088 ms. The candidate held the separate broker for 2,007 ms while 48 HTTP and 23 WS responses completed during the hold; overlapping maxima were 223/249 ms. Both reloads published the synthetic plugin from v1 to v2 without restarting, removed the recovery root, and completed a real openai/gpt-5.6-luna assistant turn with the expected response and normal stop. Those turns were requested during the hold and completed afterward; inference completion within the hold is not claimed.

Both canonical live wrappers and cleanup exited successfully. This uses retained canonical builds whose recovery runtime matches the final patch, with only a later erased type-import difference; it is not presented as an exact-final-head full build. Exact-head CI is separate. This bounded APFS fault proof supplements the accepted CPU/allocation campaign without rerunning it. One earlier injector qualification mistakenly included a preparation-worker root; its failed evidence was preserved, the path predicate and receipt identity were corrected, and it is excluded from accepted results.

The second CI run (44008299130) exposed a cold test-worker preparation defect: the first timed heartbeat build-graph case waited for a 76,348 ms full worker compilation (20,233 inputs), exceeding its unchanged 60-second deadline. The existing runner preparation owner now admits that test before launch. The new direct/projects boundary cases fail before the correction because no prepared manifest exists at launch; all 55 runner cases pass afterward in 31.39 seconds, including exclusion and cleanup. The original Bun build case passes in 483 ms after preparation is visibly completed before test startup. No timeout, graph selection, assertion or cache contract changes. Independent Codex review is scoped-clean. This is a concrete runner repair, not an inherited-CI exemption or a rerun for green.

The repair-only pnpm check:changed --staged --base cfcdaaadda05 passes all gates except the same five production/three full-tree Slack/UI exports already reproduced and attributed above. Script export findings remain zero. Gateway production remains +159 lines; this CI correction adds three tooling lines and 13 net test lines.

The third run (44012000507) identified one consumer fixture missed by that enrollment. Its unrestricted tooling case mocked compiler success without writing a manifest. A one-line fixture migration now uses the existing controlled compiler for that selection, retaining the real preparation owner and existing compiler-count/receipt assertions. The exact eight-case table reproduces one failure before the change and passes all eight afterward (7.58-second wrapper). No production change, added test, timeout change or weaker assertion; independent Codex review is scoped-clean. ClawSweeper accepted the live Gateway proof and identified this same fixture as its sole remaining item.

The fixture-only changed-check run again passes every gate except the identical five production/three full-tree Slack/UI unused exports, with zero script export findings. All 18 final file hashes are recorded; the eight Gateway production files remain unchanged.

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.
@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.

@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-17T03:44:36.576098Z 5af7106 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts size: XL labels Nov 17, 2026
@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. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. 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 asynchronous reload-recovery filesystem work into the existing capture broker while preserving synchronous recovery forks.

Example: A recovery-root creation stalls for two seconds during plugins.reload.

  • Before: Overlapping HTTP and WebSocket health requests take up to 1,998 and 2,088 ms.
  • After: During the broker hold, 48 HTTP and 23 WebSocket responses complete, and the plugin reloads from v1 to v2.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Useful owner-approved repair with shipped Gateway fault proof, preserved lifecycle contracts, and both prior findings resolved.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Supplied live output exercises the changed recovery owner through authenticated plugins.reload in an isolated built Gateway on APFS: a two-second broker hold permits overlapping HTTP/WS responses, successful v1-to-v2 replacement, joined root cleanup, and a real assistant response. Runtime equivalence to the final production patch is documented; later changes repair tooling fixtures. The inspected screenshots show unrelated UI and contribute no recovery evidence.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Reloading a serving plugin can freeze unrelated Gateway work while recovery source metadata waits on the filesystem.
Reason: The maintainer-authored direction accepts the measured owner-latency cost in exchange for demonstrated foreground responsiveness.

Merge readiness

✅ Ready for maintainer review

This PR addresses a remaining Gateway stall with a coherent broker-owned copy path. Both prior findings are resolved, and no new actionable defect was found; exact-head CI remains pending.

Priority: P2
Reviewed head: 2eef36ef8b3b134e192d7ee2f5f2796038601a6f

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway plugin replacement captures the serving generation before retirement; the broker copies its files, while host-owned mappings and native leases support rollback and eventual cleanup.

flowchart LR
  A[Plugin reload RPC] --> B[Reload recovery owner]
  B --> C[Host recovery adapter]
  C --> D[Existing capture broker]
  D --> E[Shared physical copy algorithm]
  E --> F[Private recovery files]
  C --> G[Native leases and path mappings]
  B --> H[Replacement or rollback]
Loading

Technical review

Best possible solution:

Retain the broker-owned asynchronous copy and shared synchronous copy policy, then land through the existing exact-head CI gate.

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

Current main creates recovery roots and executes synchronous copy-filter metadata on the Gateway thread; supplied before/after Gateway traces demonstrate the resulting delay under a two-second filesystem fault.

Is this the best way to solve the issue?

The patch fixes the physical operation at its existing broker boundary, preserves host native leases and synchronous fork contracts, and removes duplicated copy policy without introducing another manager.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Asynchronous recovery copying keeps the original intent (51f2fde: Await recovery copying before drain while preserving shared copy semantics and synchronous custody forks.)
  • Dependency-link relocation keeps the original intent (4d7db24: Keep Windows dependency junctions from pointing into a disposed seed capture.)
  • Physical capture custody keeps the original intent (907e17b: Move source/native root operations into the existing broker while retaining independent host leases.)
  • Capture-directory context keeps the original intent (45c9e5c: Keep worker capture directories under managed custody for cleanup after crashes.)
  • Test-worker preparation keeps the original intent (37887f2: Compile known worker consumers before launching their timed test processes.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 907e17b adds src/plugins/plugin-capture-native-resource.ts:25 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 907e17b9ff49; files: src/plugins/plugin-capture-native-resource.ts)
  • Krzysztof Kisiel: Raw commit a99f797 adds src/plugins/plugin-generation-source-lookup.ts:190 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-source-lookup.ts)

PR surface

Source +159, Tests +99, Docs 0, Other +254. Total +512 across 18 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 8 314 155 +159
Tests 5 243 144 +99
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 4 398 144 +254
Total 18 956 444 +512

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.

Review metrics

Metric Value Why it matters
Production and regression code Production +314/-155; tests +243/-143 Production growth completes the private broker command and lifetime handoff while sharing copy policy; regression changes cover broker responsiveness, native custody, link relocation, and runner admission.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • 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: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove merge-risk: 🚨 automation: Current PR review selected no merge-risk labels.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Filesystem stalls during plugin reload can delay unrelated Gateway requests, with a bounded fault reproduction and focused repair.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • 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-17T03:08:21.234Z sha 70952d3 :: needs changes before merge. :: [P1] [P1] Include the new dependencies in the extracted PR wrapper
  • reviewed 2026-11-17T03:49:03.645Z sha 5af7106 :: needs changes before merge. :: [P2] [P2] Migrate the tooling build-admission fixture

Reviewed November 16, 2026, 11:04 PM ET / November 17, 2026, 04:04 UTC (Revision 3).

@clawsweeper clawsweeper Bot removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Nov 17, 2026
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.
@steipete

Copy link
Copy Markdown
Contributor Author

Addressed the review items on head 5af710694f54536fa826b5f021572a6b5fa3c424:

  1. P1: extracted-wrapper dependencies. The four newly reachable runtime modules are now included in scripts/pr-lib/wrapper-components.txt:1754–1756 and :1792. Both closure regressions fail before this correction and pass after it. The applicable provisioning cases also pass locally, and the previously failing provisioning job passes in CI run 44008299130. No extraction exception was added.

  2. Shipped-Gateway proof gap. The actual built Gateway now passes a before/after fault pair through authenticated plugins.reload, with a serving synthetic plugin returning v1 before replacement and v2 afterward. Sanitized observation trace:

baseline: exactly one recovery create on Gateway MAIN, held 2010 ms
          overlapping HTTP /healthz max 1998 ms; WS health max 2088 ms
          responses completed inside hold: HTTP 0, WS 0
candidate: exactly one recovery create in separate capture broker, held 2007 ms
           overlapping HTTP /healthz max 223 ms; WS health max 249 ms
           responses completed inside hold: HTTP 48, WS 23
both: reload v1 -> v2; restartRequired=false; recovery root removed
      actual assistant returned RECOVERY_GATEWAY_OK with normal stop
      all owned processes joined, ports unbound, synthetic state removed

The real model turns were requested during the hold and completed afterward; this does not claim inference finished during reload admission. The bounded APFS fault uses preserved canonical builds with equivalent recovery runtime and a later erased type-import difference, not an exact-final-head full build. The PR body records that boundary and the excluded first injector attempt; CPU/allocation evidence remains the separate accepted campaign.

The second CI run exposed a distinct cold compiler preparation bug: 76,348 ms of full test-worker compilation began inside the first 60-second build-graph test. The existing runner preparation owner now finishes that work before test launch. Both direct/projects runner regressions fail before the fix and all 55 cases pass afterward; the original Bun build case passes with preparation visibly preceding startup. Timeouts, assertions and graph selection are unchanged. Independent Codex review is scoped-clean. Fresh exact-head CI is required before landing.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 17, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. 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. labels Nov 17, 2026
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.
@steipete

Copy link
Copy Markdown
Contributor Author

Addressed the latest review item in 2eef36ef8b3b134e192d7ee2f5f2796038601a6f:

  1. P2: tooling build-admission fixture. test/scripts/test-projects-build-admission.test.ts:1479 now installs the existing controlled worker compiler for the unrestricted tooling selection as well as infra. The actual compiler writes its manifest; the existing preparation-count and one-compiler-receipt assertions at lines 1521–1523 remain. The exact table reproduced the CI ENOENT before the change (one failed, seven passed) and now passes all eight cases in 7.58 seconds. No production change, net test-line growth, timeout change or assertion weakening. Independent Codex review is scoped-clean.

The earlier P1 wrapper inventory correction remains present, and the shipped-Gateway evidence accepted in this review remains unchanged. The completed third CI run identified only this admission-fixture failure. The PR body records the correction and the unchanged local Slack/UI export findings; fresh exact-head CI remains required before merge.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Nov 17, 2026
@steipete
steipete merged commit 5275f43 into main Nov 17, 2026
150 of 152 checks passed
@steipete
steipete deleted the steipete/perf-2535-recovery-copy-final branch November 17, 2026 04:12
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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
Backport #200374. Move root creation, source-copy filters, native link validation and cleanup into the existing capture broker. Share copy policy with retained synchronous forks and preserve independent exported native leases. No schema, permission, or retention change.

(cherry picked from commit 5275f43)
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant