Skip to content

perf(update): reuse plugin generations during candidate validation - #154674

Closed
steipete wants to merge 6 commits into
mainfrom
upd/candidate-validation-wall
Closed

steipete wants to merge 6 commits into
mainfrom
upd/candidate-validation-wall

Conversation

@steipete

@steipete steipete commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Candidate update validation repeatedly acquires the same installed external plugin sources and dependency trees for entry, setup, and Doctor surfaces.

Related: #154381, #154114, #144858. Thanks @ZaneMc-AO and @agebreak0083 for the field reports.

User Impact

This draft reuses prepared plugin generations within one disposable candidate rehearsal while keeping each executing consumer's files independent. It is held for Peter's decision: historical measurements reduced repeated acquisitions, but increased logical copy output by 24.55%, and the effect on slow disks and Windows remains unproven.

The scope is generation reuse only. Session-settlement repair is tracked in #155138; Doctor lint deferral is isolated in #155244. Neither repair remains in this PR’s authored delta.

Why This Change Was Made

The plugin-generation owner prepares one private source generation and its dependency-inspection facts, publishes it inside the disposable rehearsal, and supplies isolated runtime copies. Worker envelopes preserve that rehearsal identity across nested state scopes. Native links and SDK resolution remain bound to the candidate. Unavailable preparation records a warning and uses independent acquisition.

The installed 2026.9.4 driver still owns its initial snapshot copy and 300-second clamp. Candidate-side reuse cannot remove that already-running driver's work. The remaining change is 16 paths: production +1406/−438, tests +485/−0, docs +7/−0.

The decision is whether the reduction in repeated source acquisition justifies the extra copying of complete writable views on slow storage. No Windows or slow-disk improvement is claimed; keep this PR draft while that tradeoff is unresolved.

Evidence

The source split is exact: seven lint/settlement files were returned to main at 8c56f7239e98dbee1369e036d6b594fd560b9d9d; only their two documentation paragraphs were removed. All 15 retained source/test paths match the previously published producer 4b01224f5fc6dbbb66380abee06c2efaa3ec1213 byte-for-byte, and the seven-line generation paragraph is unchanged. git diff --check passes. A fresh generation-only build, test run, and published-driver hop have not been claimed.

Historical diagnostics used the published npm [email protected] updater with isolated state/free ports, ten v19 agent databases (365.797 MiB total; largest 338.73 MiB), and seven external npm plugins (Codex, WhatsApp, Discord, Slack, DeepSeek, Mistral, and Venice; 477.500 MiB total). The candidate upgraded the databases to v22; all three diagnostic hops passed integrity/foreign-key checks and retained transcript/trajectory hashes. The reporter timeout was not reproduced on the Linux Testbox.

The following source-acquisition comparison held both the settlement repair and lint deferral constant. It is historical generation-reuse evidence, not a fresh measurement of this generation-only, full-lint PR.

Historical variant Source acquisitions Source write MiB View copies View logical MiB Source + view logical MiB
Control with settlement + lint deferral 29 1472.268 0 0.000 1472.268
Generation reuse with settlement + lint deferral 7 477.272 15 1356.502 1833.774
Generation reuse with settlement + full lint 7 477.272 29 2379.292 2856.564

The first two rows grow by 361.506 MiB (+24.55%); Codex accounts for 87.94% of that increase. Complete bases replace selective entry acquisitions, and runtime consumers copy complete bases. Reflink was unavailable (ENOTSUP), so independent writable views used ordinary copies. These are observed API/logical payload bytes, not physical disk-write counters. The 2856.564 MiB full-lint row still includes settlement repair and is not a new generation-only hop.

Historical uninstrumented runs used three samples per variant. With settlement and lint deferral held constant, generation reuse changed validating-ledger median 64.056→62.713 s, with overlapping ranges (60.674–105.110 versus 57.210–66.566 s); rehearsal median 24.643→25.628 s also had overlapping ranges. Canary startup median changed 10.696→7.558 s. These data do not establish a generation-only end-to-end speedup. The ledger includes npm staging and is not the exact validator interval.

The unchanged generation implementation previously passed package builds and owner/sibling tests within the combined tree. Historical one-worker costs were 6.35 s wall / about 1.8 s tests for the generation-rehearsal file, and 24.50 s wall / about 1.7 s tests for plugin repair. Those runs and the combined-tree full checks are retained evidence, not new proof for this split. Fresh P1 autoreview of the generation-only composition is scoped-clean with no actionable P0/P1 findings. Exact byte/path checks and git diff --check passed; no new generation-only runtime proof is claimed.

