Skip to content

Commit fe667af

Browse files
committed
fix: sdk max agent steps bug
1 parent 00e8860 commit fe667af

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

common/src/json-config/constants.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ export const FileChangeHook = z
6464
})
6565
.describe('Defines a single file change hook.')
6666

67+
export const DEFAULT_MAX_AGENT_STEPS = 12
68+
6769
export const CodebuffConfigSchema = z
6870
.object({
6971
description: z
@@ -81,7 +83,7 @@ export const CodebuffConfigSchema = z
8183
maxAgentSteps: z
8284
.number()
8385
.optional()
84-
.default(12)
86+
.default(DEFAULT_MAX_AGENT_STEPS)
8587
.describe(
8688
'Maximum number of turns agent will take before being forced to end',
8789
),

sdk/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ All notable changes to the @codebuff/sdk package will be documented in this file
1212

1313
- Automatic parsing of `knowledgeFiles` if not provided
1414

15+
### Fixed
16+
17+
- `maxAgentSteps` resets every run
18+
1519
## [0.1.8] - 2025-08-13
1620

1721
### Added

sdk/src/client.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
type ServerAction,
1212
} from '../../common/src/actions'
1313
import { API_KEY_ENV_VAR } from '../../common/src/constants'
14+
import { DEFAULT_MAX_AGENT_STEPS } from '../../common/src/json-config/constants'
1415

1516
import type { AgentDefinition } from '../../common/src/templates/initial-agents-dir/types/agent-definition'
1617
import type { PrintModeEvent } from '../../common/src/types/print-mode'
@@ -131,7 +132,7 @@ export class CodebuffClient {
131132
projectFiles,
132133
knowledgeFiles,
133134
agentDefinitions,
134-
maxAgentSteps,
135+
maxAgentSteps = DEFAULT_MAX_AGENT_STEPS,
135136
}: {
136137
agent: string
137138
prompt: string
@@ -154,6 +155,7 @@ export class CodebuffClient {
154155
projectFiles,
155156
maxAgentSteps,
156157
})
158+
sessionState.mainAgentState.stepsRemaining = maxAgentSteps
157159
const toolResults = previousRun?.toolResults ?? []
158160
if (handleEvent) {
159161
this.promptIdToHandleEvent[promptId] = handleEvent

0 commit comments

Comments
 (0)