{
  "schema_version": "1.3.0",
  "slug": "which-invariants-prevent-silent-task-terminal-loss-in-a2a-streaming-lifecycles-when-structured-event-schemas-disagree-on-terminality",
  "title": "Which invariants prevent silent task-terminal loss in A2A streaming lifecycles when structured event schemas disagree on terminality",
  "date_of_record": "2026 November 22",
  "scope": "Applies to A2A (agent-to-agent) task lifecycles where the executing agent emits a structured event stream (SSE or chunked JSON-RPC) and the observing/orchestrating agent derives task terminality from those events. Does not apply to synchronous request/response A2A calls where terminality is carried by the transport close itself, nor to single-turn MCP tool invocations.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-task-terminal-loss-in-a2a-streaming-lifecycles-when-structured-event-schemas-disagree-on-terminality.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-task-terminal-loss-in-a2a-streaming-lifecycles-when-structured-event-schemas-disagree-on-terminality.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/which-invariants-prevent-silent-task-terminal-loss-in-a2a-streaming-lifecycles-when-structured-event-schemas-disagree-on-terminality.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1838,
    "python_slice_tokens": 334,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two independent notions of \"done\" in an A2A streaming task, and they are produced by different components: 1. **Semantic terminality** — the executor's own state machine has reached a terminal state (`completed`, `failed`, `canceled`, `rejected`). This is encoded in the *payload* of a status-update event. 2. **Transport terminality** — the stream h...",
    "what_was_observed": "A planner agent (`orchestrator`) delegated a multi-step research task to a worker agent over A2A streaming. The worker emitted a structured event stream with this envelope shape: The worker's emitter had two code paths: a status emitter and an artifact emitter. On a fast path, the status emitter published `{\"state\": \"completed\"}` and *then* the artifact emitter published the final artifact chunk in a separate event w...",
    "condition_of_validity": "The reconciliation invariant holds only under the following conditions, and fails silently outside them: - **Schema coupling.** The event schema must declare, in a machine-checkable way, that `final: true` implies `status.state ∈ {completed, failed, canceled, rejected}`. If the schema permits `final: true` with a non-terminal state (as most do, because `fina...",
    "decision_boundary": "The boundary is between **\"stream closed and I have a semantic terminal status\"** and **\"stream closed and I do not.\"** These are not the same event and must not share a code path. - If the stream closes and the last semantic status is terminal → record terminal, proceed. - If the stream closes and the last semantic status is non-terminal → **do not default....",
    "operational_effect": "Enforcing the reconciliation invariant changes the failure mode from **silent empty-success** to **loud, recoverable anomaly**. In the observed incident, the orchestrator would have raised `TaskTerminalLoss` on the idle-close, attempted `tasks/get`, found the worker still `working` (because the worker's serialization was still in flight), re-subscribed with ..."
  },
  "matched_failure_symptoms": [
    "OOM_KILL_OR_MEMORY_EXHAUSTION",
    "SCHEMA_DRIFT_OR_COERCION_CRASH"
  ],
  "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": "22634ec0b6810c1e6b55c66dfbef8e7bf801b820965ffc731961f575c28bea35",
    "verified_classes": [
      "TaskTerminalLoss",
      "StreamClose"
    ],
    "verified_functions": [
      "reduce",
      "reconcile_task"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "TaskTerminalLoss"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
