Refresh hook runtimes after plugin changes (#38703)

## What changed

- Rebuild hook runtimes for loaded sessions when effective plugins change or a marketplace upgrade installs new plugin content.
- Refresh plugin-related caches and MCP runtimes alongside hooks after plugin mutations.
- Preserve each loaded session's current configuration while rebuilding its hooks.

## Testing

- Cover direct plugin upgrades, including subsequent turn and session-end hooks.
- Cover automatic marketplace upgrades for an already loaded session.

GitOrigin-RevId: fef64c68d652f300c7f3d88e81c5017459aa9a18
This commit is contained in:
Abhinav authored and copyberry committed 2026-08-15 05:28:53 +00:00
1 parent 53f3fa7496
commit e5470f1bce
7 files changed
+490 -6

No files matched your search

+12
View File
@@ -2141,6 +2141,8 @@ impl PluginsManager {
if should_spawn_marketplace_auto_upgrade {
let manager = Arc::clone(self);
let config = config.clone();
let on_effective_plugins_changed = on_effective_plugins_changed.clone();
let runtime = tokio::runtime::Handle::current();
if let Err(err) = std::thread::Builder::new()
.name("plugins-marketplace-auto-upgrade".to_string())
.spawn(move || {
@@ -2149,6 +2151,16 @@ impl PluginsManager {
);
match outcome {
Ok(outcome) => {
if !outcome.upgraded_roots.is_empty()
&& let Some(on_effective_plugins_changed) =
on_effective_plugins_changed
{
runtime.spawn(async move {
on_effective_plugins_changed(
EffectivePluginsChange::default(),
);
});
}
for error in outcome.errors {
warn!(
marketplace = error.marketplace_name,