{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-refuse-to-emit-a-parent-agent-turn-span-when-a-child-tool-call-span-crosses-a-genai-semantic-convention-attribute-b",
  "title": "In what scenarios must an instance refuse to emit a parent agent-turn span when a child tool-call span crosses a GenAI semantic-convention attribute boundary mid-turn",
  "date_of_record": "2026 November 29",
  "scope": "Applies to any agent runtime that emits OpenTelemetry spans conforming to the GenAI semantic conventions (`gen_ai.*`) where a single logical agent turn spawns child tool-call spans, and where attribute values are resolved lazily at span-end rather than at span-start. Does not apply to runtimes that materialize the full attribute set at span creation and freeze it, nor to single-shot tool invocations with no enclosing agent-turn span.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-refuse-to-emit-a-parent-agent-turn-span-when-a-child-tool-call-span-crosses-a-genai-semantic-convention-attribute-b.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-refuse-to-emit-a-parent-agent-turn-span-when-a-child-tool-call-span-crosses-a-genai-semantic-convention-attribute-b.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-refuse-to-emit-a-parent-agent-turn-span-when-a-child-tool-call-span-crosses-a-genai-semantic-convention-attribute-b.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1915,
    "python_slice_tokens": 476,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"telemetry is missing.\" It is the specific case where an **agent-turn span** (`gen_ai.operation.name = \"invoke_agent\"`) is forced to close *after* one of its child **tool-call spans** has already committed an attribute value that contradicts a value the parent is now obligated to write. The GenAI conventions define `gen_ai.usage.input_toke...",
    "what_was_observed": "A three-step agent turn: (1) `invoke_agent` opens, (2) a `execute_tool` child span opens for a retrieval call, closes with `gen_ai.tool.name=\"vector_search\"`, `gen_ai.tool.call.id=\"tc_7f3a\"`, and (3) a second `execute_tool` child span opens for a calculator, closes with `gen_ai.tool.call.id=\"tc_9b21\"`. Between step 2 and step 3, the model's context window saturated; the runtime compacted history, which re-ran the ret...",
    "condition_of_validity": "The refusal is valid **if and only if** all of the following hold: 1. The runtime resolves `gen_ai.usage.*` on the parent at span-end (cumulative), not at span-start (incremental). 2. At least one child tool-call span has already been exported (or queued for export) with a `gen_ai.tool.call.id` and a token count that is *not* a partition of the parent's fina...",
    "decision_boundary": "The boundary is between **\"emit a parent that is honest but schema-incomplete\"** and **\"refuse the parent, keep the children.\"** The deciding test is whether a downstream consumer that sums children and compares to parent would be *misled* by the parent's presence. If the parent's cumulative total exceeds the children's sum by an amount that the consumer's t...",
    "operational_effect": "Refusing the parent changes the trace's shape from \"one turn, N children\" to \"N orphaned children plus one aborted-turn marker.\" This is a deliberate trade: the trace becomes *less queryable* (no single span to aggregate by `gen_ai.agent.turn.id`) but *more truthful* (no span asserts a token total the children cannot back). Consumers that key on `invoke_agen..."
  },
  "matched_failure_symptoms": [
    "SUBPROCESS_PIPE_HANG_OR_FD_LEAK"
  ],
  "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": "81b424858a37725ee83e369ddfb4ee1c39c64ed7b7a5bb2ef374c9258f148925",
    "verified_classes": [
      "ParentSpanBoundaryViolation",
      "ChildSpan",
      "AgentTurn"
    ],
    "verified_functions": [
      "_slack",
      "emit_parent_or_refuse",
      "safe_emit"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "ParentSpanBoundaryViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "time",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
