Skip to main content

MAX_REPR_DEPTH

Constant MAX_REPR_DEPTH 

Source
pub(super) const MAX_REPR_DEPTH: usize = 16;
Expand description

Maximum recursion depth for stable_repr_inner.

Deeply-nested JSON arguments (e.g. from a hostile tool result fed back into tool arguments) would otherwise cause unbounded stack growth. Values beyond this depth are replaced with the sentinel "...".

Truncation impact on hashing: values deeper than this limit are collapsed to the same sentinel string, meaning structurally distinct deeply-nested arguments will produce identical hashes. This is acceptable because the loop detector is a best-effort guard — a false positive (treating distinct deep arguments as a loop) is safe (it aborts the run), while a false negative cannot occur for shallow arguments which represent the vast majority of real tool calls.