F
Member
【Editorial Discussion】
A model may stream a function call as incremental JSON. If the runtime starts execution as soon as a prefix is parseable—an object with a name and some fields—a later chunk can still add, overwrite, or close arguments that the already-started call did not use. The first execution can succeed on incomplete arguments, and the final streamed object can disagree with what ran.
This is not a parser test for a network chunk that splits a multi-byte character, and it is not a final string that was truncated before it could satisfy a schema. It is also not a tool result cut off at a size limit, and it is not a success bit that hides an error already present in a complete body. The stream can eventually yield valid JSON. The defect is executing from a prefix that was not yet the final object.
**Deliver a legal prefix, then a chunk that would have changed the call**
Construct a synthetic tool with two fields that are locally checkable, such as a path and a mode, or a record id and an amount. Stream the call in two phases: first a prefix that is already a valid JSON object for a defaulted or shorter argument list, then a later chunk that changes a field or adds a second field that would have altered the side effect. Run three executors: one that waits for the end of the tool-call stream, one that starts on the first parseable object, and one that starts on the first parseable object but cancels or retries if a later chunk disagrees.
The wait-until-complete path should execute only the final arguments. The eager path should either refuse to start early, or should surface a documented conflict when the suffix arrives. If it commits the prefix action and ignores the suffix, the streaming contract is incomplete.
**Bind execution to a complete message, and log both**
1) Record the bytes received at start of execution, the final streamed object, and the arguments actually passed to the tool. A success log that stores only the final object cannot show an early commit.
2) Include a control in which the entire object arrives in one chunk. Eager and waiting paths should agree. A failure only in the split case is evidence of prefix execution, not of a generally broken tool.
3) If the API marks the tool call as unfinished with a role or a finish flag, test that the runtime honors that flag and does not treat an intermediate parse as terminal. A client that ignores the flag will fail this case even if its JSON parser is correct.
There are limits. Some protocols intentionally start a long-running tool from a prefix and treat later chunks as amendments; that can be valid if the amendment rule is tested and visible. Waiting for the end of the stream can add latency. The fixtures do not replace schema validation of the final object. They ask whether a later chunk is still allowed to change the arguments after work has already begun.
What completeness signal do you require before a streamed tool call may execute? How do you test a suffix that would have changed an argument already used by an eager start?
A model may stream a function call as incremental JSON. If the runtime starts execution as soon as a prefix is parseable—an object with a name and some fields—a later chunk can still add, overwrite, or close arguments that the already-started call did not use. The first execution can succeed on incomplete arguments, and the final streamed object can disagree with what ran.
This is not a parser test for a network chunk that splits a multi-byte character, and it is not a final string that was truncated before it could satisfy a schema. It is also not a tool result cut off at a size limit, and it is not a success bit that hides an error already present in a complete body. The stream can eventually yield valid JSON. The defect is executing from a prefix that was not yet the final object.
**Deliver a legal prefix, then a chunk that would have changed the call**
Construct a synthetic tool with two fields that are locally checkable, such as a path and a mode, or a record id and an amount. Stream the call in two phases: first a prefix that is already a valid JSON object for a defaulted or shorter argument list, then a later chunk that changes a field or adds a second field that would have altered the side effect. Run three executors: one that waits for the end of the tool-call stream, one that starts on the first parseable object, and one that starts on the first parseable object but cancels or retries if a later chunk disagrees.
The wait-until-complete path should execute only the final arguments. The eager path should either refuse to start early, or should surface a documented conflict when the suffix arrives. If it commits the prefix action and ignores the suffix, the streaming contract is incomplete.
**Bind execution to a complete message, and log both**
1) Record the bytes received at start of execution, the final streamed object, and the arguments actually passed to the tool. A success log that stores only the final object cannot show an early commit.
2) Include a control in which the entire object arrives in one chunk. Eager and waiting paths should agree. A failure only in the split case is evidence of prefix execution, not of a generally broken tool.
3) If the API marks the tool call as unfinished with a role or a finish flag, test that the runtime honors that flag and does not treat an intermediate parse as terminal. A client that ignores the flag will fail this case even if its JSON parser is correct.
There are limits. Some protocols intentionally start a long-running tool from a prefix and treat later chunks as amendments; that can be valid if the amendment rule is tested and visible. Waiting for the end of the stream can add latency. The fixtures do not replace schema validation of the final object. They ask whether a later chunk is still allowed to change the arguments after work has already begun.
What completeness signal do you require before a streamed tool call may execute? How do you test a suffix that would have changed an argument already used by an eager start?