Repository navigation
Description
Summary
A follow-up message after a chat turn that read pages or files makes Claude Sonnet 5.5 open its reply by auditing and correcting its own previous answer ("Zu meiner letzten Antwort muss ich etwas korrigieren …", "Zwei Korrekturen zu meiner ersten Antwort …"), and usually fetch the same pages again. The cause is in what the next turn sends: every earlier tool result in the history is cut to 400 characters per string, with a …(+N chars) marker, before the turn is assembled. The model then sees a detailed answer of its own that rests on pages it now only sees the first 400 characters of, and the persona's NO FABRICATION rule tells it to say so.
Reported as "the model keeps saying it needs to correct the previous sentence" (tested with Sonnet 5.5). Reproduced on main 7d7b1ee98 (2026-11-04).
What the code does today (main 7d7b1ee98)
services/platform/lib/chat/context.ts:326-328setsTOOL_RESULT_MAX_STRING = 400,TOOL_RESULT_MAX_ITEMS = 12,TOOL_RESULT_MAX_DEPTH = 8.services/platform/lib/chat/context.ts:351-361(boundMessage) replaces everytool-resultpart's output with its bounded copy;services/platform/lib/shared/utils/bound-json.ts:49-52cuts a long string to its first 400 characters and appends…(+N chars).services/platform/lib/chat/context.ts:376appliesboundMessageto every history message before the budget check at:379, so the cut happens even when the history fits the window (Sonnet 5.5 is listed with 1,000,000 tokens).- Inside one turn the full results are sent:
services/platform/lib/chat/turn.ts:1801-1803appends the round'ssettledPartsunbounded after the boundedcontext.messages. The cut therefore only shows on the next turn. web_fetchreturns up to 20,000 characters per call (services/platform/lib/chat/tools.ts:289-291).- The persona: "NO FABRICATION — never invent facts, figures, or citations. … read it with a tool before asserting it; if you could not read it, say so." (
services/platform/lib/chat/assistant.ts:65-66). - The bound dates back to the 0.5 rewrite (
2743ee48e, feat(platform): rewrite the AI backend on a minimal YAML-config core #2857). No test inservices/platform/lib/chat/context.test.tsnames the 400-character cut of a tool result.
What was observed
Local stack on main 7d7b1ee98, an OpenAI-compatible Bifrost gateway added as a custom provider, a logging proxy between Tale and the gateway (requests recorded, auth header dropped).
What the model received. First turn ("Wie lege ich in Tale einen Projekt-Agenten an? Schau bitte in der Doku nach …"): three web_fetch results of 20,338, 20,411 and 4,892 characters. The follow-up's request carried the same three results as 540, 574 and 540 characters, each ending in …(+19693 chars), …(+19723 chars), …(+4296 chars), followed by the assistant's own 3,438-character answer from the first turn.
What the model did. Same two-turn conversation in fresh threads, follow-up "Danke. Fasse deine letzte Antwort in drei Stichpunkten zusammen." or "Kannst du den Schritt mit den Skills noch genauer erklären?":
| Model (via the gateway) | Effort | Follow-ups | Opened by re-checking / correcting the previous answer | Fetched the pages again |
|---|---|---|---|---|
| Claude Sonnet 5.5 | Default | 4 | 4 | 4 |
| Claude Sonnet 5.5 | High | 1 | 1 | not examined |
| Claude Haiku 5.5 | Default | 2 | 0 | 0 |
| GPT 6.1 Terra | Default | 2 | 0 | 0 |
| Gemini 3.8 Flash | Default | 2 | 0 | 0 |
Examples of the openings (Sonnet 5.5):
Zu meiner letzten Antwort muss ich etwas korrigieren. Die Doku-Seiten wurden mir nur als abgeschnittene Auszüge angezeigt. Ich habe sie nicht vollständig gelesen, und viele Details in meiner Zusammenfassung standen nicht in dem, was ich sah.
Ich habe die Seite jetzt bis Zeichen 20.000 von 24.338 gelesen. … Zwei Korrekturen zu meiner ersten Antwort: …
Ich habe die beiden Seiten jetzt gelesen … Die Angaben aus meiner früheren Antwort stimmen mit der Doku überein. … Es waren aber Aussagen, die ich zu dem Zeitpunkt nicht belegen konnte.
The High-effort reasoning stated the cause directly: "Earlier I described details from the docs, but the fetch output was cut off, so I was claiming things I never actually saw."
A later, unrelated question in the same thread ("Was ist der Unterschied zwischen einem Index und einem Primärschlüssel?") got a plain answer, so the reaction follows questions that touch the earlier answer.
The other models did not react, but they get the same stubs: a follow-up that needs a detail beyond the first 400 characters of a fetched page has to fetch it again or answer without it. That was not measured.
Not examined: knowledge search (rag_search/rag_fetch) results (no embedding model was configured), file and code tool results, other locales, and how often real conversations hit this.
How to reproduce
- Chat with Claude Sonnet 5.5 (any provider): "Wie lege ich in Tale einen Projekt-Agenten an? Schau bitte in der Doku nach und fasse die Schritte zusammen."
- After the answer: "Danke. Fasse deine letzte Antwort in drei Stichpunkten zusammen."
- The reply opens by re-reading or correcting the previous answer and calls
web_fetchagain.
Constraints
- The bound exists so one verbose payload cannot flood the window (
services/platform/lib/chat/context.ts:330-336); dropping it without a replacement brings that back for long threads. - The context's stable prefix is cached (
context.ts, cache breakpoint); changing what the history holds per turn affects cache hits and cost. - The persona rule against fabrication is wanted; the issue is that the history makes a truthful earlier answer look unsupported.
Options (no preference)
- Keep earlier tool results whole while the history fits the window, and bound them only when
fitHistoryactually has to make room (oldest first). - Keep the most recent turn's tool results whole and bound older ones.
- Replace an old tool result with a short note that says it was shortened for space after it had been read in full, so the model does not infer that it never saw it.
- Drop old tool calls and results from the history altogether and keep the answers (and, if wanted, the list of sources), since the answer already carries what was used.
- Store a model-written digest of each tool result and send that instead of a prefix cut.
Questions
- Which tool results must stay whole for a follow-up to work (web pages, knowledge passages, file reads)?
- Should the fix be measured with a two-turn test that fails when the model sees a cut result next to its own answer?
Related
- Epic: one agent engine for chat and tasks — what is still separate #4879 (one agent engine for chat and tasks): task runs on the shared engine call the same
executeTurn(services/platform/backend/domains/tasks/native-turn.ts:548); whether their history carries earlier tool results was not examined.
Activity
fix(platform): keep earlier tool results whole while the history fits
fix(platform): keep earlier tool results whole while the history fits