Skip to content

Expose crash-recovery outcome provenance for native recording consumers #6769

Closed

Description

@simonrosenberg

During the bounded investigation for OpenHands/dataset-utils#466, one source in the 2,000-source pilot contained a restart-recovery AgentErrorEvent followed by a late ObservationEvent for the same action and tool call.

The SDK already defines the correct LLM view: the first observation-like outcome wins. The persisted raw log retains both outcomes, and the recovery event uses the same generic error class and classification as other internal failures. A native recording consumer currently has to duplicate view selection and recognize the recovery error's English text to produce an auditable canonical recording.

Please expose machine-readable crash-recovery provenance and canonical outcome selection for raw-recording consumers. A recovery subtype or structured reason plus a read-only projection/disposition contract would let capture/export code preserve both original events while identifying the late completion as outside the agent-visible view.

The minimal sequence is: persist an in-flight action; reload a RUNNING conversation so recovery emits its error; receive the original tool's late completion. No source identities or private payloads are needed to reproduce it.

Current implementation and existing coverage:

The dataset fix keeps the first outcome and relocates the late completion's exact bytes into an auditable sidecar member of a new archive, with input/output hashes. Structured upstream provenance would remove the dependency on matching an error string and prevent future capture/export implementations from independently guessing this policy.


OpenHands AI triage

The following comments and acceptance criteria were added by the OpenHands AI agent.

Triage

The SDK's crash-recovery path already emits an AgentErrorEvent for an interrupted in-flight tool call, and the LLM view already keeps the first observation-like outcome per tool_call_id (ObservationUniquenessProperty, covered by the existing restart/late-completion test from #3051). The gap is provenance for raw-recording consumers: the recovery event is distinguishable from other internal failures only by its English error text, so capture/export tooling must duplicate the first-outcome policy and string-match the message (as the dataset-utils#466 investigation demonstrated on real captured data).

Bounded scope: expose machine-readable restart-recovery provenance on the crash-recovery AgentErrorEvent, and provide a read-only disposition surface that identifies, for a raw event sequence, which observation-like outcome is canonical (the one the LLM view keeps) and which outcomes are outside the agent-visible view. The provenance must be additive to the event schema and flow through existing serialization (REST/WebSocket) without new endpoints.

Non-goals: no change to which outcome the LLM view keeps (first outcome wins is already correct and tested); no mutation, rewriting, or removal of persisted events; no change to the downstream dataset-utils archive/sidecar format; no new FailureKind values or changes to the existing ErrorClassification vocabulary; no recovery semantics for non-restart error paths; no new REST endpoints or client-mirroring beyond what existing serialization already produces.

Priority rationale: priority:medium — the scenario occurred in real captured data during the linked 2,000-source pilot and forced downstream duplication of SDK policy with a fragile English-text dependency; it is not priority:high because no user-facing failure or data loss occurred and the downstream workaround already functions.

Acceptance Criteria

  • Given a raw event sequence reproducing the minimal scenario (in-flight action persisted, conversation reloaded in RUNNING status so recovery emits its error, then the original tool's late completion for the same tool_call_id), the recovery AgentErrorEvent carries structured, machine-readable restart-recovery provenance that identifies it without matching the English error text.
  • A read-only disposition surface applied to the full raw event sequence reports, for each affected tool call, which observation-like event is canonical and which are outside the agent-visible view, and its canonical selection agrees with the SDK's LLM view for the same sequence.
  • On sequences without recovery duplicates (ordinary observations, user rejections, and other internal agent errors), the disposition reports the single outcome as canonical and reports no out-of-view outcomes.
  • The disposition surface and provenance are read-only: no event, persisted log, or live view is mutated by consuming them.
  • Existing AgentErrorEvent payloads serialized without the provenance metadata continue to load and round-trip through the real event serialization path, and events carrying the metadata survive round-trip and appear in events served by the existing agent-server event retrieval paths.
  • The recovery event's classification remains INTERNAL and non-retryable; recoverability is distinguishable solely via the new provenance metadata, with no dependency on error-message wording.
  • The provenance metadata carries no tool payloads, prompts, outputs, or source identities — consistent with the privacy-safe failure-metadata contract.
  • The provenance and canonical-outcome disposition contract are documented for recording consumers.
  • Unit tests under the mirrored tests/sdk/ paths cover recovery-event identification via metadata, disposition agreement with the LLM view, and loading of old payloads without the metadata; the existing restart/late-completion test still passes.

Activity

  1. added
    priority:medium
    ready-for-dev
    on Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:mediumready-for-dev

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions