fix: handle macOS hostname drift in isSelf() (v0.26.6)#320
Merged
jpelaez-23blocks merged 1 commit intomainfrom Apr 6, 2026
Merged
fix: handle macOS hostname drift in isSelf() (v0.26.6)#320jpelaez-23blocks merged 1 commit intomainfrom
jpelaez-23blocks merged 1 commit intomainfrom
Conversation
When macOS silently changes hostname (DHCP, Bonjour collision, docking), isSelf() failed to recognize the old self host entry in hosts.json. This caused the machine to lose its identity in the mesh network. Fix: cache the self host's aliases at startup by matching against hosts.json entries. Uses two-pass lookup — first by hostname (safe), then by IP alias with exactly-one-match guard (prevents DHCP false positives on remote hosts). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
isSelf()so old hostnames are still recognized after OS hostname changesloadStoredSelfAliases(): hostname match first, then IP alias match with exactly-one-match guard to prevent DHCP false positiveslib/hosts-config.ts), no changes tomigrateHost(),validateHosts(),registerPeer(), or any other resolution logicTest plan
isSelf("old-hostname")returns true when hosts.json has entry with old hostname and matching IP in aliasesclearHostsCache()is called after saving hosts🤖 Generated with Claude Code