Repository navigation
fix(transport,loop): Stop records turn.aborted; keep non-streamed tool narration - #19
Merged
Merged
Conversation
…l narration
- conversation transport: an explicit Stop / client disconnect (LoopError
cause 'caller-abort') finalizes with turn.abort {reason} instead of
turn.fail, on both the authority and sink-only paths. Envelope code,
ledger settle code and session accounting are unchanged.
- ExecutionAuthority.finalizeOwned accepts kind 'turn.abort' (+ reason)
and counts turn.aborted as a written terminal.
- loop: a hop that streamed nothing but returns text beside its tool calls
emits that text once as a delta (block start/delta/end before the
calls) - previously a non-streaming provider's narration never reached
the durable log. Streamed hops and final answers are unchanged.
Tests: Stop -> turn.aborted on both paths, provider failure stays
turn.failed, non-streamed narration lands once and before its call,
streamed narration is not duplicated (10 source mutations, all caught).
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.
Two fixes found while porting the Lionidas agent chat (Lionidas #131).
1. A Stop is recorded as
turn.aborted, notturn.failedBefore this change, the conversation transport recorded every caught error as
turn.fail, including an explicit Stop (POST …/abort) or a client disconnect. Readers therefore showed "turn N failed: aborted by caller".turn.abortedwas only ever written on the ACP path.caller-abort, the transport now finalizes withturn.abort {reason}. This applies to both the authority path and the sink-only path.ExecutionAuthority.finalizeOwnedacceptskind: 'turn.abort'(+reason) and countsturn.abortedas a written terminal.code: 'ABORTED'), the ledger settle code, session accounting (an abort still sets the session toerror, per the existing regression guard), and the queue drain after the turn.2. Text written beside tool calls by a non-streaming provider is kept
A non-streaming provider (
openai-compat) returns its narration ("Looking at the case library first.") only as message content next totool_calls. Nothing streamed, so no delta or block reached the durable log, and the text was lost from replays.turn.completed.answer).Tests
tscclean; 316 passed (313 existing + 3 new), 5 skipped.turn.aborted {reason: 'aborted by caller'}on both paths; a provider failure staysturn.failed; non-streamed narration lands once and before its tool call; streamed narration is not duplicated.Lionidas re-pins to this branch in a follow-up PR. Lionidas already renders
turn.abortedas "stopped", so it needs no code change.