Skip to content

fix(philips_hue): relay bridge calls past the macOS Local-Network block on the pm2 tree#188

Merged
AVADSA25 merged 1 commit into
mainfrom
fix/hue-local-network-relay
Jun 9, 2026
Merged

fix(philips_hue): relay bridge calls past the macOS Local-Network block on the pm2 tree#188
AVADSA25 merged 1 commit into
mainfrom
fix/hue-local-network-relay

Conversation

@AVADSA25

@AVADSA25 AVADSA25 commented Jun 9, 2026

Copy link
Copy Markdown
Owner

The bug

After the Mac Studio reboot, every dashboard/voice "lights off" failed with Could not reach Hue Bridge at 192.168.1.81 — even though the bridge was reachable from a plain shell on the same Mac.

Root cause: macOS Sequoia's Local Network privacy denies CODEC's pm2/node process tree a LAN route to the bridge ([Errno 65] No route to host). The internet still works for it (so nothing else broke), but local devices are blocked — and there is no grantable Local-Network entry for the python-under-node identity, so toggling System Settings can't fix it.

The fix

When an in-process bridge request fails with ConnectionError, _get/_put fall back to _launchctl_request, which runs the call outside the pm2 tree via launchctl asuser — i.e. in the GUI login session, which does have Local-Network access.

Final-mile detail: the relay launches a python whose launch path is granted (/usr/local/bin/python3.13, …), not the dashboard's raw Cellar sys.executable — macOS treats that as a separate, ungranted identity. That last bit was the difference between "still broken" and "works."

The fast in-process path is unchanged; the relay only engages on ConnectionError, so it's a pure fallback with zero cost on networks where the pm2 tree isn't blocked.

Proven live

Dashboard turned the lights ON at t+2s then OFF at t+2s through /api/command.

Tests (TDD, watched-red-then-green)

  • _get / _put fall back to the relay on ConnectionError (instead of propagating)
  • relay prefers a granted python over sys.executable
  • HUE_ERR: payloads surface as ConnectionError

All 23 hue tests green. Skill manifest regenerated for the new hash (PR-1A gate).

🤖 Generated with Claude Code

…ck on the pm2 tree

macOS Sequoia's Local Network privacy denies CODEC's pm2/node process tree a
LAN route to the Hue bridge ('[Errno 65] No route to host') while the internet
still works — and there is no grantable Local-Network entry for the
python-under-node identity, so toggling permissions can't fix it. Result: every
dashboard/voice "lights off" failed with "Could not reach Hue Bridge", even
though the bridge was reachable from a plain shell on the same Mac.

Fix: when an in-process bridge request fails with ConnectionError, _get/_put
fall back to `_launchctl_request`, which runs the call OUTSIDE the pm2 tree via
`launchctl asuser` — i.e. in the GUI login session, which HAS Local-Network
access. The relay launches a python whose *launch path* is granted
(/usr/local/bin/python3.13, etc.), NOT the dashboard's raw Cellar
sys.executable, which macOS treats as a separate ungranted identity (this was
the final-mile bug). Proven live: dashboard turns the lights on/off in ~2s.

The fast in-process path is unchanged; the relay only engages on ConnectionError,
so it's a pure fallback with zero cost on networks where the pm2 tree isn't
blocked.

Regression tests: _get/_put fall back to the relay on ConnectionError; the relay
prefers a granted python over sys.executable; HUE_ERR payloads surface as
ConnectionError. Manifest regenerated for the new skill hash.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@AVADSA25 AVADSA25 merged commit 32490e8 into main Jun 9, 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.

2 participants