MoonshotAI / MoonshotAI/kimi-code
Goal mode: no-op continuation turns fire indefinitely while waiting on external conditions, burning tokens and context
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
Bug description
In goal mode, when the agent is waiting on an external condition it cannot accelerate (e.g. a long-running remote training job, or a GPU becoming free on a shared server), goal continuation turns fire every few seconds indefinitely. Each turn:
- re-injects the full goal-mode system reminder together with the complete (long) objective into the model's context, and
- produces a no-op assistant reply ("waiting, no action this turn") since nothing changed.
In a single session today this produced 160+ continuation turns in ~3 hours (turns 10 through 160+ of the goal). Each round-trip carries the full reminder + objective (~1-2k tokens), so >200k tokens were spent on no-ops, and the context window filled with hundreds of duplicated reminders, crowding out the actual work history.
Version
kimi-cli 0.28.0 (kimi --version)
Reproduction
- Create a goal whose completion depends on waiting for an external long-running job (e.g.
/goalwith an objective that includes running a several-hours training job on a remote machine and evaluating afterwards). - Let the agent reach the point where the only remaining action is to wait (job submitted, running remotely).
- Observe the session: continuation turns fire every few seconds, each re-emitting the full system-reminder + objective, with the model replying no-ops.
Expected behavior
Some form of pacing for continuation turns when nothing has changed, e.g.:
- Exponential backoff / debounce between consecutive continuation turns that produced no tool calls or state changes (e.g. 1m -> 5m -> 15m cap), or
- Compact reminders: emit the full goal-mode reminder only on the first continuation turn; subsequent turns get a one-line pointer, or
- An explicit wait primitive: let the agent declare "sleep until time T or event X" and have the runtime honor it instead of polling via model turns.
Actual behavior
Unbounded rapid-fire continuation turns with full reminders, each consuming model tokens and permanent context space.
Impact
- Direct token cost (hundreds of thousands of tokens for a single wait).
- Context-window pressure: the repeated reminders displace genuine conversation/tool history, which can degrade the agent's later decisions in the same session.
- UI noise: the transcript shows dozens of identical "no-op" turns, making the session hard to review (this is how the issue was noticed in practice).
Workaround used
The agent resorted to server-side watchers (nohup scripts on the remote host) and background Bash sleep tasks to avoid needing continuation turns at all — but the runtime still keeps firing them.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing goal-mode continuation scheduling from the /goal reproduction, focusing on how no-op turns are detected and how the full reminder and objective are re-injected. Compare consecutive turns with no tool calls or state changes; done means continuation no longer polls indefinitely at full frequency and waiting sessions avoid unbounded duplicate context, with the chosen behavior covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ai, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100