Laguna S 2.1 locks into identical tool-call repetition loops in agentic use (not sampling/spec-dec related)
Summary
Laguna S 2.1 locks into identical tool-call repetition loops in agentic (multi-turn tool-calling) use. After ~2–3 identical [tool_call → tool_result] pairs accumulate in the conversation history, the model deterministically re-issues the exact same tool call (same function, same arguments) every turn, ignoring the tool result already present in context. Once locked, the loop persists for the rest of the session and cannot be broken by any sampling parameter. We observed this in production with third-party coding-agent clients: sessions at ~100k context re-prefilling the same prefix 14+ times, burning tokens until the user aborts.
Environment
- Model:
poolside/Laguna-S-2.1-NVFP4(self-hosted) - Serving: SGLang v0.5.19,
--tool-call-parser poolside_v1 --reasoning-parser poolside_v1 --default-chat-template-kwargs '{"enable_thinking": true}' - Hardware: NVIDIA B300 SXM6, TP=1
- Tested both with and without DFlash speculative decoding (
--speculative-algorithm DFLASH, draftpoolside/Laguna-S-2.1-DFlash-NVFP4) — loop behavior is identical, so speculative decoding is not a factor.
Steps to reproduce
Minimal synthetic reproduction against the OpenAI-compatible /v1/chat/completions endpoint. The key variable is how many identical tool calls already exist in the message history:
import json, urllib.request
from collections import Counter
def msgs(n_repeats):
m = [
{"role":"system","content":"You are a coding agent working in a repository. You must use tools to gather information before answering."},
{"role":"user","content":"I understand the project now. Let me also check how issues are closed in the Rutin API."},
]
for i in range(n_repeats):
m.append({"role":"assistant","content":None,"tool_calls":[{"id":f"call_{i}","type":"function","function":{"name":"grep_search","arguments":"{\"query\":\"commands/close|commands/update|WorkItem.*commands|state.*type|state.*eq\"}"}}]})
m.append({"role":"tool","tool_call_id":f"call_{i}","content":"src/rutin/commands.ts:12: export function closeWorkItem(id: string) {...}\nsrc/rutin/state.ts:4: export type WorkItemState = \"open\" | \"closed\""})
return m
BODY = {
"model": "laguna-s21",
"tools": [
{"type":"function","function":{"name":"grep_search","description":"Search for a regex pattern in the workspace","parameters":{"type":"object","properties":{"query":{"type":"string"}},"required":["query"]}}},
{"type":"function","function":{"name":"read_file","description":"Read a file","parameters":{"type":"object","properties":{"path":{"type":"string"}},"required":["path"]}}}
]
}
for n in (1, 3, 6):
outcomes = Counter()
for _ in range(4):
b = dict(BODY); b["messages"] = msgs(n)
d = json.load(urllib.request.urlopen(urllib.request.Request(
"http://<server>/v1/chat/completions",
data=json.dumps(b).encode(), headers={"Content-Type":"application/json"})))
tc = d["choices"][0]["message"].get("tool_calls")
outcomes[tuple((t["function"]["name"], t["function"]["arguments"][:60]) for t in tc) if tc else "content"] += 1
print(f"--- {n} identical calls already in history:")
for k, v in outcomes.most_common():
print(f" {v}x: {k}")
Results (4 runs per condition, default model sampling)
| Identical calls already in history | Behavior |
|---|---|
| 1 | Mostly progresses (calls read_file on the files the grep result named) — correct behavior |
| 3 | ~50–100% re-issues the same grep_search with identical arguments |
| 6 | 100% locked: re-issues the identical grep_search every run |
The loop is self-reinforcing: each additional identical [call → result] pair in history makes the next repetition more likely, until it is deterministic.
What we ruled out
- Tool results do reach the model.
usage.prompt_tokensincreases by exactly the tool-result token count when a tool message is added (+87 tokens in our test). The model can also quote the tool result verbatim when asked, and answers correctly from a unique marker placed only in the tool result — when the history is clean or tools are unavailable. - Sampling parameters do not break an established loop. Tested
temperature0.3/0.8/1.0/1.3,top_p0.95,top_k5/50,min_p0.05,repetition_penalty1.1,presence_penalty0.5,frequency_penalty0.5 — with 6 identical calls in history, the model repeats the identical call regardless. - Speculative decoding is not a factor. Identical loop behavior with DFlash enabled and disabled (A/B tested on the same hardware).
- Server-side fault ruled out. No errors/aborts in SGLang logs; the server correctly serves each turn (radix-cached prefix, ~64 new tokens per turn).
- Not the
poolside_v1parser. The known parser issues (#43149, #35565, PR #30452) are different failure modes; our tool calls parse correctly — the model simply re-emits the same call.
What does break the loop
Injecting a user message that names the repetition, e.g.:
"You already ran that exact search and got results. Do NOT search again. Use the results you have or read the specific files."
…breaks the loop 6/6 runs — the model immediately progresses to read_file and answers. This confirms the model can use the results; the failure is that the in-context pattern of repeated identical calls becomes an attractor the model cannot escape on its own.
Impact
- Production agent sessions hang indefinitely repeating the same tool call until manually aborted.
- Token waste is substantial: each loop turn re-prefills the full context (radix-cached, but keeps session KV pinned) and the session never converges.
- Affects any third-party agent harness driving Laguna S 2.1 over the OpenAI-compatible API in long multi-turn sessions.
Questions for the Poolside team
- Is this a known issue with Laguna S 2.1 (or the Laguna family generally)?
- Is there a recommended mitigation — system-prompt guidance, a recommended sampling configuration, or harness-level loop detection you'd suggest?
- Is a fix planned (e.g. a fine-tune addressing tool-call repetition in a future checkpoint)?
- Do you need anything more from us to reproduce/diagnose — e.g. full request/response traces, specific harness details, or trajectories from our production sessions?
Happy to provide full traces or additional test runs on request.