Repository navigation
fix: settle HarnessAgent telemetry correctly for failed and aborted turns - #21947
Merged
Merged
Conversation
Co-authored-by: doneumark <23178875+doneumark@users.noreply.github.com>
n1ckoates
approved these changes
Oct 2, 2026
Contributor
|
🚀 Published in:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Background
Failed and caller-aborted HarnessAgent turns left OpenTelemetry root and inference spans unfinished because integrations could not correlate terminal telemetry.
Root Cause
The harness lifecycle passed a bare error to onError, provided no abort dispatcher, and routed aborted failures through error handling. The original reproduction confirmed start events occurred while no spans finished.
Summary
Error telemetry now includes callId, abort telemetry includes callId, completed steps, and reason, and runPrompt routes caller aborts through the abort lifecycle. Added a patch changeset for @ai-sdk/harness.
Testing
Added lifecycle regression tests for correlated errors, completed-step abort events, terminal settlement, and runPrompt abort-versus-error telemetry routing.
End-to-end Validation
replay_original_reproduction(pnpm -C examples/ai-functions exec tsx src/reproduction/issue-21936-harness-turn-telemetry.ts) exited successfully and reported that issue@ai-sdk/harnessturn telemetry dispatchesonErrorwithoutcallIdand never dispatchesonAbort#21936 is not present.Related Issues
Fixes #21936
Closes #21940