Skip to content

feat: Task-aware budget tracking for MCP Tasks (SEP-1686) #37

@matt-dean-git

Description

@matt-dean-git

Summary

MCP's Tasks primitive (SEP-1686) enables long-running async operations. The 2026 MCP roadmap confirms retry semantics and expiry policies are coming next.

SatGate currently enforces budgets per-request. When Tasks land with retries, we need to track costs at the task level, not just the request level — otherwise retries silently drain budgets.

Problem

  1. Agent calls tool → task starts → costs N credits → task fails transiently
  2. Agent retries same task → costs another N credits
  3. Budget enforcement has no concept of "same logical operation"
  4. After K retries, agent burns K×N credits for something that should cost N

Proposed Solution

Phase 1: Task-ID Correlation

  • Parse task_id from MCP task responses
  • Group spend records by task_id in the audit log
  • Expose task-level cost in the dashboard (not just per-request)

Phase 2: Retry Cost Policy

  • New policy field: retryCostMode: full | first-only | reduced
    • full — charge full cost per retry (default, backward-compatible)
    • first-only — only charge the first attempt, retries are free
    • reduced — charge a configurable fraction on retries
  • Budget hold: reserve credits on first attempt, release on task completion/failure

Phase 3: Task Expiry Alignment

  • When MCP finalizes expiry policies, align budget holds with task TTLs
  • Auto-release held budget when task expires
  • Configurable grace period for late completions

Context

  • MCP 2026 roadmap: Enterprise Readiness is a top-4 priority
  • Tasks retry semantics are in active development
  • SatGate should be ready when the spec lands, not scrambling after

Labels

enhancement, mcp, budget-enforcement

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions