You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bound nesting of model tool-call output in ToolCallParsingUtils.encodeArguments #1111
Follow-up from #1093, section 2. This was there before #1105, which bounds only schema conversion.
As reported in #1093, tool-call model output with about 5,000 nested brackets overflows the Dart stack in ToolCallParsingUtils.encodeArguments. The recursive jsonEncode/jsonDecode path throws StackOverflowError instead of a LlamaException. The output is model-controlled, so a recursive schema such as a $ref tree, or a lazy/auto grammar, can produce it.
Proposed: check nesting depth with the iterative jsonValueDepth helper (lib/src/core/grammar/json_value_depth.dart, added in #1105) before encoding. Alternatively, catch the overflow at the parse boundary and report a LlamaInferenceException (malformed tool call), on both the final and partial parse paths. Add a regression test with nested output on VM and Chrome.
Activity