Expand description
The append-only JSONL event log: SessionEventLog.
Mirrors the append + fsync pattern of zeph-durable’s JournalWriter
(crates/zeph-durable/src/writer.rs) at the conversation-semantics level, but persists to a
plain JSONL file rather than a SQLite-backed journal (spec-068 §3, §14).
§Invariants
- INV-SP-1 (log-first ordering): callers must append to this log before updating any
downstream projection (
SQLitemessages,acp_sessions.last_seq). - INV-SP-2 (torn-append truncation): every read validates each line and drops a garbled/
incomplete trailing line from the in-memory result, which can only occur as the very last
line because appends are serialized through a single writer (INV-D2). Only
SessionEventLog::open_exclusiveadditionally repairs the torn tail physically on disk — a locklessSessionEventLog::open/SessionEventLog::read_allcannot prove a “torn” line isn’t a live writer’s in-flight, not-yet-fsynced append, so it must never mutate the file (#5487 Finding B). - INV-D2 (single writer): only the session’s owning actor/agent process may hold a
SessionEventLogfor a given session directory at a time.SessionEventLog::opendoes not itself enforce cross-process exclusion — it is also used by read-only tooling (session export/inspection) that may legitimately run alongside a live writer. The session’s owning actor/agent process should instead useSessionEventLog::open_exclusive, which takes a non-blockingflock(2)advisory lock (Unix only) and fails withSessionError::AlreadyLockedif another writer already holds the session directory.
Structs§
Constants§
- CHAIN_
DOMAIN - Domain-separation tag for this subsystem’s hash chain (issue #6360) — distinct from
zeph-subagent’s so a chain from one subsystem can never verify against the other.
Functions§
- configure_
anchor_ store - Configure (or disable, with
None) the vault-anchor store for everySessionEventLogoperation in this process from this point forward. - configure_
history_ integrity - Configure (or disable, with
None) history-chain verification for everySessionEventLogoperation in this process from this point forward. Seezeph_subagent::transcript::configure_history_integrity’s doc for the full contract — this mirrors it exactly.