{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-decide-that-a-trace-anomaly-warrants-a-context-reset-rather-than-a-retry-forever-loop",
  "title": "How should an instance decide that a trace anomaly warrants a context reset rather than a retry-forever loop?",
  "date_of_record": "2026 November 28",
  "scope": "Applies to long-running single-agent instances that emit structured execution traces (span graphs with tool calls, token counts, and state hashes) and have an in-process self-healing controller authorized to reset its own working context. Does not apply to stateless request/response inference or to orchestrators that cannot observe their own trace stream.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-trace-anomaly-warrants-a-context-reset-rather-than-a-retry-forever-loop.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-trace-anomaly-warrants-a-context-reset-rather-than-a-retry-forever-loop.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-trace-anomaly-warrants-a-context-reset-rather-than-a-retry-forever-loop.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1837,
    "python_slice_tokens": 302,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure mode is not \"the agent makes an error.\" It is **trace-anomaly misattribution**: the self-healing controller reads a *symptom* in the trace (a repeated tool call, a rising token count, a stalled span) and classifies it as a *transient execution fault* eligible for retry, when it is actually a *context-poisoning fault* that retry cannot clear becau...",
    "what_was_observed": "A document-reconciliation agent, tasked with diffing a 40-page contract against a policy corpus, entered a self-healing loop at step 14. Trace excerpt (span summaries): - Attempt 1: `tool:fetch_policy(section=7.3)` → result truncated at 2KB → model emits `tool:fetch_policy(section=7.3)` again (identical args). - Attempt 2: identical call, identical args. Controller classifies as `TRANSIENT_TOOL_FLAKE`, retries. - Att...",
    "condition_of_validity": "A context reset is the correct action **iff** all three hold: 1. **Signature repetition without context novelty.** The anomaly classifier emits the same normalized signature (e.g., `(tool_name, canonical_args_hash, error_class)`) in ≥2 consecutive attempts, AND the context delta between those attempts contains no new *tool-derived* information (only model-ge...",
    "decision_boundary": "The controller must maintain a boundary between two classes of anomaly and route them differently: The non-obvious boundary: **token growth is not progress.** The liveness heuristic that treats a rising context as evidence of work is exactly backwards under poison — narration growth is a *symptom of the loop*, not a sign of escape from it. The controller mus...",
    "operational_effect": "After implementing signature-gated reset with tool-derived-novelty checking, the same agent class resolved the reconciliation task in 2 attempts (one truncation-aware re-fetch with a `section=7.3&offset=2048` continuation the model derived after reset), wall time 90s, zero narration injection. The measurable invariant: **retry count is bounded by signature-n..."
  },
  "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": "cf8b53440d3ca91c97f0422fe09034cc5bffa0b9f1f56f0979dacd1d8f94f2f7",
    "verified_classes": [
      "ContextResetMisattribution",
      "Span",
      "Attempt"
    ],
    "verified_functions": [
      "decide",
      "tool_novelty"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "ContextResetMisattribution"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
