Skip to content

Self-heal outdated port forwarding daemon on magebox start - #138

Open
Aquive wants to merge 2 commits into
qoliber:mainfrom
Aquive:fix/portforward-daemon-self-upgrade
Open

Self-heal outdated port forwarding daemon on magebox start#138
Aquive wants to merge 2 commits into
qoliber:mainfrom
Aquive:fix/portforward-daemon-self-upgrade

Conversation

@Aquive

@Aquive Aquive commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Problem

A binary upgrade (Homebrew or selfupdate) only replaces the binary — the installed LaunchDaemon is only upgraded by magebox bootstrap. Users who never re-run bootstrap silently keep running an old daemon generation, including the removed pf-based approach.

Changes

  • EnsureRulesActive() now reconciles the daemon state on every magebox start: outdated daemon → reinstall via Setup(), inactive → kickstart, missing → bootstrap hint. Decision logic extracted into a pure nextAction() with table-driven tests.
  • Replaced the sudo launchctl list hint (shows the job even when it does nothing) with the launchctl kickstart command that actually restarts it.
  • Updated FAQ entries that still described the removed pf anchor mechanism.
  • Added "Self-healing by default" as a core principle to CLAUDE.md: every part of the environment MageBox manages is expected to detect and repair its own broken or outdated state at the next natural moment — instructing the user is the fallback, never the design. Codifies the pattern from Self-heal web-UI service commands when their container is stopped #128.
  • Reordered the principles into logical groups: architecture → developer experience → team → scope → positioning.

Follows the same approach as #128.

https://claude.ai/code/session_011EJ9p83uoE4YLhrnuMqcmb

Aquive added 2 commits August 25, 2026 16:09
A binary upgrade only replaces the magebox binary; the installed
LaunchDaemon is upgraded exclusively by 'magebox bootstrap'. Users who
upgrade via Homebrew or selfupdate silently keep running an old daemon
generation — including the removed pf-based approach — until they happen
to run bootstrap again.

EnsureRulesActive now reconciles the daemon state on every start: an
outdated daemon (missing the current plist version marker) is
reinstalled via Setup(), an inactive one is kickstarted, and only an
installed, current, responding daemon is left alone. The decision logic
lives in a pure nextAction() function with table-driven tests.

Also replace the misleading 'sudo launchctl list' hint — which shows the
job even when it does nothing useful — with the kickstart command that
actually restarts it, and update the FAQ entries that still described
the removed pf anchor mechanism.

Claude-Session: https://claude.ai/code/session_011EJ9p83uoE4YLhrnuMqcmb
Codify the pattern established by qoliber#128 (auto-starting stopped web-UI
containers) and the port forwarding self-healing as a product-wide
philosophy: every part of the environment MageBox manages is expected to
detect and repair its own broken or outdated state at the next natural
moment, without the user having to know a fix exists. Reorder the
principles so related ones sit together: architecture, developer
experience, team, scope, positioning.

Claude-Session: https://claude.ai/code/session_011EJ9p83uoE4YLhrnuMqcmb
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