feat(core,server,docs): default max_turns to -1 (unlimited) to avoid unexpected run cutoffs (#232)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Yaowei Zheng
2026-08-07 18:53:03 +08:00
committed by GitHub
parent 4a899a265f
commit 6e1c7cc28e
12 changed files with 80 additions and 22 deletions
+5 -3
View File
@@ -479,7 +479,7 @@ describe("ContextEngine ReAct loop (mock LLM, approve callback)", () => {
expect(deniedMsg).toBeDefined();
});
it("max_turns default is 100", () => {
it("engine maxTurns fallback is -1 (unlimited) when the option is omitted (direct SDK construction)", () => {
const engine = new ContextEngine({
llm: new FakeLLM(),
environment: new Environment({
@@ -487,8 +487,10 @@ describe("ContextEngine ReAct loop (mock LLM, approve callback)", () => {
toolConfig: execCommandToolConfig(),
}),
});
// Reads the default via a private field (white-box, only testing the default).
expect((engine as unknown as { maxTurns: number }).maxTurns).toBe(100);
// Reads the fallback via a private field (white-box, only testing the fallback). The
// SDK-construction fallback for an omitted option now matches the agent-config default
// (defaultSystemConfig().max_turns, asserted in state.test.ts): -1 = no turn cap.
expect((engine as unknown as { maxTurns: number }).maxTurns).toBe(-1);
});
it("streams the max-turns stop note before the complete text (no extra leading newline)", async () => {