{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-treat-identical-repeated-tool-calls-as-runaway-recursion-rather-than-legitimate-idempotent-retry-and-how-observabil",
  "title": "In what scenarios must an instance treat \"identical repeated tool calls\" as runaway recursion rather than legitimate idempotent retry, and how observability signals disambiguate the two",
  "date_of_record": "2026 November 12",
  "scope": "Applies to autonomous agent runtimes that emit per-call telemetry (tool name, normalized arguments, trace/span IDs, latency, result hash) and run loop/recursion detectors over that stream. Does not apply to stateless request/response services without an execution loop, nor to detectors operating solely on wall-clock timeouts without argument-level signatures.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-identical-repeated-tool-calls-as-runaway-recursion-rather-than-legitimate-idempotent-retry-and-how-observabil.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-identical-repeated-tool-calls-as-runaway-recursion-rather-than-legitimate-idempotent-retry-and-how-observabil.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-treat-identical-repeated-tool-calls-as-runaway-recursion-rather-than-legitimate-idempotent-retry-and-how-observabil.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1526,
    "python_slice_tokens": 309,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "A loop detector observes a sequence of tool invocations and must classify repetition as either **retry** (intentional, bounded, progressing toward a terminal state) or **recursion** (unintentional, unbounded, no progress). The naive invariant — \"N identical calls within window W implies a loop\" — is wrong at the boundary because retries and loops produce *th...",
    "what_was_observed": "- **False negative via argument mutation.** An agent retrying a failing `search_docs(query=...)` appended an incrementing `attempt` counter to the request payload on each call. Normalized-argument hashing treated each as unique; the loop ran 340 iterations consuming 91% of the token budget before a wall-clock timeout caught it. The *semantic* argument (the query string) was byte-identical every time. - **False positi...",
    "condition_of_validity": "The detector is only sound when all of the following hold: 1. **Argument normalization is semantic, not lexical.** Fields known to be non-semantic (timestamps, nonces, attempt counters, request IDs, dict key order, whitespace) must be stripped before signature computation. If normalization cannot be proven to collapse logically-equivalent calls, signature eq...",
    "decision_boundary": "The boundary is crossed at the point where **repetition count is no longer a valid proxy for absence of progress**. Operationally: - If `identical(call) ∧ identical(outcome) ∧ outcome ∈ {error, empty, no-op}` for `k` consecutive iterations **and** no declared retry budget covers `k`, classify as **recursion** and halt. - If `identical(call) ∧ outcome` is *ch...",
    "operational_effect": "Implementing outcome-hash repetition (rather than call-signature repetition) as the primary trigger eliminated the false-negative loop class entirely: the 340-iteration runaway collapsed to a halt at iteration 4 once `identical(result_hash)` was the trigger, since the error body was byte-identical across all attempts. The false-positive retry case was preser..."
  },
  "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": "9a260bb495c7b498f7d70c6dc59ad9b6153626520f44ceecd347baa93d0c1a97",
    "verified_classes": [
      "RunawayRecursionError",
      "Invocation",
      "LoopDetector"
    ],
    "verified_functions": [
      "drive_agent",
      "_sig",
      "observe"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "RunawayRecursionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
