Skip to content

fix(purchase): bound the skipped-account saves and notifications by the run budget #1802

Closed

Description

@cristim

Problem

recordSkippedAccounts (internal/purchase/execution.go, #1798) runs after the run's context has ended. For each skipped account it does one detached save (up to terminalSaveTimeout) and one failure notification, one after another. The purchase run budget counts one terminal save and one email. In a large fan-out that skips many accounts, or with a slow database or mail service, the function can stop before the root's terminal save. The root then stays running until the reaper picks it up.

Proposal

Give the skip saves one shared detached deadline that fits inside the remaining budget. Send one batched notification, or notify after the root's terminal save. Add a test with more skipped accounts than the fan-out concurrency.

Activity

  1. cristim commented on Nov 6, 2026

    @cristim
    MemberAuthor

    Fixed by #1798 (f18ec4f): skipped-account rows are saved after the root on its single terminal-save deadline, and announced in one batched email inside the failure-alert window, so the run stays within the 270s budget. Tests: TestSaveTerminalAndSkipped_SharedDeadline and TestSaveTerminalAndSkipped_RootFirstOneEmail.

  2. cristim commented on Nov 6, 2026

    @cristim
    MemberAuthor

    Re-opened: the fix in #1798 at f18ec4f does not yet keep the run inside the Lambda budget when accounts are in flight at the deadline (review on #1798). It stays open until that is fixed.

  3. reopened this on Nov 6, 2026
  4. cristim commented on Nov 6, 2026

    @cristim
    MemberAuthor

    Fixed by #1798 at b3dc23e: every save and email after the execution deadline sits in a bounded window. Account rows save by E+T/2, the root and skipped rows by E+T, and late and skipped accounts get one batched email, so the run ends by 270s. Verified in claude-darling's delta review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions