« All posts

When a Local Coding Agent Hits a Context Wall: 13 Failures in 70 Minutes

A local coding agent stalled with 13 straight failures in 70 minutes — not a model problem, but a silent context-window configuration mismatch.

A developer tested whether a fully offline coding agent could build something real, wiring together Ollama, the open-weight Qwen3.8 27B model, and the pi agent CLI on an Apple M1 Pro. The goal: a framework-free Tetris clone in plain HTML/CSS/JS. The first fifteen minutes went smoothly, but the moment the agent tried to write the game engine in one shot, it failed thirteen times in a row over a 70-minute stretch with zero progress.

The cause wasn't model capability — it was a silent configuration mismatch. The agent believed it had a 32,768-token context window, but the Ollama server was being restarted with different OLLAMA_CONTEXT_LENGTH values across the session, at times as low as 8,192. Because the model's architecture didn't support KV cache shifting, hitting the real ceiling mid-generation killed the connection outright, with no error the agent could reason about.

The episode is a concrete reminder that when self-hosting an agent, the context size it thinks it has and the limit the server actually enforces are two independent numbers that nothing checks for agreement. The fix wasn't a model swap or more memory — it was breaking the task into small, explicitly prompted chunks that stayed within the real, working limit.

This synthesis was produced from its source by AI; there is no human editor or manual review step. How we work