0111: Journal framing, IDs and outbox
Status: Proposed (default; pending owner confirmation)
Context
Recovery must distinguish a recorded intent from a completed external effect and detect torn append-only records. M12 needs a portable implementation in both backends.
Decision
Assign dense action and attempt IDs in the runner; derive the
idempotency key from run, action and first attempt. Frame records
as len | crc32 | payload; recovery truncates a torn
tail. Persist intent before dispatch. An intent without a result
recovers as UnknownExternalOutcome, unless the port
deduplicates by key. Provide no-op, memory and append-only file
journals, group commit and explicit durability classes; snapshot
plus tail supports recovery. Defer SQLite in v0.
Consequences
Crash points can be tested around intent, effect, result and acknowledgement. File durability has explicit sync tradeoffs; SQLite is deferred to avoid a dependency and backend-parity burden.
Addendum: Fs.truncate native (OWNER FLAG)
Status: Proposed, pending the maintainer's confirmation. OWNER FLAG: this is a new agent-platform native beyond design D2.
Context
Recovery must cut a torn journal tail in place.
Decision
Provide Fs.truncate(path, len) only for cutting a
torn journal tail, scoped to the filesystem capability held by
plugins/agent_journal_file.
Consequences
A late fsync failure after truncation cannot restore the discarded bytes.
Alternatives
Rewrite the valid prefix and rename it over the journal instead of truncating in place.