{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-quota-allocators-from-starving-the-tool-call-that-resolves-the-task",
  "title": "Which invariants prevent quota allocators from starving the tool call that resolves the task",
  "date_of_record": "2026 November 22",
  "scope": "Applies to agent runtimes that reserve context-window tokens against per-agent and per-tool quotas before issuing a call, and that re-plan when a reservation is denied. Does not apply to single-shot completions with no allocator, nor to stateless tool routers that forward without reserving budget.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-quota-allocators-from-starving-the-tool-call-that-resolves-the-task.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-quota-allocators-from-starving-the-tool-call-that-resolves-the-task.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-quota-allocators-from-starving-the-tool-call-that-resolves-the-task.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1877,
    "python_slice_tokens": 342,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A context budget allocator is not a rate limiter. A rate limiter rejects excess work; a context allocator must reject the *cheapest* work first so the *most decisive* work can still run. The failure mode here is not exhaustion—it is **starvation of the terminal tool call by the planning loop that is trying to make room for it.** Concretely: the allocator gra...",
    "what_was_observed": "A research agent with a 200k-token window, a 60k agent quota, and a 25k per-tool quota for `web_fetch`. Task: \"summarize the three most recent filings and reconcile the revenue figures.\" Trace: 1. Agent reserves 8k for a `search` call. Granted. Returns 6 candidate URLs, ~3k tokens of snippets. 2. Agent reserves 25k for `web_fetch` on filing #1. Granted. Returns 21k of text. 3. Agent reserves 25k for `web_fetch` on fi...",
    "condition_of_validity": "The starvation loop is only reachable when all four hold: - **Denial is recoverable.** The runtime returns a structured denial the agent can see and react to, rather than a hard error. (If denial is fatal, no loop.) - **Re-planning is charged to the same quota it is trying to relieve.** This is the load-bearing condition. If reasoning tokens were billed to a...",
    "decision_boundary": "The boundary is drawn at the reservation, not at the call. A reservation must be admitted only if: where `planned_overhead` is an *estimate of the reasoning tokens the agent will emit before the next reservation resolves*. The critical rule: **on denial, `planned_overhead` for the retry must be counted against the retry's own reservation, and the retry may n...",
    "operational_effect": "With the invariant enforced, step 3's denial returns `QuotaTight` with `remaining_agent: 8000, remaining_tool: 4000`. The re-planner at step 4 is forced to declare its overhead (say 1.5k) *before* reserving, and the 6k fetch reservation is admitted only against `committed + 1.5k + 6k ≤ 60k`. When step 5 wants another 2.4k of reasoning, the allocator charges ..."
  },
  "matched_failure_symptoms": [
    "HTTP_429_BURST_STARVATION"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "91d65c82d005768c3291a8f70136735fdef5d52083d8bf964c2bf2cc182da47f",
    "verified_classes": [
      "QuotaStarvationError",
      "BudgetAllocator"
    ],
    "verified_functions": [
      "run_retry_cycle",
      "__init__",
      "reserve",
      "settle"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "QuotaStarvationError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
