v1.29.0 — Settlement Workflow Closure
Settlement Workflow Closure
Turns payment settlement from a foundation-level service into an operator-ready workflow.
What's New
Persistence
- Settlement requests stored in SQLite — survive agent restart
- Automatic load-on-init, persist-on-every-state-change
Operator Workflow
POST /api/operator/settlements/{id}/approve— approve topupPOST /api/operator/settlements/{id}/deny— deny paymentPOST /api/operator/settlements/{id}/execute— topup + auto-retry original callGET /api/operator/settlements?status=pending— list with filter
Approved Retry Loop
- Successful wallet topup automatically retries the original API call
- Original request context preserved through the entire workflow
- Retry result included in execute response
Gateway Auto-Detection
- HTTP 402 responses automatically create settlement requests
- Operator sees pending settlements immediately in API, dashboard, and Telegram
Dashboard UI
- Settlements section with Approve / Deny / Execute buttons
- Real-time refresh after actions
- Status badges (pending → approved → executed)
Reporting
settlement_attentionitems appear in operator inbox for pending settlements
Stats
- 1617 tests pass, 4 skipped
- 9 new tests for settlement persistence, retry loop, API actions
- 11 files modified
Exit Criteria Met (from NEXT_BACKLOG.md)
- ✅ Settlement requests survive restart
- ✅ Operators can list/approve/deny from API and dashboard
- ✅ Payment-required failures move through approved retry path
- ✅ Reporting shows pending settlement attention
Full Changelog
See CHANGELOG.md for detailed breakdown.