3 Commits

Author SHA1 Message Date
627e499e73 fix(agent-runtime): owed captures survive a crash (durable capture journal)
The capture reconciler kept captures that failed after the provider served
the request in memory only: a crash lost them, and with them the operator's
revenue. MintPaymentGateway also kept each hold's payee and idempotency base
in memory, so even a persisted capture could not be settled after a restart.

- agent-core journal: CaptureJournal and FileCaptureJournal, an append-only
  JSON-lines file fsynced per entry and compacted on open (atomic rename); a
  torn last line is dropped, earlier corruption is an error.
- CaptureReconciler::with_journal records every queued, attempted, settled
  and dead-lettered capture before acting, reopens with what is still owed
  (and the dead letters), and resume() restarts the retry loops.
- PaymentGateway gets hold_context/restore_hold_context (defaults: nothing);
  MintPaymentGateway exports and restores its payee and idempotency base, so
  a restored capture uses the same deterministic key.

Tests: journal replay/compaction/torn tail/corruption, owed captures settled
after a restart and not owed again, dead letters persisted and resume()
retrying the rest, gateway capture after context restore. 68 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 15:51:37 +03:00
894359e5ff feat(railyard): per-app completion pass — money-correct settlement + crate cores
- rago: exactly-once prepaid settlement (deterministic idempotency, unique partial index + in-tx ON CONFLICT guard) — closes the double-charge risk
- mint: double-entry + reserve conservation verified (14 tests)
- ledgerline: atomic settlement outbox + partial recovery index (37 tests)
- abacus: hard per-agent budget enforcement + kill-switch (54 tests)
- vend: crash reaper / in-flight session reconciliation
- turnstile/agent-runtime/ranguard/rit/game-economy/context-passport/rithub: core advanced + tests
2026-09-07 17:17:54 +03:00
a853ab7edf Railyard: extract AI settlement+model rail from videogen (mint/relay/agent-runtime/vend/abacus/turnstile/ledgerline/prism) 2026-08-24 20:10:29 +03:00