Skip to content

fix(install): clean up legacy bundle agents + migrate .env on DMG upgrade#332

Merged
Akarsh-Hegde merged 1 commit into
pre-mainfrom
fix/dmg-upgrade-legacy-cleanup
Jun 24, 2026
Merged

fix(install): clean up legacy bundle agents + migrate .env on DMG upgrade#332
Akarsh-Hegde merged 1 commit into
pre-mainfrom
fix/dmg-upgrade-legacy-cleanup

Conversation

@Akarsh-Hegde

Copy link
Copy Markdown
Member

Summary

  • Adds cleanup_legacy_mlx_server() — stops the old bundle's com.meridiona.mlx-server launchd agent before the tray's in-process MlxManager starts, preventing EADDRINUSE port-contention on :7823.
  • Adds cleanup_legacy_ui() — removes the retired com.meridiona.ui Node-server agent (zombie process burning ~150 MB).
  • Adds migrate_legacy_bundle_env() — copies ~/.meridian/app/.env~/.meridian/.env when the canonical file is absent, so Jira/GitHub/Linear tokens survive the DMG upgrade without forcing wizard re-entry.

All three follow the existing cleanup_legacy_screenpipe idiom. Covered by a new unit test exercising all three branches of the env-migration logic.

Why now

Targets users migrating from the old npm/curl bundle to the self-contained DMG (v1.64.0). Without this fix they hit silent port contention + lost credentials on first launch after the upgrade. Needs to land in pre-main so it's included in the #330 fold.

Test plan

  • cargo test -p meridian-tray — unit test backend_install::tests::migrate_legacy_bundle_env_* passes
  • Manual: install old bundle, then install new DMG — verify no EADDRINUSE in logs, ~/.meridian/.env has the migrated creds, and neither com.meridiona.mlx-server nor com.meridiona.ui are registered post-install

🤖 Generated with Claude Code

https://claude.ai/code/session_01SKdh3tKWLZhtQ9FCfA5RYH

…rade

A user migrating from the old npm/curl bundle to the self-contained DMG
carries launchd agents and a credential file the new topology no longer
matches. The DMG install path only cleaned up the legacy screenpipe agent;
three gaps remained:

- com.meridiona.mlx-server (bundle launchd MLX on :7823) was left running,
  contending with the tray's in-process MlxManager on the same port →
  EADDRINUSE spawn-retry churn + log spam.
- com.meridiona.ui (retired standalone dashboard server) lingered as a
  zombie Node process burning ~150 MB.
- Bundle creds at ~/.meridian/app/.env were not copied to the canonical
  ~/.meridian/.env the DMG daemon reads → Jira/GitHub/Linear tokens silently
  lost, forcing a wizard re-entry.

Add cleanup_legacy_mlx_server() + cleanup_legacy_ui() (mirroring the existing
cleanup_legacy_screenpipe idiom) and migrate_legacy_bundle_env(), which copies
the bundle .env across only when the canonical one is absent — never clobbering
creds the tray already wrote. Covered by a unit test over all three branches.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SKdh3tKWLZhtQ9FCfA5RYH
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: cca2bca6-a952-4b27-b840-fb4426371b29

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/dmg-upgrade-legacy-cleanup

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

@Akarsh-Hegde Akarsh-Hegde merged commit 12bf0f3 into pre-main Jun 24, 2026
1 check passed
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