Skip to content

refactor: simplify plugin reload ownership and tests - #146072

Merged
steipete merged 1 commit into
mainfrom
codex/plugin-reload-deslop-145816
Sep 12, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/plugin-reload-deslop-145816

Conversation

@steipete

@steipete steipete commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Related: #145484, #145816

What Problem This Solves

Plugin reload and recovery accumulated duplicated lifecycle dispatch, resolver handling, and regression fixtures. This cleanup makes the existing ownership rules easier to follow while retaining the recovery fixes from #145816.

Why This Change Was Made

Use the existing timeout and deferred owners, share the captured-module resolver loop and Gateway runtime-application guard composition, and remove one-use adapters and duplicated traversal. Consolidate repeated CLI TTY, channel, and service fixtures while preserving behavioral assertions.

The diff removes 298 lines overall: 107 production lines and 191 test/support lines. It retains the older-Node diagnostic fallback and both Bun resolver paths because they serve real runtime contracts.

User Impact

No intended behavior change. Plugin replacement, cancellation, shutdown deadlines, cleanup ownership, warnings, and runtime receipts retain their existing semantics. No configuration, schema, dependency, or public SDK changes.

Evidence

  • The focused baseline and final runs preserve all 1,118 tests across CLI, scheduler/spawn, Gateway admission/reload, module resolution, and plugin services.

  • Actual Bun 1.4.0 and 1.4.2 resolver fixtures verify aliases, identity, deferred dependencies, and captured generations.

  • Independent full-diff review through P2 found no actionable issues.

  • Full pnpm build passed, including native loading of 52 built plugin control-plane modules and Doctor import checks. Build metadata matches commit 93eb12ecbf473b31f3f4da7479cf7606ca021950.

  • Five isolated live Gateway cells passed on Node 26.5.0 and actual Bun 1.4.2/1.4.0: source/helper reload, rejected replacement retaining the working generation, successful retry, disabled plugins, read-only refresh, late-start cleanup, watcher contention, and pending old-stop rollback/retry. Contention returned in 20 ms; the pending-stop timeout retained its original owner and the next replacement succeeded. All five Gateway processes exited and all seven ports were rebound successfully.

  • Complete check:changed passed locally with all selected checks enabled. The initial standalone Testbox attempt ended with exit 255 during test-type checks without a diagnostic; it is not counted as passing.

  • Exact-head CI passed on 93eb12ecbf473b31f3f4da7479cf7606ca021950. ClawSweeper also found no actionable defect on this head.

  • Post-merge verification on main 6a6f500613c93c2fe26e13708c34f9ca63a186a3: all 26 changed files match the reviewed candidate, and 119 focused scheduler, mutation, native-loader, and service tests passed.

The live cells use synthetic plugins and isolated state. Pre-readiness ownership, internal shutdown-hook deadlines, SDK alias boundaries, and swarm membership remain covered by focused owner tests; external provider inference is outside this cleanup's scope.

@clawsweeper

clawsweeper Bot commented Sep 12, 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 gateway Gateway runtime cli CLI command changes agents Agent runtime and tooling labels Sep 12, 2026
@steipete
steipete marked this pull request as ready for review September 12, 2026 14:59
@openclaw-barnacle openclaw-barnacle Bot added size: L maintainer Maintainer-authored PR labels Sep 12, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 12, 2026
@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 12, 2026, 11:14 AM ET / 15:14 UTC (Revision 2).

ClawSweeper review

What this changes

Consolidates plugin reload, startup, shutdown, and module-resolution helpers and shared test fixtures while preserving existing behavior.

Merge readiness

✅ Ready for maintainer review

This remains a useful, distinct cleanup of the merged plugin-reload work. No actionable correctness or security defect was found, and the maintainer-authored PR is protected from automatic closure.

Priority: P3
Reviewed head: 93eb12ecbf473b31f3f4da7479cf7606ca021950

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A sound simplification with preserved behavioral assertions, relevant reported runtime validation, and no actionable findings.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The maintainer-authored internal refactor is exempt from contributor proof requirements and introduces no material authority change. Its supplied Node/Bun Gateway observations cover the changed reload and service owners; historical UI screenshots were excluded from this assessment.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored internal refactor is exempt from contributor proof requirements and introduces no material authority change. Its supplied Node/Bun Gateway observations cover the changed reload and service owners; historical UI screenshots were excluded from this assessment.
Evidence reviewed 10 items Introduced changes and merge identity: Reviewed the merge-base-to-head changes, including locally recovered truncated patches. The raw test-merge record has the pinned base followed by the exact PR head as parents; unrelated base changes were excluded.
Service cleanup ordering preserved: Both callers of stopServices mark the entire selected set before cleanup starts. Moving the reload assignment into its existing selection loop preserves that invariant and leaves cleanup deadlines and retained attempts unchanged.
Mutation guards retain their composition: The shared capture helper preserves the initial ownership check, the check before runtime application, and composition with the change's existing invoker guard for both mutation callers. It introduces no new authority or permission path.
Findings None None.
Security None None.

How this fits together

The Gateway coordinates plugin changes requested through management commands and APIs. Its lifecycle owners prepare replacements, stop affected resources, publish the new generation, and recover from failed activation.

flowchart TD
  A[Plugin management request] --> B[Current ownership checks]
  B --> C[Prepare plugin replacement]
  C --> D[Drain affected resources]
  D --> E{Activation succeeds?}
  E -->|Yes| F[Publish generation and receipt]
  E -->|No| G[Recover previous generation]
  F --> H[Retire owned resources]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -84, Tests -214. Total -298 across 26 files.

View PR surface stats
Area Files Added Removed Net
Source 11 141 225 -84
Tests 15 129 343 -214
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 26 270 568 -298

Review metrics

None.

Technical review

Best possible solution:

Keep lifecycle decisions with the existing Gateway and service owners while sharing equivalent mechanics and preserving recovery contracts.

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

Not applicable: this PR proposes behavior-preserving cleanup, and source review found no introduced failure to reproduce.

Is this the best way to solve the issue?

Yes: the patch reuses existing timeout, deferred, guard-composition, and fixture owners without adding competing policy or public API surface.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is internal simplification with no intended user-visible behavior change or demonstrated urgent defect.
  • 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. Not applicable: The maintainer-authored internal refactor is exempt from contributor proof requirements and introduces no material authority change. Its supplied Node/Bun Gateway observations cover the changed reload and service owners; historical UI screenshots were excluded from this assessment.

Evidence

What I checked:

Likely related people:

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

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 (1 earlier review cycle)
  • reviewed 2026-09-12T15:05:58.023Z sha 93eb12e :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 7c2269a into main Sep 12, 2026
264 checks passed
@steipete
steipete deleted the codex/plugin-reload-deslop-145816 branch September 12, 2026 15:20
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes gateway Gateway runtime maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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