Skip to content

Agent/global codex hooks - #23

Open
huang-daniel wants to merge 10 commits into
simple10:mainfrom
huang-daniel:agent/global-codex-hooks
Open

Agent/global codex hooks#23
huang-daniel wants to merge 10 commits into
simple10:mainfrom
huang-daniel:agent/global-codex-hooks

Conversation

@huang-daniel

Copy link
Copy Markdown

No description provided.

huang-daniel and others added 3 commits July 26, 2026 01:06
Adds the supervision kernel that will guarantee exactly one healthy
long-lived collector process per data root. Primitives only — nothing in
the hook, the CLI, or the server calls them yet, so event delivery is
unchanged.

- observe-env.sh: data-root and runtime path resolution, unsafe-root
  rejection, shared config defaults. Resolution is side-effect free so
  read-only callers never create state.
- observe-process.sh: process identity (PID + start time + executable)
  plus a stable entrypoint marker, so a reused PID or an unrelated live
  process is never mistaken for the collector. Signals are addressed by
  identity, never by pattern.
- observe-lock.sh: atomic lock claims and identity-based abandonment.
  Age is never evidence that a lock is abandoned.
- observe-heartbeat.sh: heartbeat age/freshness bound to the lock's
  instanceId, and the canonical health predicate.
- observe-health.sh: read-only diagnostic with four output shapes and
  three exit codes. It never signals, reclaims, or creates anything.

Lock claims are gated in two stages: mkdir for the directory, then an
O_EXCL (noclobber) write of the pid file inside bash. The second stage
is load-bearing — Ubuntu 25.10's uutils coreutils 0.8.0 mkdir reports
success to several concurrent creators of the same directory, so a
singleton resting on the host mkdir binary is not a guarantee. The race
test in test/hooks/scripts/supervision covers this.

Contract and invariants: docs/collector-supervision.md

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
feat(supervision): add collector supervision primitives
@huang-daniel
huang-daniel force-pushed the agent/global-codex-hooks branch from 9e9bbdb to 41a605e Compare July 26, 2026 14:13
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