Skip to content

fix(plugins): continue batch operations after failures - #11490

Merged
jdx merged 1 commit into
jdx:mainfrom
Marukome0743:pr11490
Jul 30, 2026
Merged

jdx merged 1 commit into
jdx:mainfrom
Marukome0743:pr11490

Conversation

@Marukome0743

@Marukome0743 Marukome0743 commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • let every plugin in a batch install or update attempt finish even when a sibling fails
  • preserve successful plugin changes while returning a failing exit status when any operation fails
  • report one failure with its original error chain and aggregate multiple failures in deterministic plugin-name order
  • apply the same behavior to plugins update, multi-plugin plugins install, and plugins install --all

Root cause

Both plugin batch paths returned from their JoinSet loop as soon as the first error was observed. Dropping the set could cancel tasks that were still queued or running, so one broken plugin prevented unrelated plugins from completing.

Behavior

All plugin tasks are now queued before execution and acquire the existing --jobs semaphore inside each task. The shared completion helper drains the full task set, retains successful installs or updates, and reports failures only after every plugin has finished. Panicked tasks are also recorded without cancelling their siblings.

Single-plugin URL installs remain on their existing direct path, and no CLI options or configuration formats change.

Validation

  • mise exec -- cargo test --all-features cli::plugins::tests --no-fail-fast
  • mise run test:e2e e2e/plugins/test_plugin_batch_failures
  • mise run test:e2e e2e/plugins/test_plugin_update e2e/plugins/test_plugin_install
  • mise exec -- cargo check --all-features
  • mise exec -- cargo fmt --all -- --check
  • mise exec -- shellcheck -x e2e/plugins/test_plugin_batch_failures
  • mise exec -- shfmt -d -s e2e/plugins/test_plugin_batch_failures

mise run format and mise run lint stop in the hk wrapper because this Sapling working copy is not detected as a Git repository; the applicable format and lint commands were run individually as listed above.

Addresses #4803

AI-assisted — Tool: Codex; model: OpenAI/GPT-5; version: unavailable.

Summary by CodeRabbit

  • Bug Fixes

    • Improved batch plugin installation and update behavior when one or more plugin sources are unavailable.
    • Plugin operations now report all failed plugins together with clearer, plugin-specific error details.
    • Batch operations continue processing other plugins even if one plugin fails, preventing misleading or incomplete results.
    • Prevents partial updates for remaining plugins when one update target fails, including resilience to unexpected task failures.
  • Tests

    • Added an end-to-end test covering Git-backed rewrite scenarios for failing batch plugin installs and updates.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 380973e9-0542-401d-a5be-d7e76edb850e

📥 Commits

Reviewing files that changed from the base of the PR and between 705b651 and 6e6f5ae.

📒 Files selected for processing (4)
  • e2e/plugins/test_plugin_batch_failures
  • src/cli/plugins/install.rs
  • src/cli/plugins/mod.rs
  • src/cli/plugins/update.rs

📝 Walkthrough

Walkthrough

Plugin install and update now share asynchronous task joining and aggregated failure reporting. Batch operations continue collecting task results, sort multiple failures, preserve single-error chains, and include end-to-end coverage for failed and partially successful plugin batches.

Changes

Plugin batch failure handling

Layer / File(s) Summary
Shared task joining and error aggregation
src/cli/plugins/mod.rs
Adds shared plugin task result aggregation with deterministic multi-failure formatting, preserved error chains, completion after failures, and panic handling tests.
Install and update task orchestration
src/cli/plugins/install.rs, src/cli/plugins/update.rs
Moves semaphore acquisition into spawned tasks and routes install and update results through the shared joining helper.
End-to-end batch validation
e2e/plugins/test_plugin_batch_failures
Tests batch install and update failures, unrelated plugin installation, and preservation of the previously installed update commit.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant PluginCommand
  participant PluginTask
  participant join_plugin_tasks
  User->>PluginCommand: run batch install or update
  PluginCommand->>PluginTask: spawn bounded operation
  PluginTask-->>join_plugin_tasks: return plugin name and result
  join_plugin_tasks->>PluginTask: join remaining tasks
  join_plugin_tasks-->>PluginCommand: return aggregated result
  PluginCommand-->>User: report success or failed plugin names
Loading

Suggested reviewers: jdx

Poem

A rabbit watched the plugins hop,
While failed tasks gathered in a crop.
Good ones stayed, bad ones spoke,
Git held fast through every stroke.
“Batch errors bloom!” the bunny cried.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: batch plugin operations continue after individual failures.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Marukome0743
Marukome0743 marked this pull request as ready for review July 30, 2026 15:34
Comment thread src/cli/plugins/mod.rs Outdated
@greptile-apps

greptile-apps Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes batch plugin operations drain all spawned tasks before reporting failures.

  • Queues plugin installs and updates behind the existing jobs semaphore so sibling operations continue after a failure.
  • Associates each spawned task with its plugin name, including panicked tasks, and reports failures deterministically.
  • Adds unit and end-to-end coverage for successful sibling completion, ordered aggregation, error-chain preservation, and panic handling.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; the task-ID mapping now preserves plugin identity for panicked tasks, and all batch tasks are drained before failures are returned.

Important Files Changed

Filename Overview
src/cli/plugins/mod.rs Adds shared task spawning, plugin-identity tracking, full JoinSet draining, deterministic failure aggregation, and focused unit tests; the prior panic-identity issue is fixed.
src/cli/plugins/install.rs Migrates multi-plugin and install-all execution to the shared completion helper while preserving job limits.
src/cli/plugins/update.rs Migrates batch updates to the shared completion helper so all plugin updates finish before errors are returned.
e2e/plugins/test_plugin_batch_failures Adds end-to-end coverage demonstrating that successful installs and updates complete despite sibling failures.

Reviews (2): Last reviewed commit: "fix(plugins): continue batch operations ..." | Re-trigger Greptile

@jdx
jdx enabled auto-merge (squash) July 30, 2026 16:50
@jdx
jdx merged commit 1f095a7 into jdx:main Jul 30, 2026
35 checks passed
@Marukome0743
Marukome0743 deleted the pr11490 branch July 30, 2026 17:21
This was referenced Jul 30, 2026
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.

2 participants