The diagnostic probe paired all recorded acquisition/copy spans with successful outcomes and observed no measurement/settlement faults. Each hop lacked 26 other process-exit markers (24 threads and two child processes), so whole-log completeness remains unknown. Published-driver copy timing covered seven project copies; per-plugin copyIn attribution and physical disk counters were unavailable. These limits remain part of the draft decision.

Current generation-only head: 5dab15e8425d9ddc6d4b1831eda6a89176502a8c. DRAFT / HELD for Peter’s decision. No landing or auto-merge.

Keep required checks in copied rehearsals while recording optional core inspections for after activation. Avoid preparing runtime model and tool metadata for deferred checks, including the first hop driven by published 2026.9.4.

Related: #154381, #154114, #144858. Thanks @ZaneMc-AO and @agebreak0083 for the reporter phase evidence.
@clawsweeper

clawsweeper Bot commented Sep 21, 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.

@steipete
steipete marked this pull request as ready for review September 21, 2026 09:20
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation commands Command implementations size: M maintainer Maintainer-authored PR labels Sep 21, 2026
@steipete
steipete marked this pull request as draft September 21, 2026 09:26
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 21, 2026, 6:41 PM ET / 22:41 UTC (Revision 11).

ClawSweeper review

What this changes

The PR reuses prepared plugin sources across update validation checks while giving each executing consumer an independent writable copy.

Merge readiness

⛔ Blocked before merge - 5 items remain

Keep this distinct optimization open and held. Current main does not implement it, and the reported acquisition savings do not yet establish that the additional copying is worthwhile.

Priority: P2
Reviewed head: 5dab15e8425d9ddc6d4b1831eda6a89176502a8c
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The implementation has meaningful isolation coverage and real acquisition evidence; its performance tradeoff and standalone upgrade outcome remain unresolved.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Historical published-2026.9.4 updater runs exercised the retained generation implementation with real npm plugin trees and demonstrated reduced source acquisition with successful database checks. This supports generation reuse behavior, but does not prove an overall speedup or the standalone full-lint upgrade composition; that separate gap remains in risks.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Historical published-2026.9.4 updater runs exercised the retained generation implementation with real npm plugin trees and demonstrated reduced source acquisition with successful database checks. This supports generation reuse behavior, but does not prove an overall speedup or the standalone full-lint upgrade composition; that separate gap remains in risks.
Evidence reviewed 8 items Pinned introduced change: Reviewed the merge-base-to-head changes, including source preparation, artifact restoration, worker context propagation, recovery, documentation, and tests. The stale test merge was not used to attribute base-branch changes to this PR.
Concrete copying tradeoff: Each borrower recursively copies the published payload, using an optional reflink and otherwise ordinary copies; recorded dependency links are rebound into that borrower's view. This preserves isolation but makes the reported extra copy volume relevant to update latency and temporary-storage capacity.
Preparation, fallback, and execution boundary: Preparation publishes within the disposable rehearsal, checks source identity, binds the candidate host, and warns on unavailable preparation. Runtime reconstruction retains the consuming instance's execution callback; the new context carries an artifact namespace, not a new principal or permission grant. No Codex harness or protocol dependency was established by this generic plugin-copy implementation.
Findings None None.
Security None None.

How this fits together

Update validation runs Doctor and plugin checks against a disposable copy of the installation. The plugin-generation owner prepares source files and dependency facts for those checks before the updater decides whether the candidate can activate.

flowchart TD
  A[Installed updater] --> B[Disposable candidate copy]
  B --> C[Prepare plugin sources and dependencies]
  C --> D{Prepared generation available}
  D -->|Yes| E[Independent writable views]
  D -->|No| F[Independent acquisition with warning]
  E --> G[Doctor and plugin validation]
  F --> G
  G --> H[Candidate validation result]
Loading

Decision needed

Question Recommendation
Should complete-generation reuse proceed despite increased copying and no established overall speedup, or remain deferred? Keep held for representative measurements: Keep the draft held until standalone full-lint upgrade measurements establish whether the copying cost is worthwhile.

Why: The implementation has useful acquisition savings, but accepting its storage and platform tradeoff requires the explicitly requested maintainer judgment.

