Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
e59dc54 to
217d4d7
Compare
|
Codex review: needs maintainer review before merge. What this changesThis PR measures plugin-instance cleanup deadlines with a monotonic clock so system-clock adjustments cannot distort the cleanup budget. Example: The system clock advances 3000 ms before a plugin's 3500 ms cleanup completes.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current-main cleanup timing bug with a focused patch and applicable Gateway shutdown proof; no actionable findings remain, and exact-head CI is pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway registry retirement invokes PluginInstance disposal, which runs registered cleanup callbacks and returns cleanup failures while retaining ownership until physical settlement. flowchart TD
A[Gateway shutdown] --> B[Registry retirement]
B --> C[PluginInstance disposal]
C --> D[Monotonic cleanup deadline]
D --> E[Registered cleanup callbacks]
E --> F[Physical settlement and failure report]
Technical reviewBest possible solution: Keep deadline creation and remaining-budget calculation on performance.now() within the existing cleanup owner. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the clock-domain mismatch, supported by supplied red-base regression and Gateway shutdown traces; no target code was executed during this read-only review. Is this the best way to solve the issue? The two clock substitutions restore elapsed-time accounting without adding machinery or changing cleanup ownership, public contracts, or timeout values. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c8dfebcfaee8. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +4, Tests +15. Total +19 across 2 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (4 earlier review cycles)
Reviewed October 24, 2026, 7:45 PM ET / 23:45 UTC (Revision 5). |
217d4d7 to
c290f64
Compare
|
🦞👀 Re-review progress:
|
c290f64 to
3360279
Compare
|
🦞👀 Re-review progress:
|
3360279 to
88211c9
Compare
|
🦞👀 Re-review progress:
|
Keep deadline creation and consumption on the same monotonic clock. Replace clock-call instrumentation with a single disposal outcome regression. Co-authored-by: SunnyShu <0668000539@local>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…ock (openclaw#181675) Measure plugin cleanup observation with a monotonic clock. A wall-clock jump during an ordinary cleanup callback no longer creates a false cleanup timeout. Focused regression tests and a real-timer PluginInstance probe pass. Cleanup ownership and callback behavior are preserved. Co-authored-by: SunnyShu <[email protected]>
…ock (#181675) Measure plugin cleanup observation with a monotonic clock. A wall-clock jump during an ordinary cleanup callback no longer creates a false cleanup timeout. Focused regression tests and a real-timer PluginInstance probe pass. Cleanup ownership and callback behavior are preserved. Co-authored-by: SunnyShu <[email protected]> (cherry picked from commit 096041e) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 0073aad4972dbf1c4494293d76d5072cbecef182)
…nd realign npm override fixture (#187562) * fix(plugins): restore non-blocking setup artifact retirement on release Revert the stray plugin-instance.ts hunk carried into the release backport of #183606 (an auto-reply-only change on main), which tracked module release in the caller's work scope and made setup cache retirement wait on artifact removal. Realign the matching release-only owner-drain assertion added with #181675 to the main test. * test(plugins): expect nested npm form for exact-parent overrides #187293 intentionally maps pnpm exact-parent selectors ([email protected]>child) to npm's nested override form on this train. Realign the npm-spec selector fixture to that behavior; the npm-alias retry still drops it.
What Problem This Solves
Fixes: plugin disposal can report a false cleanup timeout, or extend its cleanup wait, when the host wall clock changes during shutdown.
User Impact
A healthy plugin receives the existing five-second elapsed-time cleanup budget even when the system clock jumps. Physical cleanup and ownership remain unchanged.
Why This Change Was Made
The instance cleanup owner creates and consumes its deadline with
performance.now(). The regression steps the wall clock inside an ordinary cleanup callback and checks the disposal result. It replaces clock-call instrumentation and nested fake-timer advancement with one outcome test.Production: +8/-4 (net +4), consisting of two clock substitutions and the formatter's expanded call layout; no meaningful nearby deletion was justified. Tests: +15. Thanks to @SunnyShu0925 for the fix and original regression.
Evidence
At main
397807c7374c41ffe434215e1e091edba2997474, both the fake-time regression and temporary real-timer probe failed: healthy cleanup was reported as unsettled. The real callback completed in 1502 ms with one error.Fixed full file: 36/36 passed, including the temporary probe (removed afterward). The same real callback completed in 1502 ms with zero errors. The retained regression took 5 ms and adds no real wait.
Command:
TMPDIR=/private/tmp/oc-ct-monoA pnpm test src/plugins/plugin-instance.test.ts --maxWorkers=1; red selected-t 'wall clock jumps forward'. Red wrapper 167.35 s, green wrapper 220.21 s, dominated by cold worker preparation; green Vitest duration 166.84 s.Independent diff review found no actionable P0–P2 findings. A later lint-only Promise-executor brace correction preserves the reviewed behavior. Targeted type-aware oxlint, oxfmt, and
git diff --checkpassed. Full Gateway shutdown was not independently live-tested in this revision; the local real-timer proof reachesPluginInstance.dispose, while the contributor's Gateway trace is retained below.Exact-head CI run 40143661603 failed only
checks-node-changed-compact-large-11and its aggregate gate. This is inherited: scheduled-main run 40142877272, job checks-node-compact-large-27 has the same 15 failedsession-catalog-progress.test.tscases andclient?.connect.scopesTypeError. The relevant visibility owner and test fixtures are byte-identical between both heads. No unrelated repair or CI rerun was performed.Contributor-supplied Gateway proof
The original contributor supplied this shutdown comparison at
88211c9b2402c695f32dfbac6dc76dce63e29791. The traces were inspected, not independently rerun during this revision. The production fix is unchanged.Real shipped-entry Gateway run (
startGatewayServer) plus a realPluginInstancewhoseonDisposeregisters a cleanup that consumes 3.5s of real time then settles (physical settlement). The plugin is loaded into the Gateway's own active plugin registry (theregistryOwnersingletonserver.close()retires), and retirement is driven by the shipped shutdown path:server.close()→closePluginRegistry→pluginRegistryOwner.close()→clearActivePluginRegistry()→disposePluginRegistryInstances()→createPluginHostRegistryRetirement→instance.dispose()→runDisposalCleanup→raceWithTimeout. A wall-clock step is injected intoDate.nowbetween the deadline seed and the remaining-budget read (pre-fix only — fixed code readsperformance.now()and never arms the injection). Observed outcome: the raceWithTimeout budget and the shutdown log's "did not settle" failures (the failures the shipped shutdown path reports).Post-fix — all clock states keep a stable monotonic budget, 0 shutdown failures:
Pre-fix (source reverted to
Date.now()) — a forward jump collapses the budget and the shipped shutdown path reports mis-kill failures:settled ✓in every run — physical settlement is always preserved. The bug: a forward wall-clock jump shrinks the pre-fix budget to ~1999ms, so the healthy 3.5s cleanup is reported by the shipped shutdown path as a "did not settle" failure (2 failures in the shutdown log) even though it settles; post-fix the budget stays on the monotonic clock (~5000ms) and the same cleanup settles with 0 shutdown failures in every clock state.Before / After
Date.now())performance.now())