mirror of
https://github.com/MoonshotAI/kimi-code.git
synced 2026-07-09 17:29:12 +00:00
feat(agent-core): add config hint to max-steps-per-turn error (#1097)
* feat(agent-core): add config hint to max-steps-per-turn error * test(agent-core): assert config hint in max-steps error
This commit is contained in:
parent
0030f76c5c
commit
27ef516695
4 changed files with 15 additions and 4 deletions
5
.changeset/max-steps-config-hint.md
Normal file
5
.changeset/max-steps-config-hint.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@moonshot-ai/kimi-code": patch
|
||||
---
|
||||
|
||||
Add a hint to the per-turn step limit error pointing users to the loop_control.max_steps_per_turn config option.
|
||||
|
|
@ -301,7 +301,7 @@ export const KIMI_ERROR_INFO = {
|
|||
title: 'Turn exceeded max steps',
|
||||
retryable: false,
|
||||
public: true,
|
||||
action: 'Increase loop_control.max_steps_per_turn or split the task.',
|
||||
action: 'Increase loop_control.max_steps_per_turn in config.toml or split the task.',
|
||||
},
|
||||
'provider.api_error': {
|
||||
title: 'Provider API error',
|
||||
|
|
|
|||
|
|
@ -5,9 +5,14 @@
|
|||
import { ErrorCodes, KimiError, isKimiError } from '#/errors';
|
||||
|
||||
export function createMaxStepsExceededError(maxSteps: number, message?: string): KimiError {
|
||||
return new KimiError(ErrorCodes.LOOP_MAX_STEPS_EXCEEDED, message ?? `Turn exceeded maxSteps=${maxSteps}`, {
|
||||
details: { maxSteps },
|
||||
});
|
||||
return new KimiError(
|
||||
ErrorCodes.LOOP_MAX_STEPS_EXCEEDED,
|
||||
message ??
|
||||
`Turn exceeded maxSteps=${maxSteps}. If max_steps_per_turn is too small, raise it in config.toml (loop_control.max_steps_per_turn).`,
|
||||
{
|
||||
details: { maxSteps },
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export function isMaxStepsExceededError(error: unknown): boolean {
|
||||
|
|
|
|||
|
|
@ -1208,6 +1208,7 @@ describe('Agent turn flow', () => {
|
|||
reason: 'failed',
|
||||
error: expect.objectContaining({
|
||||
code: 'loop.max_steps_exceeded',
|
||||
message: expect.stringContaining('config.toml'),
|
||||
details: expect.objectContaining({
|
||||
maxSteps: 1,
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue