Skip to content

feat: remove default per-turn step limit of 1000 - #186

Merged
kermanx merged 2 commits into
mainfrom
feat/unlimited-max-steps-per-turn
May 29, 2026
Merged

feat: remove default per-turn step limit of 1000#186
kermanx merged 2 commits into
mainfrom
feat/unlimited-max-steps-per-turn

Conversation

@kermanx

@kermanx kermanx commented May 29, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

N/A — this is a small behavior change discussed during development.

Problem

The default per-turn step limit of 1000 was hard-coded in "runTurn". In practice, long-running tasks (e.g., large refactors, multi-file edits with many tool calls) frequently hit this ceiling, causing turns to abort with "loop.max_steps_exceeded". Users had to discover and configure "max_steps_per_turn" to work around it.

What changed

  • Removed the "DEFAULT_MAX_STEPS = 1000" constant from "run-turn.ts".
  • Step-limit enforcement now only applies when "maxSteps" is explicitly provided (either via config or direct API call). When omitted, the turn runs without a step cap.
  • Updated documentation (EN/ZH) to reflect that "max_steps_per_turn" now defaults to unset/unlimited instead of 1000.
  • Added a test to verify that omitting "maxSteps" allows a turn to execute multiple tool-use steps without hitting a hidden default limit.

This is a backwards-compatible enhancement: users who already set "max_steps_per_turn" in their config retain their chosen limit.

Checklist

  • I have read the CONTRIBUTING document.
  • I have explained the problem above.
  • I have added tests that prove my feature works.
  • Ran "gen-changesets" skill.

Previously, runTurn enforced a hard-coded default limit of 1000 steps per
turn. This limit was often hit during long-running tasks. Now, when
max_steps_per_turn is not configured, the turn has no step limit.

Users can still set max_steps_per_turn in [loop_control] to enforce a
custom limit if desired.

- run-turn.ts: remove DEFAULT_MAX_STEPS, check maxSteps only when defined
- docs: update default value description for max_steps_per_turn
- tests: add test for omitted maxSteps case
@changeset-bot

changeset-bot Bot commented May 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: acefff5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@moonshot-ai/agent-core Minor
@moonshot-ai/kimi-code Minor
@moonshot-ai/migration-legacy Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented May 29, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@acefff5
npx https://pkg.pr.new/@moonshot-ai/kimi-code@acefff5

commit: acefff5

- maxSteps check now requires maxSteps > 0, so 0 behaves the same as
  omitting the value (unlimited).
- Relax config schema min from 1 to 0 for maxStepsPerTurn.
- Update docs to document the 0-as-unlimited override semantics.
- Replace maxSteps=0 boundary test with one asserting unlimited behavior.
@kermanx
kermanx merged commit 537cf20 into main May 29, 2026
6 checks passed
@kermanx
kermanx deleted the feat/unlimited-max-steps-per-turn branch May 29, 2026 05:11
@github-actions github-actions Bot mentioned this pull request May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant