Skip to content

(mcp) Enforce response budgets as hard limits #411

Description

@tcballard

Priority

P1 — agent context-safety contract.

Problem

The advertised response budget is not a hard limit. Oversized summary responses with no supported truncation key are only marked as truncated, and deep relationship responses can retain an unbounded neighborhood.

The binding port contract records real outputs of 24,346 and 62,609 characters against the default 10,000-character budget. ADR-033 says every guide/MCP response is budgeted and that the default is configurable at startup, but the Rust MCP server hardcodes DEFAULT_BUDGET and exposes no configuration surface.

Evidence

Acceptance criteria

  • Every successful MCP response is at or below the configured character budget.
  • attention, neighborhood, and other repeated collections are deterministic whole-item truncation targets.
  • Omitted counts and truncation metadata are truthful.
  • If mandatory fixed fields alone exceed the budget, return a small explicit error rather than an oversized success.
  • The startup budget is configurable, or ADR-033 is deliberately amended to remove that promise.
  • Tests cover large summaries, high-degree graphs, depths greater than one, minimum budgets, and deterministic output.
  • The known port-contract overrun exceptions are removed rather than retained as bug-for-bug behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions