Chat process follow-ups: a mid-stream error raises, .events survives partial reads, bad show_process chokes first - #470
Merged
Conversation
…sults; bad show_process chokes first - ChatStream.events delegated with `yield from`, so a dropped handle (next(stream.events), for ... break) closed the shared run on GC and the rest of the run silently vanished. A plain loop leaves it alone. - _weave filled call_args only past the tool_call visibility guard, so with call lines hidden the standalone result lines never carried the arguments they promise. - show_process is validated before the stream check: an invalid value is refused as such instead of being told to add stream=True and then refused again; the managed lane's duplicate choke goes with it. - Docstring: show_process is not own-model-only. Claude-Session: https://claude.ai/code/session_016M3qaQedSK7L4DwysFRmk2
…r; stream docstring says show_process is on by default
- The managed endpoint reports a server-side failure as a final
{"error": ...} chunk after the partial answer (api.py refunds the
credits, then yields it). Neither chunk decoder looked at it, so
chat(stream=True) and chat_completions(stream=True) in both modes
ended as an apparently complete short answer with no exception. One
guard in each decoder raises PageIndexAPIError; the partial answer
is still delivered first.
- The `stream:` arg and the Returns block still described the pre-PR
contract (bare text chunks); only the show_process paragraph said it
is on by default.
Claude-Session: https://claude.ai/code/session_01PYr9yG1FPQxKCA9m7ECQWY
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.
Review fixes for the chat-process feature (v0.2.13), re-applied on main. They sit on the review view #457 as d5110fb and 82b7558;
chat()was reworked by #460 since, so theclient.pyhunks were merged by hand onto the current wording.A mid-stream error chunk now raises. The managed endpoint reports a server-side failure as a final
{"error": ...}chunk after the partial answer (it refunds the credits, then yields it). Neither SSE decoder incloud_apilooked at it, sochat(stream=True)andchat_completions(stream=True)in both modes ended as a short, apparently complete answer with no exception. One guard in each decoder raisesPageIndexAPIError; the partial answer is still delivered first..eventssurvives partial reads.ChatStream.eventsdelegated withyield from, so a dropped handle (next(stream.events),for ... break) closed the shared run on GC and the rest of the run silently vanished. A plain loop leaves it alone.Hidden call lines still label results.
_weaverecorded a call's arguments only past thetool_callvisibility guard, so with call lines hidden the standalone[tool_result]lines never carried the arguments they promise.A bad
show_processchokes first. The value is validated before the stream check, so an invalid value is refused as such instead of being told to addstream=Trueand then refused again; the managed lane's duplicate choke goes with it.Docs.
stream:and the Returns block sayshow_processis on by default andshow_process=Falsegives the bare answer; theshow_processopener no longer says own-model only.Verification: 475 passed; whole suite with
openai-agentsblocked 369 passed / 106 skipped; pyrightclient.py0, package unchanged (236). The error-chunk test loops all three streaming surfaces and was red before the guard; removing either guard alone fails it.https://claude.ai/code/session_01PYr9yG1FPQxKCA9m7ECQWY