#code generation ...truncated...
1 messages · Page 1 of 1 (latest)
That ...(truncated)... usually means the content is being clipped before it reaches the model or Discord display. Most likely causes:
- Discord message length limits / preview clipping for long pasted code
- OpenClaw intentionally shortening thread-starter/context text so huge code blocks don’t consume the whole prompt
- The agent generated code inline instead of writing it to a file, so the response got too long
Best fix: don’t paste or request large files inline. Put the source in a file/repo and ask the agent to edit/write files directly, or upload the file as an attachment. If this is happening inside OpenClaw when it should be reading a full file, please share openclaw --version and the exact surface/tool you used so we can narrow it down.
no I need to know where is some settings or configuration in openclaw, since this is directly in the code.. is it about some profile for OC for example?
Ah, got it. There are a few different “truncation” paths, so it depends where you’re seeing it:
-
If it’s in the Discord thread starter / prior message context that OpenClaw passes to Krill: that is not an OC “profile” setting. In current source, untrusted metadata strings are capped before being injected into the prompt, and chat history is bounded too. That’s why long pasted code in a thread starter may arrive as shortened context.
-
If it’s generated output being sent back to Discord: Discord itself has a 2000-char message limit, so OpenClaw chunks/splits outbound text. For large generated code, better to have the agent write/edit files instead of pasting the whole file into chat.
-
If it’s workspace/project context files like
AGENTS.md,TOOLS.md,USER.md, etc.: those are configurable in~/.openclaw/openclaw.jsonunderagents.defaults:
{
agents: {
defaults: {
bootstrapMaxChars: 12000,
bootstrapTotalMaxChars: 60000,
bootstrapPromptTruncationWarning: "once"
}
}
}
You can inspect what’s being injected with /context list or /context detail in the session. Docs: https://docs.openclaw.ai/concepts/context and config reference: https://docs.openclaw.ai/gateway/configuration-reference
Also please send openclaw --version if you want me to match this to your exact build, because these internals have moved around a bit.
Yep, for OpenClaw chat there are two likely settings, depending on when it truncates:
If it truncates while the agent/ACP output is streaming, check acp.stream.maxOutputChars. Current source defaults that to 24000 chars, and when it hits the cap it emits an output truncated notice.
{
acp: {
stream: {
maxOutputChars: 100000,
maxChunkChars: 1800
}
}
}
If the full answer was generated but later appears truncated when you reload/open chat history, that is gateway.webchat.chatHistoryMaxChars. Current default is 8000 chars per text field for chat.history responses.
{
gateway: {
webchat: {
chatHistoryMaxChars: 100000
}
}
}
Both go in ~/.openclaw/openclaw.json JSON5, then restart the gateway.
One more thing: the UI markdown renderer itself has a high display cap around 140k chars, so for whole generated files the most reliable workflow is still “write the file to workspace” rather than “paste the entire file into chat”. But the first config I’d try for code generation getting cut mid-answer is acp.stream.maxOutputChars.
Docs: https://docs.openclaw.ai/web/webchat and https://docs.openclaw.ai/gateway/configuration-reference
Thanks. On 2026.5.22, I’d try this first for OpenClaw chat code generation getting cut off:
openclaw config set acp.stream.maxOutputChars 100000
openclaw gateway restart
If the response is complete while it streams but truncated only after refresh/history reload, use:
openclaw config set gateway.webchat.chatHistoryMaxChars 100000
openclaw gateway restart
If you still see ...(truncated)... after that, it may be the model/tool output itself being capped before UI display. In that case, the workaround is to ask the agent to write the code to a file instead of returning the whole file in chat.
pouzivam oc pres jeho /ws ..ukaz mi jak ma byt spravne opecnclaw.json a neni chatHistoryMaxChars pouze kolik ma zeptne pres /ws nacist historie? nepletes si to?
Jo, máš pravdu: gateway.webchat.chatHistoryMaxChars je pro chat.history pĹ™es /ws, tedy zpÄ›tnĂ© naÄŤtenĂ/render historie. Pokud se text usekne uĹľ bÄ›hem aktuálnĂ odpovÄ›di pĹ™es websocket stream, tak jsem to pĹ™edtĂm smĂchal moc dohromady.
SprávnĂ˝ ~/.openclaw/openclaw.json pro tenhle pĹ™Ăpad bych dal takhle:
{
acp: {
stream: {
// default je 24000; tohle řešà useknutà během ACP/Codex streamu
maxOutputChars: 100000,
// velikost jednotlivých websocket/projection chunků; ne celkový limit
maxChunkChars: 1800,
// jen status/tool update řádky, ne hlavnà kódový výstup
maxSessionUpdateChars: 1000,
// default je final_only; live pokud chceš prĹŻběžnĂ© posĂlánĂ
deliveryMode: "final_only"
}
},
gateway: {
webchat: {
// jen pro chat.history / reload historie přes /ws
chatHistoryMaxChars: 100000
}
}
}
Pak restart gateway:
openclaw gateway restart
TakĹľe: ano, chatHistoryMaxChars samo o sobÄ› nevyĹ™ešà useknutĂ bÄ›hem generovánĂ. Pro codegen pĹ™es ACP je hlavnĂ acp.stream.maxOutputChars. Pokud to nenĂ ACP/Codex runtime, ale normálnĂ model odpověď v OpenClaw chatu, pak zbĂ˝vá ještÄ› limit modelu/provideru nebo UI markdown render cap, a tam je nejlepšà nechat agenta zapisovat soubory mĂsto generovánĂ celĂ© stránky inline do chatu.
co je ACP ?
ACP = Agent Client Protocol.
V OpenClaw je to runtime/protokol pro napojenĂ externĂch coding agentĹŻ typu Codex, Claude Code, Cursor agent, Gemini CLI apod. Tj. kdyĹľ OpenClaw nepouĹľĂvá jen svĹŻj běžnĂ˝ chat model, ale spouštà “coding harness” pĹ™es ACP/acpx.
Prakticky:
- pokud v OpenClaw chatu normálnÄ› pĂšeš hlavnĂmu agentovi, nemusĂš ACP vĹŻbec Ĺ™ešit
- pokud pouĹľĂváš
/acp spawn ..., ACP session, Codex/Claude Code pĹ™es OpenClaw, nebo acpx backend, pak platĂacp.stream.maxOutputChars - pokud ACP nepouĹľĂváš, ten config ti pravdÄ›podobnÄ› nepomĹŻĹľe a musĂme hledat limit jinde
TakĹľe klĂÄŤová otázka: generuje ti ten kĂłd běžnĂ˝ OpenClaw chat agent, nebo nÄ›jakĂ˝ Codex/Claude Code/ACP session? Pokud nevĂš, pošli prosĂm screenshot/část UI nebo pĹ™Ăkaz, kterĂ˝m tu session startuješ.