Skip to content

fix: wire max_turns input through run.ts to SDK#1179

Closed
qozle wants to merge 2 commits intoanthropics:mainfrom
qozle:fix/max-turns-not-wired-in-run-ts
Closed

fix: wire max_turns input through run.ts to SDK#1179
qozle wants to merge 2 commits intoanthropics:mainfrom
qozle:fix/max-turns-not-wired-in-run-ts

Conversation

@qozle
Copy link
Copy Markdown
Contributor

@qozle qozle commented Apr 5, 2026

Problem

run.ts (the tag/run entrypoint) called runClaude() without passing maxTurns, so all runs using this entrypoint silently capped at the SDK default of 10 turns — regardless of any max_turns input or --max-turns in claude_args.

Trace:

  • run.ts:268 calls runClaude(path, { claudeArgs, model, ... })maxTurns missing
  • parse-sdk-options.ts:260 sees maxTurns: undefined → passes undefined to SDK
  • SDK defaults to 10 turns → Reached maximum number of turns (10)

base-action/src/index.ts already passes maxTurns: process.env.INPUT_MAX_TURNS correctly; this brings run.ts into parity.

Changes

  • action.yml: add max_turns input
  • base-action/action.yml: add max_turns input + INPUT_MAX_TURNS env mapping
  • src/entrypoints/run.ts: pass maxTurns: process.env.INPUT_MAX_TURNS to runClaude()

Testing

Set max_turns: 25 in a workflow using the action. Previously the run would terminate at 10 turns with Reached maximum number of turns (10). With this fix the SDK receives maxTurns: 25 and runs to the configured limit.

Fixes #1177

qozle and others added 2 commits April 5, 2026 00:15
…unners

Non-ephemeral self-hosted runners retain ~/.claude state across workflow
runs. On the second run, 'claude plugin marketplace add' exits 1 with
"already installed" and the action fails before any plugins are installed.

Capture stdout/stderr in addMarketplace (mirroring to parent process so
output remains visible), and resolve instead of rejecting when the output
contains "already installed". Any other non-zero exit still propagates as
an error.

Tests: update assertions for the new stdio tuple, add two new cases
covering the idempotent skip and non-matching failure passthrough.

Fixes anthropics#1057.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
run.ts called runClaude() without maxTurns, so all runs using the
tag/run entrypoint silently capped at the SDK default of 10 turns
regardless of any max_turns or --max-turns configuration.

- Add max_turns input to action.yml and base-action/action.yml
- Map INPUT_MAX_TURNS env var in both action.yml run steps
- Pass maxTurns: process.env.INPUT_MAX_TURNS in run.ts runClaude() call

base-action/src/index.ts already passed maxTurns correctly; this
brings run.ts into parity.

Fixes anthropics#1177
@qozle
Copy link
Copy Markdown
Contributor Author

qozle commented Apr 6, 2026

Closing — superseded by #1184 which implements the same fix more minimally (6 lines vs 122).

@qozle qozle closed this Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

max_turns is never passed to SDK in run.ts, defaults to 10

1 participant