fix(plugins): a plugin that can't start live says why and offers a restart (#6087)
CI / lint (push) Successful in 2s
CI / unit (push) Successful in 1m28s
CI / integration (push) Successful in 1m33s
CI / publish (push) Successful in 1m29s

Saving an enabled plugin threw away hot_reload_plugin's (ok, message), so a
plugin that failed to load live read "Enabled, not loaded" with nothing
more. Now:
- a live-load failure is recorded with its reason, as a boot failure is, and
  logged; a later success clears it;
- any save of an enabled plugin that isn't running tries to start it, not
  only the off-to-on toggle;
- enabling one already running is a success, not a failure;
- the plugin's page offers "Restart to load" while it is enabled and not
  running.

Quart never marks the app as having served its first request, so
register_blueprint after startup is allowed: hot-loading is not refused
wholesale, as #6087 suspected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-18 22:56:54 -04:00
co-authored by Claude Opus 5.5
parent f7616b71c3
commit a59d1a7709
4 changed files with 102 additions and 8 deletions
@@ -37,6 +37,20 @@
</div>
{% endif %}
{% if plugin._enabled and not is_loaded and not plugin._always_on %}
<div id="restart-banner" style="display:flex;align-items:center;gap:0.75rem;flex-wrap:wrap;
margin-bottom:1rem;max-width:720px;font-size:0.84rem;color:var(--text-muted);">
<span>It's enabled but not running{% if fail_reason %}: it couldn't be started while Steward runs{% endif %}.
A restart loads it.</span>
<form method="post" action="/settings/plugins/restart/"
hx-post="/settings/plugins/restart/" hx-target="#restart-banner" hx-swap="outerHTML"
data-confirm="Restart the app now? This will briefly interrupt all monitoring."
style="margin:0;">{{ csrf_field() }}
<button type="submit" class="btn btn-sm">Restart to load</button>
</form>
</div>
{% endif %}
{% if plugin.get('description') %}
<p style="color:var(--text-muted);font-size:0.88rem;margin-bottom:1.25rem;max-width:620px;">{{ plugin.description }}</p>
{% endif %}