fix(plugin): keep active plugin on reload failure#680
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors ExternalPluginManager.ReloadPlugin so the replacement plugin subprocess is started and validated before the previously active client is killed. On candidate failure the old plugin remains registered, addressing the try-activate/rollback requirement from issue #667. Documentation and a comment are updated to reflect the new local-activation semantics.
Changes:
- Extract subprocess startup into
startPluginLockedreturning apluginLaunch, injectable via astartPlugintest seam. - Rewrite
ReloadPluginto load+validate the candidate first, only killing the old client on success, and to load directly when no plugin is currently active. - Update
handleReloadcomment anddocs/PLUGIN_DEVELOPMENT_GUIDE.mdto document try-activate semantics and clarify that artifact trust is out of scope.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| plugin/external/manager.go | Splits start logic out of LoadPlugin and reimplements ReloadPlugin to swap clients only after successful candidate launch. |
| plugin/external/manager_test.go | Adds tests covering reload failure preserving the active client and reload success swapping clients only after candidate start. |
| plugin/external/handler.go | Updates the handleReload doc comment to reflect new behavior. |
| docs/PLUGIN_DEVELOPMENT_GUIDE.md | Documents try-activate reload semantics and explicit non-goals (trust/fleet rollout). |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
⏱ Benchmark Results✅ No significant performance regressions detected. benchstat comparison (baseline → PR)
|
Reject nil reload adapters and expand manager reload/load tests for PR #680 patch coverage.
Summary
Verification
Regression Proof
With adapter validation absent:
failed because nil-adapter launches were accepted and registered.
With the validation restored:
passes.
Addresses the external plugin process handoff slice of #667. The broader config-engine probe/rollback contract remains tracked by #667.