Skip to content

Gracefully handle plugin init failures#424

Merged
gschier merged 1 commit into
mainfrom
fix/plugin-init-no-crash
Mar 11, 2026
Merged

Gracefully handle plugin init failures#424
gschier merged 1 commit into
mainfrom
fix/plugin-init-no-crash

Conversation

@gschier
Copy link
Copy Markdown
Member

@gschier gschier commented Mar 11, 2026

Summary

  • Store individual plugin init errors on PluginManager instead of crashing the app when a plugin fails to load (e.g. missing directory)
  • Add cmd_plugin_init_errors command so the frontend can query errors once the window is ready
  • Show persistent warning toasts for each failed plugin with a "View Plugins" button
  • cmd_reload_plugins now returns errors instead of silently discarding them

Test plan

  • Install a plugin from a filesystem directory, then delete that directory and restart the app — should show a warning toast instead of crashing
  • Verify bundled plugins still load normally
  • Click "View Plugins" on the toast and confirm it opens plugin settings

🤖 Generated with Claude Code

Previously, if any plugin failed to initialize (e.g. missing directory),
the entire app would crash via .expect(). Now individual plugin failures
are stored on the PluginManager and surfaced to the user as warning
toasts once the window is ready.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 99ebd04eb3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// Check for plugin initialization errors
invokeCmd<[string, string][]>('cmd_plugin_init_errors').then((errors) => {
for (const [dir, message] of errors) {
const dirBasename = dir.split('/').pop() ?? dir;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle Windows path separators for plugin error toasts

dirBasename is derived with dir.split('/'), which only works for POSIX paths. When a plugin directory is reported with Windows separators (e.g. C:\...\plugin), this expression returns the full absolute path instead of the basename, so the warning toast shows noisy paths and generates unstable IDs from full paths rather than plugin names. This is a cross-platform regression in the new startup-error toast flow; parse both \ and / separators before building the toast content/ID.

Useful? React with 👍 / 👎.

@gschier gschier merged commit c8ba35e into main Mar 11, 2026
6 checks passed
@gschier gschier deleted the fix/plugin-init-no-crash branch March 11, 2026 23:55
hezhizhen pushed a commit to hezhizhen/yaak that referenced this pull request May 15, 2026
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant