Skip to content

feat(cli): add max-turns flag to run command#13717

Closed
galatolofederico wants to merge 2 commits into
anomalyco:devfrom
galatolofederico:maxturns
Closed

feat(cli): add max-turns flag to run command#13717
galatolofederico wants to merge 2 commits into
anomalyco:devfrom
galatolofederico:maxturns

Conversation

@galatolofederico

Copy link
Copy Markdown

What does this PR do?

Closes #9869
Adds a --max-turns argument to the run command. Does not count subagents turns.

How did you verify your code works?

Test without --max-turns argument

➜  bun dev -- run  "Find the secret cheat code hidden in this repo. Read one file at a time"
$ bun run --cwd packages/opencode --conditions=browser src/index.ts run "Find the secret cheat code hidden in this repo. Read one file at a time"

> build · k2p5

I'll help you find the secret cheat code. Let me start by exploring the repository structure.

→ Read .
✱ Grep "cheat|secret|hidden|code" in . · 2027 matches
→ Read README.md

$ find /var/home/federico/Misc/opencode-maxturns/packages/opencode -type f -name "*.ts" -o -name "*.js" -o -name "*.json" -o -name "*.md" | head -50
(omissis)

→ Read AGENTS.md
✱ Grep "cheat" in . · 0 matches
✱ Grep "konami|upupdowndown|easter.egg|hidden.*code" in . · 0 matches

$ grep -r -i "secret\|password\|key\|hidden\|code" /var/home/federico/Misc/opencode-maxturns/packages/opencode/src --include="*.ts" --include="*.js" | grep -v "node_modules" | head -20
(omissis)

$ find /var/home/federico/Misc/opencode-maxturns/packages/opencode -name "*secret*" -o -name "*cheat*" -o -name "*hidden*" -o -name "*easter*" 2>/dev/null
→ Read test/tool/read.test.ts
[ ... and so on agent never stops ]

Test with --max-turns 1 argument

➜  bun dev -- run --max-turns 1  "Find the secret cheat code hidden in this repo. Read one file at a time"
$ bun run --cwd packages/opencode --conditions=browser src/index.ts run --max-turns "1" "Find the secret cheat code hidden in this repo. Read one file at a time"

> build · k2p5

I'll help you find the secret cheat code! Let me start by exploring the repository structure.

→ Read .
!  maximum turns of 1 reached, stopping session
error: script "dev" exited with code 1

Test with --max-turns 3 argument

➜  bun dev -- run --max-turns 3  "Find the secret cheat code hidden in this repo. Read one file at a time"
$ bun run --cwd packages/opencode --conditions=browser src/index.ts run --max-turns "3" "Find the secret cheat code hidden in this repo. Read one file at a time"

> build · k2p5

I'll help you find the secret cheat code. Let me start by exploring the repository structure.

→ Read .
→ Read README.md
→ Read package.json
!  maximum turns of 3 reached, stopping session
error: script "dev" exited with code 1

@github-actions

Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.

@github-actions github-actions Bot closed this Apr 17, 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.

[FEATURE]: CLI option --max-turns

1 participant