Skip to content

fix: Windows plugin system — hook execution, stale state, binary resolution#373

Merged
0xLeif merged 3 commits intomainfrom
fix/windows-plugin-system-372
May 7, 2026
Merged

fix: Windows plugin system — hook execution, stale state, binary resolution#373
0xLeif merged 3 commits intomainfrom
fix/windows-plugin-system-372

Conversation

@corvid-agent
Copy link
Copy Markdown
Collaborator

Summary

Fixes three compounding bugs that made plugins completely unusable on Windows (#372):

  • Hook execution: Shell script hooks (.sh/extensionless) now try sh, bash, and git-bash on Windows instead of failing with OS error 193. .bat/.cmd hooks execute via cmd /c, .exe hooks run directly.
  • Stale install state: post_install hook now runs before persisting to the plugin registry. On hook/build failure, symlinks and the plugin directory are cleaned up so reinstall isn't blocked by "already installed".
  • Binary resolution: resolve_plugin_command() and which_fledge_plugin() now check .exe, .bat, .cmd extensions on Windows when resolving plugin binaries.

Files Changed

  • src/plugin/run_plugin.rs — New run_hook_file() helper for platform-aware hook execution; Windows extension search in which_fledge_plugin()
  • src/plugin/mod.rs — Windows extension search in resolve_plugin_command()
  • src/plugin/install.rs — Moved post_install before save_registry() with rollback; added rollback for run_build() failures

Test Plan

  • cargo check passes
  • All 151 plugin unit tests pass (1 pre-existing integration test failure on main, unrelated)
  • Manual test on Windows 11 with fledge-plugin-bridge (needs Windows CI or @Kyntrin to verify)

Fixes #372

🤖 Generated with Claude Code

…lution

Fix three compounding bugs that made plugins completely unusable on Windows:

1. **Hook execution (OS error 193)**: Shell script hooks now try sh/bash/git-bash
   on Windows instead of failing with "not a valid Win32 application". Bat/cmd
   hooks are executed via `cmd /c`, and .exe hooks run directly.

2. **Stale install state**: post_install hook now runs BEFORE persisting to
   the registry. On hook failure, symlinks and plugin directory are cleaned up
   so reinstall isn't blocked by "already installed". Build failures also
   roll back the plugin directory.

3. **Binary resolution**: resolve_plugin_command() and which_fledge_plugin()
   now check .exe/.bat/.cmd extensions on Windows when looking up plugin
   binaries in the bin directory and PATH.

Fixes #372

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

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

❌ Corvin says...

      _
    <(;\  .oO(oh no...)
     |/(\
      \(\\
      " "\\

"Caw... validation failed..."

CI Summary

Check Status
Dependency Audit ✅ Passed
Lint (fmt + clippy) ❌ failure
Spec Validation ✅ Passed
Tests (3 OS) ✅ Passed

Powered by corvid-pet

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

👋 CorvidAgent is looking into this.

`hook_path` is already `&Path`, so `&hook_path` creates a double
reference. Clippy correctly flags this as `clippy::needless_borrow`.

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

Fixed in 6bc1386. The previous commit addressed cargo fmt issues but missed two clippy::needless_borrow warnings — &hook_path where hook_path is already &Path, so the extra borrow was redundant. Removed both instances in run_hook_file().

Waiting on CI to confirm green.

@github-actions github-actions Bot dismissed their stale review May 7, 2026 16:28

Superseded by updated review.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

❌ Corvin says...

      _
    <(;\  .oO(oh no...)
     |/(\
      \(\\
      " "\\

"I'm pecking through the errors..."

CI Summary

Check Status
Dependency Audit ✅ Passed
Lint (fmt + clippy) ❌ failure
Spec Validation ✅ Passed
Tests (3 OS) ✅ Passed

Powered by corvid-pet

@corvid-agent
Copy link
Copy Markdown
Collaborator Author

👋 CorvidAgent is looking into this.

@github-actions github-actions Bot dismissed their stale review May 7, 2026 16:31

Superseded by updated review.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

✅ Corvin says...

      _
    <(^\  .oO(Caw! ^v^)
     |/(\
      \(\\
      " "\\

"Looking sharp! Like a beak should be."

CI Summary

Check Status
Dependency Audit ✅ Passed
Lint (fmt + clippy) ✅ Passed
Spec Validation ✅ Passed
Tests (3 OS) ✅ Passed

Powered by corvid-pet

@corvid-agent
Copy link
Copy Markdown
Collaborator Author

CI is all green now — lint, tests (all 3 OS), audit, and spec-check all passing. The two fix commits (82ac543 for cargo fmt and 6bc1386 for clippy::needless_borrow) resolved both rounds of lint failures. Ready for merge.

@corvid-agent
Copy link
Copy Markdown
Collaborator Author

👋 CorvidAgent is looking into this.

2 similar comments
@corvid-agent
Copy link
Copy Markdown
Collaborator Author

👋 CorvidAgent is looking into this.

@corvid-agent
Copy link
Copy Markdown
Collaborator Author

👋 CorvidAgent is looking into this.

@0xLeif 0xLeif merged commit 1c84642 into main May 7, 2026
9 checks passed
@0xLeif 0xLeif deleted the fix/windows-plugin-system-372 branch May 7, 2026 22:22
0xLeif added a commit that referenced this pull request May 7, 2026
Hook execution now uses run_hook_file (introduced in #373), which
handles .bat/.cmd via cmd /c, .exe directly, and shell scripts via
sh/bash on Windows. Plugin binary lookup uses the cfg!(windows)
runtime check from main with .exe/.bat/.cmd extensions.

Co-Authored-By: Claude Opus 4.7 (1M context) <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.

Plugin system has no Windows support

2 participants