Claude Code Output Truncated by Context Window
A long agent reply gets cut off mid-sentence under context pressure. Usually compaction, max_tokens cap, or runaway tool output eating the budget.
Articles tagged with #agent
A long agent reply gets cut off mid-sentence under context pressure. Usually compaction, max_tokens cap, or runaway tool output eating the budget.
Your Task/Agent subagent completed cleanly, but the main session shows nothing or a wrong summary. Usually a final-message format, context-window, or thread-routing issue.
Agent mode keeps running shell commands without the confirm prompt, even when you flipped the toggle off. Usually allowlist scope, stale settings, or a workspace override. Fix it.
Codex hits conflict markers and either stops, picks the wrong side, or hand-edits the markers into the file. Pre-rebase setup.sh and explicit AGENTS.md rules fix it.
Codex edits package.json but never ran npm install, so package-lock.json diverges. How to enforce lockfile updates via setup.sh, CI, and AGENTS.md.
Codex defines a fresh User or ApiResponse type when an identical one lives elsewhere. How to make the agent search first via AGENTS.md, indexes, and ts-morph.
Codex ran git commit --amend or interactive rebase from an old README, rewriting shared history. How to lock the agent to forward-only commits.
Codex emits a one-line PR body with no detail. How to force a structured description with before/after, why, and test plan via templates and AGENTS.md.
Codex reports green tests but the failing cases were filtered out, marked .skip, or bailed early. How to force honest test reporting before merge.
Codex hits a context or token cap mid-task and stops with a partial diff. How to scope tasks smaller, split across PRs, or move to a larger-context model.
Codex outputs API patterns deprecated years ago because its training data is dated. How to lock it to modern APIs via AGENTS.md, ESLint deprecation rules, and reference docs.
Claude Computer Use keeps clicking the same button or field over and over without progressing — usually a screenshot diff, focus state, or coordinate drift problem. Here is how to break the loop.
Every Bash, Edit, Read asks for permission again even after you allowed the same tool — settings.json scope wrong, allowlist pattern too narrow, or hook is re-asking.
Single task burns 200K+ tokens, hits the context ceiling mid-execution, and forces a summarize. Decompose the task, use sub-agents, or scope reads tighter.
Bash command runs forever, the agent waits forever — no timeout set means a hung process locks the whole session. Set timeouts, detect hangs, kill cleanly.
Codex writes a file, Prettier reformats it on save, and now the diff is huge. Fix by running Prettier inside the agent loop and aligning agent style hints to your .prettierrc.
On 500k+ line codebases Codex loses track halfway. Fix by scoping the working set, using directory summaries, and forcing the agent to read AGENTS.md before scanning.
Codex silently skips PNGs, PDFs, sqlite DBs, compiled artifacts. The fix is allowlisting text extensions, hashing binaries instead of reading, and giving Codex a binary-aware tool.
Codex re-reads the same file 8 times and re-greps the same query 5 times. Fix by pre-feeding context, requiring a plan first, and capping reads via tool restrictions.
Codex halts halfway through a multi-step task with no visible failure — usually a context window, sandbox timeout, or stop-condition issue. Diagnose by checking the last tool call and turn budget.