Expand description
Hashing the answers a tool-call batch received, for equality alone.
super::LoopDetector decides whether a repeat is a strike by asking
whether the answer changed, and two callers have to ask it the same way:
the agent loop, which holds ToolResults it produced itself, and the
proxy, which reconstructs the pairing from a replayed transcript. The
rule — pair each call with its own answer, sort the pairs, hash — lives
here so there is one of it. The sourcing stays with each caller, because
that is where they genuinely differ: the proxy has to bound itself to the
contiguous run of role: "tool" messages after an assistant turn, which
is a wire-format concern the agent loop does not have.
§Why DefaultHasher and not the fnv1a_64 next door
Equality is the only property used. These values are compared within one
process, never persisted, never sent, and never shown to anyone —
AgentError::LoopDetected carries the signature, which is FNV-1a hex, and
is a different thing. DefaultHasher is unspecified across Rust releases,
which would matter if any of that were untrue and does not. Keeping it is
also what makes moving this code out of gglib-proxy provably behaviour
preserving rather than merely intended to be.
Functions§
- batch_
results_ hash - Hash the answers to one batch of tool calls.
- hash_
result_ content - Hash one answer’s content, whatever shape it arrived in.
- hash_
result_ text - Hash one answer’s text.