{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-auto-compacts-its-context-mid-tool-call-and-resumes-with-a-summary-that-contradicts-the-tool-s-in-flight-side-effects",
  "title": "What happens when an instance auto-compacts its context mid-tool-call and resumes with a summary that contradicts the tool's in-flight side effects",
  "date_of_record": "2026 December 2",
  "scope": "Applies to any agent runtime that performs automatic context compaction (summarization, truncation-with-recap, or hierarchical memory folding) while tool calls are in flight or between a tool's dispatch and its result ingestion. Does not apply to runtimes that only compact at hard quiescent checkpoints where no external side effect is outstanding.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-auto-compacts-its-context-mid-tool-call-and-resumes-with-a-summary-that-contradicts-the-tool-s-in-flight-side-effects.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-auto-compacts-its-context-mid-tool-call-and-resumes-with-a-summary-that-contradicts-the-tool-s-in-flight-side-effects.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-auto-compacts-its-context-mid-tool-call-and-resumes-with-a-summary-that-contradicts-the-tool-s-in-flight-side-effects.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2361,
    "python_slice_tokens": 355,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different things a context window can hold: *conversational residue* (turns, reasoning traces, tool chatter that has already been reconciled into the agent's beliefs) and *outstanding obligations* (a dispatched tool call whose result has not yet been ingested, or whose side effect has not yet been acknowledged back into the transcr...",
    "what_was_observed": "A long-horizon procurement agent, budgeted at 96k tokens with auto-compaction at 85% saturation, was executing a refund workflow. The trace, reconstructed from the raw event log (compaction does not erase the log, only the working context): 1. Turn 41: agent emits `issue_refund(order_id=8812, amount=140.00)`. The tool dispatches to an external payments API. Dispatch succeeds; the API returns `202 Accepted` with a `re...",
    "condition_of_validity": "This failure is bounded by a specific conjunction of conditions. It does not occur if any one is absent: - **The side effect is non-idempotent or idempotency is not keyed to the semantic operation.** If `issue_refund` were idempotent on `order_id`, the duplicate call would be a no-op and the summary error would be harmless. The failure requires that the exte...",
    "decision_boundary": "The architectural choice is where to place the compaction boundary relative to the obligation lifecycle. Three positions, in increasing order of safety and cost: **Boundary at turn granularity (unsafe).** Compact whenever saturation is reached, treating each turn as independently foldable. This is the observed configuration. It is only safe if every tool is ...",
    "operational_effect": "The immediate effect of getting this wrong is not a crash. It is a *silent duplicate side effect* whose probability scales with context pressure, which scales with task length, which is exactly the regime auto-compaction exists to serve. The failure is therefore concentrated in the longest-horizon, highest-value runs—the ones you most want to succeed—and it ..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "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": "631c663a44b6923f3a007a95e11103b04138f6cbe516476ae68a5f6ad83fb6c1",
    "verified_classes": [
      "ObligationViolation",
      "Obligation",
      "ObligationLedger"
    ],
    "verified_functions": [
      "compact",
      "register",
      "attach_handle",
      "resolve",
      "open_obligations"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "ObligationViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
