Documentation
¶
Overview ¶
Package lockfile implements the exclusive cross-host Delivery lock (PRD §14): one active Delivery coordinator per repository across both hosts. The lock is the existence of .orchestrator/delivery.lock, created with O_EXCL so acquisition is atomic on every supported OS.
The lock deliberately outlives the acquiring process: a Delivery run spans many short-lived orch invocations plus a host agent session, so the recorded PID is advisory and its death is never treated as staleness. There is no automatic takeover; recovery is always the explicit human action `orch abort` (PRD §15). A lock file that exists but cannot be read still denies acquisition (fail closed).
Index ¶
Constants ¶
const Path = ".orchestrator/delivery.lock"
Path is the repo-relative location of the Delivery lock file.
const SchemaVersion = 1
SchemaVersion is the lock-file schema this build reads and writes.
Variables ¶
var ErrHeld = errors.New("delivery lock is already held")
ErrHeld reports that the Delivery lock is already held. Callers test for it with errors.Is.
Functions ¶
func Acquire ¶
Acquire atomically creates the lock file recording o. If the lock already exists — even unreadable — it returns an error wrapping ErrHeld and changes nothing.
Types ¶
type Owner ¶
type Owner struct {
SchemaVersion int `json:"schema_version"`
RunID string `json:"run_id"`
Host string `json:"host"` // "claude" or "codex"
Hostname string `json:"hostname"`
PID int `json:"pid"`
AcquiredAt time.Time `json:"acquired_at"`
}
Owner identifies who acquired the lock. Hostname and PID exist for audit and diagnostics only: the acquiring process is expected to exit while its Delivery run legitimately continues.