Skip to content

Add plugin watchdog to auto-disable failing plugins #79

@tadelv

Description

@tadelv

Problem

plugin_loader_service.dart:160 has a FIXME noting that there's no watchdog for unloadable plugins. Currently there's a 1-second Future.any() timeout, but:

  • If a plugin throws during load, it can still crash the caller
  • There's no mechanism to auto-disable plugins that repeatedly fail to load
  • A broken plugin can cause issues on every app restart

Current code

// FIXME: add watchdog so we don't break the app with unloadable plugins
await Future.any([
  pluginManager.loadPlugin(...),
  Future.delayed(Duration(seconds: 1), () {
    throw Exception("load timeout occured");
  }),
]);

Suggested improvement

  • Wrap the load in a try-catch that records failures per plugin
  • After N consecutive failures (e.g., 3), auto-disable the plugin and log a warning
  • Provide a way to re-enable disabled plugins from the settings UI
  • Consider adding a health check after load (e.g., verify plugin responded to onLoad)

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions