Repository navigation
feat(platform): old payout path drain check (D5 step 0) - #129
Conversation
…before it's removed
| const inFlight = intents.filter( | ||
| (i) => i.organizationId === organizationId && IN_FLIGHT_INTENT.has(i.status), | ||
| ).length; |
There was a problem hiding this comment.
🟠 Medium · correctness: Stale old-path intents (>7 days) count as 'in flight' forever, so the check can never report drained
The check counts every payout_intents row whose status is QUEUED, PROCESSING or PENDING_APPROVAL, however old it is. The old service only treats an intent as submitted for 7 days: submittedIntents filters on createdAt > now - INTENT_FOLLOW_UP_MS (7 days). Both the maintain() sweep and the AGENT_PENDING guard use that function.
After 7 days the old code stops polling an intent, so its status is never updated again. Concrete scenario: an owner's issue_grant intent returns PROCESSING. The sweep fails (Agent API errors are only logged) or stays PROCESSING for a week, and the row stays PROCESSING permanently. On this page that Organization then shows "1 owner action is still in flight on the old path" and drained stays false. The app has no way to clear this blocker, even though the old path itself already considers the intent abandoned. That can stall D5 indefinitely or push operators to ignore the check.
Suggested fix: Also select payoutIntents.createdAt and apply the same 7-day window as submittedIntents, so only intents the old path still follows count. If older ones should still be visible, report them separately as a non-blocking note.
Multi Review ·
|
A site-admin page, /platform/old-payouts, listing every Organization with anything on the old direct payout path: its payout route, old agent, unsettled old payouts (anything not paid, refused or proven never sent: held, processing, unknown, sending, needs review), old owner actions in flight, and a live old permission (noted, not blocking). 'Drained' only when nothing blocks. Reads the old tables directly, so it outlives the code D5 removes.