Repository navigation
Description
Problem
Maka currently caps every turn at 50 steps, even when the caller did not request a limit.
In a live CLI session, the model reached exactly 50 tool calls while it was still editing code. The runtime stopped the turn and recorded it as completed. No warning appeared because the model had already emitted text earlier in the turn.
The task was incomplete, but the UI looked as if the model had chosen to stop.
A hidden step budget is the wrong boundary for interactive work. Normal long-running work should be allowed to continue. Callers that need a fixed budget can set one explicitly.
Proposed behavior
Remove the default step limit.
When maxSteps is not configured, do not pass a step-based stopWhen condition to the model loop.
Keep explicit limits for:
maka run --max-steps;- programmatic runtime callers;
- Harbor and benchmark profiles.
When an explicit limit is reached while the model requests another tool call:
- emit
step_limitinstead ofend_turn; - preserve that reason in session storage, runtime events, replay, and
InvocationResult; - make one final model call with tools disabled, asking it to summarize completed and unfinished work;
- if that call fails or returns no text, show a fixed notice explaining that the task may be incomplete and can be continued with a new message.
The warning must appear even if the model emitted text earlier in the turn.
TUI and Desktop should return to their existing composer. This issue does not add a Continue button or automatically start another turn.
maka run should return non-zero for step_limit and must not treat the summary as successful final output.
Runaway behavior
This issue does not replace the step limit with another default timeout or cost limit.
Maka already blocks repeated identical failing tool calls through its loop gate. There is no evidence of a broader doom-loop problem today. More general loop detection should be considered separately if real traces show a need for it.
Automation that needs a hard boundary should set --max-steps or --timeout explicitly.
Acceptance criteria
- Turns have no step limit unless the caller configures one.
- The model loop omits step-based
stopWhenwhenmaxStepsis absent. - CLI, programmatic, Harbor, and benchmark callers can still set explicit limits.
- Reaching an explicit limit produces
step_limit, notend_turn. step_limitsurvives persistence and replay.- A tool-disabled final call summarizes the current state.
- A fixed notice is used if that call fails or returns no text.
- Earlier assistant text does not suppress the warning.
maka runreturns non-zero and does not report successful final output.- TUI and Desktop reuse their current composer.
- Existing loop-gate behavior does not change.
- Tests cover unlimited default behavior, explicit limits, fallback, persistence, CLI exit behavior, and interactive rendering.
Implementation split
Implement this issue through two serial, independent PRs.
1. #760
Remove the default step limit.
- Make
maxStepsoptional through the runtime and model adapter. - Omit step-based
stopWhenwhen no limit is configured. - Keep explicit limits for CLI, programmatic, Harbor, and benchmark callers.
- Test unlimited default behavior and explicit overrides.
This PR does not add step_limit or change product rendering.
2. #761
Start from the latest main after #760 merges.
- Add the
step_limitterminal reason across runtime events, persistence, replay, andInvocationResult. - Run one tool-disabled finalization request when an explicit limit is reached.
- Fall back to a fixed notice if finalization fails or returns no text.
- Return non-zero from
maka run. - Reuse the existing TUI and Desktop composer.
- Cover runtime, persistence, CLI, and interactive behavior.
Do not split the second PR by package. The terminal contract and its product behavior must ship together.
Out of scope
- Removing explicit
maxStepssupport. - Adding a default turn timeout or cost limit.
- Dynamic step budgets.
- General doom-loop detection.
- Automatic continuation.
- New TUI or Desktop controls.
- Changes to Harbor continuation behavior.
Activity
[-]fix(runtime): report step limits instead of silently completing[/-][+]fix(runtime): remove the default step limit and report explicit limits[/+]Astro-Han commentedon Jul 12, 2026
Completed by #760 / #763 and #761 / #766.
The implementation intentionally differs from the original finalization proposal: when an explicit step limit is reached, the runtime reports the turn as incomplete directly instead of making an additional tool-disabled model call. This keeps the stop reason explicit and avoids extra model work or a potentially confusing synthetic summary.