Skip to content

fix: recover control socket after pathname loss - #84

Open
teamleaderleo wants to merge 83 commits into
mainfrom
fix/socket-path-monitor-registration
Open

teamleaderleo wants to merge 83 commits into
mainfrom
fix/socket-path-monitor-registration

Conversation

@teamleaderleo

Copy link
Copy Markdown
Owner

Problem

The control socket can become unreachable when its pathname disappears before the directory watcher is armed, or when another inode replaces the bound pathname while the listener is still running. In the first case no filesystem event is delivered to the newly-created watcher. In the second case configuration reconciliation could chmod the replacement path while leaving the original listener unreachable.

What changed

  • Queue a generation-validated ownership check immediately after arming the parent-directory watcher, closing the bind-to-watch registration race.
  • Refuse live configuration permission updates when the listener no longer owns the bound pathname; the existing stop/start path then performs safe recovery.
  • Add behavioral coverage for unlink, inode replacement, repeated recovery, and stale generation callbacks.

Validation

  • swift test --package-path Packages/macOS/CmuxControlSocket --filter 'SocketControlServer|SocketTransportPath|SocketListener'
    • 77 tests passed across 13 suites.
  • xcodebuild ... -scheme cmux-unit ... build-for-testing
    • TEST BUILD SUCCEEDED.
  • git diff --check passed.

The test-only regression commit is intentionally separate from the fix commit so the failure is visible in the PR history.

Related: manaflow-ai#632

Make tagged terminal-kit builds inherit the release cmux Ghostty config when no tag-specific config exists, with focused resolver coverage. Clarify semantic hover-copy by anchoring the control to the block start, labeling the copied block, and restricting click cursor feedback to the control.
@teamleaderleo
teamleaderleo force-pushed the fix/socket-path-monitor-registration branch from d3712ac to efc9cb8 Compare September 19, 2026 02:33

This branch has not been deployed

No deployments
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