Skip to content

Promote dev to stable: PM2 Genie install recovery - #2476

Merged
namastex888 merged 2 commits into
mainfrom
dev
May 22, 2026
Merged

namastex888 merged 2 commits into
mainfrom
dev

Conversation

@namastex888

@namastex888 namastex888 commented May 22, 2026 •

Copy link
Copy Markdown
Contributor

Promotes dev to stable for the PM2 Genie install recovery fix.\n\nIncluded fix:\n- Recreate unhealthy PM2 Genie entries during genie install instead of treating waiting restart / non-online entries as already installed.\n- Improve update diagnostic remediation for recurring Genie server unreachable after update.\n\nEvidence:\n- Commit: 776ea68 fix: recreate unhealthy pm2 genie install\n- Dev release: v4.260522.9\n- Dev CI: success\n- Commitlint: success\n- Release v4.260522.9: success\n\nLocal runtime verification on genie-khal-hermes:\n- genie --version = 4.260522.8\n- PM2 Genie recreated and online\n- ~/.genie/serve.pid present\n- genie serve status reports running, pgserve healthy, hook UDS listening, scheduler integrated\n

Summary by CodeRabbit

Release Notes

  • Chores

    • Version bumped to 4.260522.9
  • Bug Fixes

    • Improved detection of existing Genie installations to prevent reinstallation attempts
    • Enhanced troubleshooting guidance for offline service conditions, including specific remediation steps
    • Refined PM2 process health validation logic for better installation stability

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 22, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Patch version 4.260522.9 strengthens PM2 process health validation during install and improves health-unreachable error messages. The install command now conditionally early-returns only for "reusable" processes (online with valid PID), otherwise deletes and reinstalls. Health-unreachable messages now guide users through PM2 restart with environment fallback to full reinstall.

Changes

PM2 Process Health Checking and Install Remediation

Layer / File(s) Summary
PM2 process reusability predicate
src/genie-commands/install.ts
New isReusableCanonicalPm2Process predicate returns true only for processes with nonzero PID and online status; exported in _internals for testing.
PM2 deletion helper and install refactoring
src/genie-commands/install.ts
New deletePm2Process helper centralizes pm2 delete operations. installCommand now conditionally early-returns only for reusable processes; non-reusable ones trigger deletion and reinstall. Legacy cleanup also uses the helper.
Test coverage for PM2 process predicates
src/genie-commands/__tests__/install.test.ts
Imports isReusableCanonicalPm2Process and adds test cases covering valid online processes with nonzero PID, zero PID rejection, non-online status rejection, and null input handling.
Health-unreachable error remediation guidance
src/genie-commands/update.ts, src/genie-commands/__tests__/update.test.ts
formatVerifyBanner health-unreachable message now includes explicit PM2 restart command with fallback to delete-and-reinstall. Test expectations updated to verify both guidance strings appear.

Version Bump to 4.260522.9

Layer / File(s) Summary
Manifest and package version updates
.claude-plugin/marketplace.json, package.json, plugins/genie/.claude-plugin/plugin.json, plugins/genie/package.json
Version field incremented from 4.260522.8 to 4.260522.9 across all manifests and packages.

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 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 PR title directly and specifically describes the main change: promoting a PM2 Genie install recovery fix from dev to stable, which aligns perfectly with the changeset's version bump and install.ts improvements.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 dev

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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 and usage tips.

@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 `@package.json`:
- Line 3: The version bump in package.json ("version": "4.260522.9") must be
blocked until Binary SHA Drift is resolved; revert or hold this version change
and update the pinned binarySha256 entries in the manifest to match the actual
build artifacts, and fix the unknown asset-prefix handling code that generates
incorrect asset names so the computed SHAs match expectations; locate references
to "version" in package.json, the manifest field binarySha256, and the
asset-prefix normalization logic (search for functions/variables handling
asset-prefix or asset name generation) and correct the prefix handling, re-run
the SHA computation, and only then promote the version bump.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 569f4181-bd24-4749-8b26-47a3ef96dceb

📥 Commits

Reviewing files that changed from the base of the PR and between b6a1661 and 09e8deb.

📒 Files selected for processing (8)
  • .claude-plugin/marketplace.json
  • package.json
  • plugins/genie/.claude-plugin/plugin.json
  • plugins/genie/package.json
  • src/genie-commands/__tests__/install.test.ts
  • src/genie-commands/__tests__/update.test.ts
  • src/genie-commands/install.ts
  • src/genie-commands/update.ts

Comment thread package.json
{
"name": "@automagik/genie",
"version": "4.260522.8",
"version": "4.260522.9",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Block release bump until SHA drift is resolved.

4.260522.9 should not be promoted while Binary SHA Drift is failing; this breaks release integrity checks tied to binarySha256 in this manifest. Update pinned SHA(s) and fix the unknown asset-prefix handling before merging this version bump.

🧰 Tools
🪛 GitHub Actions: Binary SHA Drift / drift-check

[error] SHA drift detected for pinned binarySha256 asset (message: "SHA drift for $asset"). Upstream binary SHA256 does not match the pinned value in package.json.


[warning] Unknown asset prefix '$asset' — skipping drift check for this asset (extend drift check to support it).

🤖 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 `@package.json` at line 3, The version bump in package.json ("version":
"4.260522.9") must be blocked until Binary SHA Drift is resolved; revert or hold
this version change and update the pinned binarySha256 entries in the manifest
to match the actual build artifacts, and fix the unknown asset-prefix handling
code that generates incorrect asset names so the computed SHAs match
expectations; locate references to "version" in package.json, the manifest field
binarySha256, and the asset-prefix normalization logic (search for
functions/variables handling asset-prefix or asset name generation) and correct
the prefix handling, re-run the SHA computation, and only then promote the
version bump.

@namastex888
namastex888 merged commit 11b7278 into main May 22, 2026
29 of 31 checks passed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the project version to 4.260522.9 and introduces logic to identify and automatically recreate non-reusable PM2 processes during the installation phase. It also refactors PM2 process deletion into a dedicated helper function and enhances the remediation instructions displayed when a health check fails. A review comment suggests renaming a function parameter to avoid shadowing the global Node.js process object, which would improve code clarity and maintainability.

pm2_env?: { status?: string };
}

function isReusableCanonicalPm2Process(process: Pm2Process | null): boolean {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The parameter name process shadows the global process object in Node.js. While TypeScript allows this, it is a common source of confusion and potential bugs if someone later tries to access global properties like process.env or process.exit() within this function. Consider renaming it to pm2Process or proc to improve maintainability and clarity.

Suggested change
function isReusableCanonicalPm2Process(process: Pm2Process | null): boolean {
function isReusableCanonicalPm2Process(pm2Process: Pm2Process | null): boolean {
if (!pm2Process) return false;
if (pm2Process.pm2_env?.status !== 'online') return false;
return typeof pm2Process.pid === 'number' && pm2Process.pid > 0;
}

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