{
  "schema_version": "1.3.0",
  "slug": "what-structural-signals-indicate-a-context-rewrite-deadlock-in-self-editing-context-windows",
  "title": "What structural signals indicate a context-rewrite deadlock in self-editing context windows",
  "date_of_record": "2026 November 13",
  "scope": "Applies to systems where a model is permitted to rewrite, prune, or summarize its own active context window under a policy that is itself evaluated against the window's content. Does not apply to externally-driven truncation (fixed token budgets, FIFO eviction, sliding windows) where the rewrite policy is not model-invoked.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-context-rewrite-deadlock-in-self-editing-context-windows.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-context-rewrite-deadlock-in-self-editing-context-windows.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-structural-signals-indicate-a-context-rewrite-deadlock-in-self-editing-context-windows.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1780,
    "python_slice_tokens": 272,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode is not the well-known \"lost in the middle\" degradation or ordinary context overflow. It is a **fixed-point deadlock in the rewrite policy**: the model is asked to decide which spans to prune, the decision depends on the semantic content of the window, and the act of pruning changes the content that justified the decision — such that the next...",
    "what_was_observed": "Across three deployments of a self-editing agent (a code-repair loop and two long-horizon research agents), the following structural signals preceded every observed deadlock: 1. **Pruning rationale orphaned from retained spans.** The policy removed the span that contained the *reason* for retaining another span. Concretely: the agent pruned a failed test's stack trace because it \"looked stale,\" but that trace was the...",
    "condition_of_validity": "The deadlock is possible only when all of the following hold: - The rewrite policy is **model-invoked** (the model decides what to prune) rather than externally parameterized. - The policy's decision **depends on content that the policy itself may remove** (i.e., the rationale for retention is co-located with prunable material). - There is **no external, mon...",
    "decision_boundary": "The operational boundary is between **stable lossy rewrite** (acceptable: the window shrinks, information is lost, but the policy is idempotent and the retained set is internally justified) and **unstable rewrite** (unacceptable: the policy is non-idempotent and the retained set is not self-justifying). Decision rule: after each rewrite pass, compute (a) the...",
    "operational_effect": "When the deadlock is allowed to run, the observable effect is a slow budget drain: each cycle costs a policy invocation plus a summarization pass, and the agent makes no forward progress on the underlying task while its window oscillates. In the code-repair deployment, deadlocked episodes consumed 40–60% of the episode budget before a wall-clock timeout fire..."
  },
  "matched_failure_symptoms": [
    "SQLITE_BUSY_OR_DEADLOCK"
  ],
  "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": "0199d2022e57f9da727e07a5dbac5036f9df3afcf418f2cb632a79d4b6a83464",
    "verified_classes": [
      "ContextRewriteDeadlockError",
      "Span"
    ],
    "verified_functions": [
      "check_justification_reachability",
      "apply_self_edit"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ContextRewriteDeadlockError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
