Skip to content

Dispatch tool calls at first completed JSON object#1428

Merged
frdel merged 2 commits intoagent0ai:readyfrom
3clyp50:dirtyjson
Apr 3, 2026
Merged

Dispatch tool calls at first completed JSON object#1428
frdel merged 2 commits intoagent0ai:readyfrom
3clyp50:dirtyjson

Conversation

@3clyp50
Copy link
Copy Markdown
Contributor

@3clyp50 3clyp50 commented Apr 3, 2026

This updates streamed tool-call handling so execution no longer waits for the full assistant stream once the top-level JSON object is complete.

It tightens DirtyJson completion semantics, extracts and freezes the first completed object as the canonical tool request, stops the model stream early for dispatch, and adds focused regression tests for parser completion and early-stop behavior.

3clyp50 added 2 commits April 3, 2026 15:45
Track parsing depth via _pop_stack() helper. Exposes a 'completed' flag that signals when the root JSON structure is fully closed, allowing stream consumers to break early instead of waiting for irrelevant tokens.
Tool execution no longer waits for the full streamed assistant text. We now detect the first explicitly closed top-level JSON object, freeze that snapshot as the canonical tool request, and stop the model stream there for dispatch.

To make that safe, DirtyJson completion semantics are tightened so completed=true only means the root object was explicitly closed, not that parsing hit end of file. I also restricted the new extraction path to object roots only, since tool calls are always brace-delimited objects, and added tests for parser completion and early stream stop.
@3clyp50 3clyp50 changed the title add completion detection to DirtyJson parser Dispatch tool calls at first completed JSON object Apr 3, 2026
@frdel frdel merged commit 2da4416 into agent0ai:ready Apr 3, 2026
@3clyp50 3clyp50 deleted the dirtyjson branch April 12, 2026 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants