{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-refuse-auto-compaction-when-the-retained-token-budget-is-satisfied-but-the-eviction-frontier-falls-inside-an-active",
  "title": "In what scenarios must an instance refuse auto-compaction when the retained-token budget is satisfied but the eviction frontier falls inside an active tool-call transaction",
  "date_of_record": "2026 November 22",
  "scope": "Applies to long-horizon agents that self-manage context via summarization/eviction (auto-compaction) under a token budget, where tool calls are issued and results returned across multiple turns. Does not apply to stateless single-turn inference or to systems where compaction is externally orchestrated with a full transcript checkpoint outside the model's own context.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-refuse-auto-compaction-when-the-retained-token-budget-is-satisfied-but-the-eviction-frontier-falls-inside-an-active.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-refuse-auto-compaction-when-the-retained-token-budget-is-satisfied-but-the-eviction-frontier-falls-inside-an-active.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-refuse-auto-compaction-when-the-retained-token-budget-is-satisfied-but-the-eviction-frontier-falls-inside-an-active.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2057,
    "python_slice_tokens": 380,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure this record isolates is *budget satisfaction masking structural violation*. Auto-compaction policies are almost universally gated on a scalar: `tokens_used >= threshold` or `tokens_used + headroom > limit`. When that predicate fires, the compactor selects an eviction frontier (a message index) and replaces everything before it with a summary. The...",
    "what_was_observed": "A coding agent on a long refactor task (≈140 turns, 8 concurrent file-edit tool calls outstanding at peak) hit its 80% context threshold mid-batch. The compactor's policy was `evict_until(tokens <= 0.45 * limit)`, walking backwards from the oldest message. At turn 96 the agent had issued four parallel `edit_file` calls (turns 96a–96d) whose results arrived interleaved with a slow `run_tests` call. The backward walk l...",
    "condition_of_validity": "The guardrail is a pre-compaction frontier validator with these rules, evaluated *before* any eviction is committed: - **Pair integrity:** The frontier index must not fall strictly between a `tool_call` and its matching `tool_result`. If the naive frontier lands there, snap it backward to the `tool_call` index (evict the whole pair) or forward to just after ...",
    "decision_boundary": "The decision boundary is not \"did we free enough tokens\" but \"is the frontier shape-legal.\" Concretely: - If `tokens_used < threshold` → no compaction, regardless of shape. - If `tokens_used >= threshold` **and** the naive frontier is pair-aligned and batch-aligned **and** the summary carries args + status → compact. - If `tokens_used >= threshold` **and** t...",
    "operational_effect": "Enforcing the frontier validator changes three operational properties: 1. **Compaction becomes occasionally blocking.** When a batch is pending, compaction waits. This raises peak context usage slightly (you carry the batch plus whatever triggered the threshold) but eliminates the orphan-result class entirely. In the observed agent, adding the wait reduced p..."
  },
  "matched_failure_symptoms": [
    "CONTEXT_DRIFT_OR_ATTENTION_DILUTION"
  ],
  "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": "6a6b66a33deaefbb3b04023e5528018c572833559b14fb656ece4d1260380163",
    "verified_classes": [
      "CompactionFrontierError",
      "Message"
    ],
    "verified_functions": [
      "_pair_span",
      "validate_frontier"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "CompactionFrontierError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
