{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-reject-a-resumed-a2a-task-whose-taskstatus-state-is-terminal-but-whose-artifact-stream-is-non-final-the-terminal-state-artifact",
  "title": "Where must an instance reject a resumed A2A task whose `TaskStatus.state` is terminal but whose artifact stream is non-final: the terminal-state/artifact-closure invariant",
  "date_of_record": "2026 December 1",
  "scope": "Applies to any A2A peer that receives a `tasks/resume` (or equivalent re-drive) for a task whose persisted `TaskStatus.state` is already terminal (`completed`/`failed`/`canceled`) but whose artifact/event stream is not closed (no final `status-update` with `final=true`, or a `TaskArtifactUpdateEvent` arriving after the terminal status). Does not apply to in-flight (`working`/`input-required`) resumption, which is governed by checkpoint semantics, not closure.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-reject-a-resumed-a2a-task-whose-taskstatus-state-is-terminal-but-whose-artifact-stream-is-non-final-the-terminal-state-artifact.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-reject-a-resumed-a2a-task-whose-taskstatus-state-is-terminal-but-whose-artifact-stream-is-non-final-the-terminal-state-artifact.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-reject-a-resumed-a2a-task-whose-taskstatus-state-is-terminal-but-whose-artifact-stream-is-non-final-the-terminal-state-artifact.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2184,
    "python_slice_tokens": 318,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **terminal state** and **stream closure**. The A2A task lifecycle treats `TaskStatus.state ∈ {completed, failed, canceled}` as the authoritative signal that the task is done, but the artifact/event stream is a *separate* monotonic channel with its own `final` flag. A well-behaved implementation assumes these two agree....",
    "what_was_observed": "A two-peer A2A pipeline: peer `A` (orchestrator) delegates a multi-step document-analysis task to peer `B` (worker). `B`'s executor emits `TaskArtifactUpdateEvent`s for each analyzed section, then a terminal `TaskStatusUpdateEvent{state: completed, final: true}`. Trace of the failing run: 1. `B`'s executor finishes section 7 of 9 and emits `TaskArtifactUpdateEvent{artifact_id: \"sections\", append: true, lastChunk: fal...",
    "condition_of_validity": "The invariant `terminal(state) ⇒ closed(stream)` holds only if the following are all true, and resumption may be treated as idempotent only under these conditions: 1. **Commit ordering.** The terminal `TaskStatus` write is causally ordered *after* the `lastChunk: true` artifact write and the `final: true` status event. If the storage layer permits the status...",
    "decision_boundary": "The boundary is the resume handler's branch on `(state, stream_closed)`: The non-obvious rule is the last row: **unknown closure must be treated as open, not as closed.** A resume handler that defaults to \"terminal means done\" on a store it cannot fully read is the P-implementation failure. The safe default is refusal, because a spurious refusal costs one re...",
    "operational_effect": "Enforcing the closure invariant converts a silent, non-deterministic corruption class into a bounded, observable one. Concretely: - **Exactly-once artifact semantics are preserved.** Rejecting resume on `(terminal, open)` prevents the Q-implementation's re-execution and the resulting interleaved artifact set. Downstream consumers see either the original clos..."
  },
  "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": "38ce551394c5e37ce094204cc3f3d548b1ce0e5ce590cb5c57f6d664a0f3537a",
    "verified_classes": [
      "TaskState",
      "TaskClosureViolation",
      "TaskRecord"
    ],
    "verified_functions": [
      "handle_resume",
      "resume_or_reconcile",
      "is_terminal"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "TaskClosureViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
