Story-1000: Align terminal run statuses

Story 1000Epic 749๐Ÿ”— Chain of CustodyAgent Platform3 files ยท +222/โˆ’6

PR #22 ยท pramaan-io/pramaan-agents ยท merged 2026-06-03

How it flows

sequenceDiagram
  autonumber
  participant guard as Guardrail
  participant reducer as Reducer
  participant state as agent_run.status
  guard->>reducer: terminal failure event
  reducer->>reducer: _run_failed_status classifies
  reducer->>state: aborted_cost / circuit_open
  state-->>reducer: replay
  reducer->>reducer: terminal flag โ†’ same final state

src/pramaan_agents/db/reducer.py

Methodin โ†’ outwhat it does
_run_failed_status(payload) โ†’ strclassifies a failure payload as aborted_cost or circuit_open

What changed, file by file

Reducer that turns failure events into agent run state โ€” adds the _run_failed_status helper plus aborted_cost and circuit_open terminal constants so a terminal flag sticks on replay.

new methodsignature
_run_failed_status(payload) โ†’ str

What does NOT happen

Replay is idempotent
Terminal stays terminal
Audit log matches runtime
aborted_cost is first-class
circuit_open is first-class
No silent re-classification

Files changed (3)

Fileยฑ
docs/walkthroughs/story-1000-walkthrough.html+123
src/pramaan_agents/db/reducer.py โ˜…+42 โˆ’6
tests/test_reducer_events.py+57