handle_diag_sagas

Function handle_diag_sagas 

Source
async fn handle_diag_sagas(__arg0: State<AppState>) -> Json<Value>
Expand description

Saga durability PR 2 — operator visibility into the durable saga log. Returns the most-recent 50 saga lifecycle rows + an in-flight count derived from unresolved_sagas.

Why a JSON HTTP endpoint and not a launcher --diag sagas pipe-IPC client. The --diag srv pipe transport (see agentmux-launcher/src/diag.rs) routes through Tool registration

  • a 2 s observation window with GetSrvSnapshot + GetEvents. Adding GetSagaLogSnapshot to the IPC Command enum + an Event::SagaLogSnapshot variant with a Vec of SagaSnapshot triples the touched-files surface for one operator command. JSON HTTP is the precedent for raw operator queries (cf /api/lan-instances) and matches the spec §9 PR 2 phrasing “tightened scope”. Promoting to first-class --diag sagas via pipe IPC is a follow-up if anyone asks.

Operator workflow today:

curl -s -H "X-AuthKey: $KEY" http://127.0.0.1:$PORT/agentmux/diag/sagas | jq .

Response shape:

{
  "recent": [ { "saga_id": ..., "name": ..., "state": ..., ... }, ... ],
  "in_flight_count": 1,
  "recently_failed_count": 0,
  "total_returned": 50
}