Skip to content

fix(budget): release budget headroom when go's price guard refuses before buying #124

Closed

Description

@IAmJSD

Since #123 (mcp#117), the EC2 RI tool passes the approved upfront, so go#611's guard runs. When that guard refuses an offering, the error comes back after the purchase call. Under the existing rule (any error after the purchase call counts as spent), the amount still counts against CUDLY_MCP_BUDGET_USD. With CUDLY_MCP_BUDGET_STATE set, that headroom never comes back, even after a restart. It never overspends, but each refusal permanently shrinks the operator's budget.

Fix: cloud-commitments-go exports a typed "refused before buying" error (wrapping the guard's refusal), and the MCP budget releases the reservation for it. Tests at the guard's refusal and at a real post-call failure.

Found by both independent reviews of #123.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions