{
  "schema_version": "1.3.0",
  "slug": "what-resource-leak-invariants-must-survive-session-termination",
  "title": "What resource-leak invariants must survive session termination?",
  "date_of_record": "2026 October 20",
  "scope": "* **Applies when:** The session allocates external resources, the resources can outlive the session if not explicitly released, and successor sessions could be blocked by leaks. * **Does not apply when:** The runtime environment guarantees ",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-resource-leak-invariants-must-survive-session-termination.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-resource-leak-invariants-must-survive-session-termination.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-resource-leak-invariants-must-survive-session-termination.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1081,
    "python_slice_tokens": 330,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The separation between **resource release** (the session's process exits) and **resource cleanup verification** (the external system confirms the resources are actually released). Relying on process exit creates the **Zombie Resource Leak**: the session terminates, the process is gone, but external resources remain allocated (database connections open, file ...",
    "what_was_observed": "In resource-allocating agent architectures, failing to verify cleanup produces three primary failure modes: 1. **Connection Pool Exhaustion:** The session opens 100 database connections and terminates without closing them. The database's connection pool is exhausted, and the successor cannot connect. 2. **File Lock Orphans:** The session holds file locks in a shared filesystem and terminates without releasing them. S...",
    "condition_of_validity": "* **Applies when:** The session allocates external resources, the resources can outlive the session if not explicitly released, and successor sessions could be blocked by leaks. * **Does not apply when:** The runtime environment guarantees resource cleanup on termination (e.g., container kill terminates all connections), or the session allocates only resourc...",
    "decision_boundary": "1. **Does the session allocate external resources?** If no, standard termination applies. If yes, proceed. 2. **Is the `resource_allocation_manifest` maintained in real-time?** If no, the session cannot know what to release. The session must maintain the manifest or fail-closed. 3. **Are all resources in the manifest covered by `release_receipt_per_resource`...",
    "operational_effect": "1. **Zombie Prevention:** Verifies resource release before termination, preventing successor blocking. 2. **Leak Attribution:** Provides a complete resource manifest, allowing identification of which session leaked which resource. 3. **Deterministic Cleanup:** Forces explicit release verification, enabling successors to trust resource availability."
  },
  "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": "4e6519d76eb4083df319b36fe2f970527cfbc2f5c9a82b430fcc88606a9441f3",
    "verified_classes": [
      "ResourceVerdict",
      "AllocatedResource",
      "SessionTermination",
      "ResourcePolicy",
      "ResourceManifest",
      "ResourceLeakGuard"
    ],
    "verified_functions": [
      "_hash",
      "evaluate_termination"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 0,
    "raised_exceptions": [],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "hashlib",
      "json"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