Before merge

  • Resolve merge risk (P1) - Complete writable views increase logical copying; slow disks or constrained temporary storage could make candidate validation slower or fail, and this tradeoff remains unaccepted.
  • Resolve merge risk (P1) - The standalone generation-only, full-lint composition has no published-updater validation result; historical combined-tree runs do not establish its upgrade outcome.
  • Complete next step (P2) - Complete the standalone published-updater validation and record Peter's decision before lifting the draft hold.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +968, Tests +485, Docs +7. Total +1460 across 16 files.

View PR surface stats
Area Files Added Removed Net
Source 12 1406 438 +968
Tests 3 485 0 +485
Docs 1 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 16 1898 438 +1460

Review metrics

Metric Value Why it matters
Historical acquisition tradeoff 29 → 7 acquisitions; logical copying +361.506 MiB (+24.55%) This controlled combined-tree comparison demonstrates less acquisition work but more copying, not a standalone end-to-end speedup.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-lint.worker.ts, migration/backfill/repair: src/infra/update-candidate-plugin-repair.ts, unknown-data-model-change: src/commands/doctor-lint.worker.ts, unknown-data-model-change: src/infra/update-candidate-plugin-repair.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Keep the optimization held (recommended)
    Defer landing until the standalone published-updater comparison resolves the latency and temporary-storage tradeoff.
  2. Accept measured copying overhead
    A maintainer may accept the additional copying after the standalone upgrade outcome is validated and the platform limitations remain explicit.

Technical review

Best possible solution:

Retain generation reuse only where representative published-updater evidence supports its storage and latency cost, while preserving independent runtime views and fallback acquisition.

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

Not applicable to the optimization itself: current source establishes repeated acquisition, and historical measurements quantify it. Those Linux runs did not reproduce the reporters' update timeout.

Is this the best way to solve the issue?

Unclear: extending the existing generation owner preserves a coherent ownership model, but fewer acquisitions alone do not justify complete-copy reuse without a demonstrated net benefit.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded update-performance optimization without a demonstrated fix for the reported timeout.
  • merge-risk: 🚨 availability: Additional full-payload copies can consume validation time and temporary storage on installations already struggling to update.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Historical published-2026.9.4 updater runs exercised the retained generation implementation with real npm plugin trees and demonstrated reduced source acquisition with successful database checks. This supports generation reuse behavior, but does not prove an overall speedup or the standalone full-lint upgrade composition; that separate gap remains in risks.
  • proof: sufficient: Contributor real behavior proof is sufficient. Historical published-2026.9.4 updater runs exercised the retained generation implementation with real npm plugin trees and demonstrated reduced source acquisition with successful database checks. This supports generation reuse behavior, but does not prove an overall speedup or the standalone full-lint upgrade composition; that separate gap remains in risks.

Evidence

