fix: enforce max turns from claude args (#1607)

This commit is contained in:
ulofiai
2026-08-07 07:55:06 -07:00
committed by GitHub
parent 1623c36729
commit 6ef6450f51
4 changed files with 111 additions and 1 deletions
@@ -521,6 +521,31 @@ describe("parseSdkOptions", () => {
});
});
describe("max turns handling", () => {
test("should map --max-turns from claudeArgs to sdkOptions.maxTurns", () => {
const options: ClaudeOptions = {
claudeArgs: "--max-turns 60",
};
const result = parseSdkOptions(options);
expect(result.sdkOptions.maxTurns).toBe(60);
expect(result.sdkOptions.extraArgs?.["max-turns"]).toBeUndefined();
});
test("should prefer the direct maxTurns option", () => {
const options: ClaudeOptions = {
maxTurns: "25",
claudeArgs: "--max-turns 60",
};
const result = parseSdkOptions(options);
expect(result.sdkOptions.maxTurns).toBe(25);
expect(result.sdkOptions.extraArgs?.["max-turns"]).toBeUndefined();
});
});
describe("environment variables passthrough", () => {
test("should include OTEL environment variables in sdkOptions.env", () => {
// Set up test environment variables