Skip to content

fix(server): lease Darwin server ownership - #57

Merged
lastobelus merged 2 commits into
lastcode/mainfrom
lastcode/server-owner-lease
Aug 22, 2026
Merged

lastobelus merged 2 commits into
lastcode/mainfrom
lastcode/server-owner-lease

Conversation

@lastobelus

Copy link
Copy Markdown
Owner

Part of #39.

On macOS, the desktop client and a headless launchd service could otherwise start separate servers against the same LastCode home. Concurrent ownership risks conflicting state writers and makes the service transition unsafe.

This adds a Darwin kernel-backed exclusive lease for each server base directory. Server startup acquires the lease before constructing the runtime, reports a clear error when another owner holds it, rejects unsafe lock paths, and releases ownership with the server scope. Other platforms retain their existing startup behavior rather than gaining a weaker PID-file fallback.

Focused coverage exercises contention, release and reacquisition, canonicalized paths, symlink rejection, invalid lock paths, and the non-Darwin boundary. The rebased patch also passed server typechecking, targeted lint/format checks, and the normal four-stage LastCode quick-CI push guard.

Built with GPT-5.4 in the Codex harness.

Loading
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