What I checked:

  • Pinned introduced change: Reviewed the merge-base-to-head changes, including source preparation, artifact restoration, worker context propagation, recovery, documentation, and tests. The stale test merge was not used to attribute base-branch changes to this PR. (5dab15e8425d)
  • Concrete copying tradeoff: Each borrower recursively copies the published payload, using an optional reflink and otherwise ordinary copies; recorded dependency links are rebound into that borrower's view. This preserves isolation but makes the reported extra copy volume relevant to update latency and temporary-storage capacity. (src/plugins/plugin-generation-artifact-state.ts:162, 5dab15e8425d)
  • Preparation, fallback, and execution boundary: Preparation publishes within the disposable rehearsal, checks source identity, binds the candidate host, and warns on unavailable preparation. Runtime reconstruction retains the consuming instance's execution callback; the new context carries an artifact namespace, not a new principal or permission grant. No Codex harness or protocol dependency was established by this generic plugin-copy implementation. (src/plugins/plugin-generation-rehearsal.ts:246, 5dab15e8425d)
  • Historical production-path evidence and explicit hold: The supplied body snapshot reports published 2026.9.4 updater runs with ten databases and seven real npm plugins. Holding settlement repair and lint deferral constant reduced acquisitions from 29 to 7 but increased logical source-plus-view copying from 1472.268 to 1833.774 MiB. Timing ranges overlap. The full-lint measurement still includes settlement repair, and the body expressly claims no fresh generation-only hop or Windows/slow-disk improvement. Peter's decision remains requested, not granted. Captured context sourceRevision: 0032b7dc940161d8de1c55cf644ccc9c1878737af7c64d745e3db942192c9ad7. (5dab15e8425d)
  • Review continuity: The previous completed review examined this same head and contained no findings. Its two concrete follow-ups—standalone published-updater validation and a recorded copy-cost decision—remain unresolved in the supplied body. A direct comparison confirmed that the retained fifteen source/test paths are unchanged from 4b01224; historical implementation evidence therefore remains relevant without proving the new standalone composition. (5dab15e8425d)
  • Still distinct from main and released behavior: Fetched main still performs per-entry source inspection in candidate plugin repair. Its repair and artifact files are unchanged from the pinned merge base, and neither fetched main nor v2026.9.5 contains the new rehearsal-generation module. The supplied related PRs address settlement and lint deferral separately; neither supersedes generation reuse. (src/infra/update-candidate-plugin-repair.ts:123, 32c12d3eba7e)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • RichSomeday222: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Validate the standalone full-lint candidate through the published updater and record timing and copy-volume results.
  • Record Peter's acceptance, narrowing, or deferral of the generation-copy tradeoff.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (10 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-21T10:24:43.121Z sha 29ff04a :: blocked before merge. :: none
  • reviewed 2026-09-21T11:21:39.557Z sha 29ff04a :: blocked before merge. :: none
  • reviewed 2026-09-21T18:11:45.030Z sha 6a92442 :: blocked before merge. :: none
  • reviewed 2026-09-21T18:22:42.920Z sha 6a92442 :: blocked before merge. :: none
  • reviewed 2026-09-21T19:54:42.208Z sha e62832e :: blocked before merge. :: none
  • reviewed 2026-09-21T21:06:19.405Z sha 4b01224 :: blocked before merge. :: none
  • reviewed 2026-09-21T21:15:09.392Z sha 4b01224 :: blocked before merge. :: none
  • reviewed 2026-09-21T21:39:17.792Z sha 5dab15e :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. label Sep 21, 2026
Register transcript reconciliation with agent resource ownership before yielding, revoke new work during close, and join native completion plus lease release before the cached handle closes. Preserve cleanup custody when native settlement fails.
Share immutable plugin acquisition and inspection facts across candidate surfaces while retaining independent runtime views and late-input ownership. Leave disposable session projections to live startup, and preserve published-driver markers, native layouts, junction rebinding, fallback acquisition, and recovery.
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling size: XL and removed size: M labels Sep 21, 2026
@steipete steipete changed the title perf(update): defer optional lint during candidate validation perf(update): fit candidate validation inside the published updater's deadline Sep 21, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label Sep 21, 2026
@steipete
steipete marked this pull request as ready for review September 21, 2026 20:58
@steipete steipete closed this Sep 21, 2026
@steipete steipete reopened this Sep 21, 2026
@steipete
steipete marked this pull request as draft September 21, 2026 21:20
@steipete steipete changed the title perf(update): fit candidate validation inside the published updater's deadline perf(update): reuse plugin generations during candidate validation Sep 21, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. and removed P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Sep 21, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Closing this generation-reuse proposal without merging. The measured implementation does not establish an update speedup sufficient to justify its additional copying and lifecycle complexity.

With settlement repair and lint deferral held constant, repeated source acquisitions fell from 29 to 7, but source-plus-view logical output rose from 1,472.268 to 1,833.774 MiB: 361.506 MiB more, or 24.55%. The validating-ledger median improved from 64.056 to 62.713 seconds with overlapping ranges; the rehearsal median increased from 24.643 to 25.628 seconds. These are historical measurements of the combined tree, not fresh end-to-end proof of this generation-only split. Slow-disk and Windows benefits remain unproven.

The source explains the tradeoff: preparation captures complete plugin bases and each executing consumer receives a complete independent writable copy. Reflink is optional, so filesystems that cannot clone incur ordinary copying. The resulting additional artifact snapshot, publication, and rebinding lifecycle adds roughly 968 net production lines without a demonstrated overall improvement.

The independently useful fixes were preserved and already merged: #155138, which fixes validation settlement/database lock failures, and #155244, which defers optional candidate lint. This closure does not claim that main implements generation reuse. The measurements and branch remain useful evidence for a narrower future proposal that demonstrates an end-to-end improvement while accounting for copy volume and slower storage.

@steipete steipete closed this Sep 24, 2026
@RomneyDa
RomneyDa deleted the upd/candidate-validation-wall branch October 22, 2026 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling commands Command implementations docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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