Skip to content

fix: retry plugin install/build on transient npm failures - #16

Merged
Faustze merged 1 commit into
mainfrom
fix/quartz-plugin-install-flake
Jul 23, 2026
Merged

fix: retry plugin install/build on transient npm failures#16
Faustze merged 1 commit into
mainfrom
fix/quartz-plugin-install-flake

Conversation

@Faustze

@Faustze Faustze commented Jul 23, 2026

Copy link
Copy Markdown
Owner

A scheduled deploy run failed because npm silently resolved only the production dependency subtree for two plugins (missing tsup), while 14 prior runs of the same workflow succeeded — a one-off npm registry flake, not a code bug. Wipe node_modules and retry install+build up to 3 times so a transient hiccup no longer fails the whole deploy.

Summary by CodeRabbit

  • Bug Fixes
    • Plugin installation and builds now automatically retry up to three times when failures occur.
    • Failed partial installations are cleaned up before retrying, improving recovery from interrupted or incomplete builds.
    • Persistent build failures now provide clearer error information, including the number of attempts made.

A scheduled deploy run failed because npm silently resolved only the
production dependency subtree for two plugins (missing tsup), while
14 prior runs of the same workflow succeeded — a one-off npm registry
flake, not a code bug. Wipe node_modules and retry install+build up
to 3 times so a transient hiccup no longer fails the whole deploy.
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Plugin builds now use up to three installation/build attempts, remove partial node_modules on retries, and report the attempt count when all attempts fail. Prebuilt dist/ handling remains unchanged.

Changes

Plugin build retry handling

Layer / File(s) Summary
Retry installation and build attempts
quartz/plugins/loader/gitLoader.ts
Adds a three-attempt limit and retries dependency installation and required builds, clearing partial node_modules before retries and throwing after persistent failure.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: saberzero1

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely matches the main change: retrying plugin install/build on transient npm failures.
Description check ✅ Passed The description explains the failure, the retry-with-clean-install fix, and the 3-attempt behavior, which fits the template.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/quartz-plugin-install-flake

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@quartz/plugins/loader/gitLoader.ts`:
- Around line 422-427: Update the failure reporting in the catch block around
the plugin installation workflow to use phase-neutral wording instead of
identifying every error as a post-install build failure. Adjust both the
console.error message and the thrown Error in the relevant loader flow, while
preserving the attempt count, plugin name, and original error message.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b2920229-7e23-41e5-8b1f-ff869b146b78

📥 Commits

Reviewing files that changed from the base of the PR and between ecf32ea and 3ad13eb.

📒 Files selected for processing (1)
  • quartz/plugins/loader/gitLoader.ts

Comment on lines +422 to +427
const message = lastError instanceof Error ? lastError.message : String(lastError)
console.error(
styleText("red", `✗`),
`${name}: post-install build failed after ${INSTALL_BUILD_ATTEMPTS} attempts: ${message}`,
)
throw new Error(`Failed to build plugin ${name}: ${message}`)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use a phase-neutral failure message.

This catch also handles install, prune, and peer-link failures, so reporting every failure as a build failure misdirects troubleshooting.

Proposed fix
-    `${name}: post-install build failed after ${INSTALL_BUILD_ATTEMPTS} attempts: ${message}`,
+    `${name}: plugin setup failed after ${INSTALL_BUILD_ATTEMPTS} attempts: ${message}`,
...
-  throw new Error(`Failed to build plugin ${name}: ${message}`)
+  throw new Error(`Failed to set up plugin ${name}: ${message}`)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const message = lastError instanceof Error ? lastError.message : String(lastError)
console.error(
styleText("red", `✗`),
`${name}: post-install build failed after ${INSTALL_BUILD_ATTEMPTS} attempts: ${message}`,
)
throw new Error(`Failed to build plugin ${name}: ${message}`)
const message = lastError instanceof Error ? lastError.message : String(lastError)
console.error(
styleText("red", `✗`),
`${name}: plugin setup failed after ${INSTALL_BUILD_ATTEMPTS} attempts: ${message}`,
)
throw new Error(`Failed to set up plugin ${name}: ${message}`)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@quartz/plugins/loader/gitLoader.ts` around lines 422 - 427, Update the
failure reporting in the catch block around the plugin installation workflow to
use phase-neutral wording instead of identifying every error as a post-install
build failure. Adjust both the console.error message and the thrown Error in the
relevant loader flow, while preserving the attempt count, plugin name, and
original error message.

@Faustze
Faustze merged commit 562c718 into main Jul 23, 2026
7 checks passed
@Faustze
Faustze deleted the fix/quartz-plugin-install-flake branch July 23, 2026 13:04
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