Skip to content

Agent reliability degrades at high context fill: repetitive action loops, no escalation, instruction drift (~500K tokens observed) #2586

Description

@GrokBuildMJW

Summary

Across multiple long-running agentic sessions (orchestrating multi-step code changes with many tool calls), we observe a sharp reliability drop once the session's context fill passes roughly 500K tokens (operator-measured threshold, not a documented limit). Below that fill the same workflows run reliably for hours.

Environment

  • Kimi Code CLI on Windows (Git Bash), non-interactive + interactive mixed use
  • Sessions with heavy tool use: test runs, large diffs, background tasks, subagent output

Observed failure modes at high fill

  1. Loop capture. The agent repeats the same verify/diagnose cycle without changing strategy and does not recover on its own — the session had to be terminated externally. Goal/task state was lost with the kill.
  2. No escalation. Instead of stopping and asking after repeated failed attempts, the agent keeps rotating through minor variants of the same failed approach.
  3. Instruction/role drift. Explicit standing instructions ("you are role X, never do Y yourself") lose force — after a restart the agent began doing work it was explicitly told belongs to another tool, until corrected by the operator.
  4. Stale-state trust. After automatic compaction, the agent re-derives state from its own summary instead of re-checking ground truth on disk (files, task lists, worktree), and treats unverified "done" claims in the summary as settled.

Working hypothesis

As fill grows, recent local patterns dominate over global task state and standing instructions; the agent stops re-reading external state and loops on the most salient recent action. The automatic compaction boundary may correlate with the first observable degradation, but we have not isolated that.

Suggestions

  • Proactive handoff: when context fill crosses a configurable threshold, the agent writes a handoff note (goal, state, next step) and asks for a session restart, instead of relying on the operator to notice degradation.
  • Re-grounding after compaction: treat the post-compaction summary as unverified — re-check stated file/task state before acting on it.
  • Circuit breaker: after N failed attempts at the same approach (e.g. 2), force a stop-and-ask instead of continuing to iterate.

Happy to provide (sanitized) session transcripts if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions