Skip to content

Route OpenCode yolo aliases to native auto mode - #7187

Merged
danielhanchen merged 5 commits into
unslothai:mainfrom
Imagineer99:fix/opencode-native-auto
Jul 20, 2026
Merged

danielhanchen merged 5 commits into
unslothai:mainfrom
Imagineer99:fix/opencode-native-auto

Conversation

@Imagineer99

Copy link
Copy Markdown
Member

Summary

  • route Unsloth's normalized approval aliases to OpenCode's native --auto mode for the default TUI and run
  • omit the high-priority permission overlay on native-auto launches so OpenCode still enforces explicit deny rules
  • retain the existing config fallback for OpenCode before 1.17.12, utility subcommands that do not accept --auto, and the append-safe bare --no-launch recipe

Why

The current OpenCode integration approximates yolo with explicit allow entries for edit, bash, webfetch, and external_directory. Current OpenCode has a native --auto mode that approves any permission request that is not explicitly denied, so the approximation can still prompt or reject other requests such as doom_loop and protected .env reads.

--auto is command-scoped, so this inserts it only for the TUI/run, before a -- separator. opencode --auto run ... is not equivalent to opencode run --auto ..., so the bare append-safe --no-launch command deliberately keeps the config fallback until the downstream subcommand is known.

The flag is version-gated at 1.17.12, the first OpenCode release containing native auto mode.

Validation

  • negative proof on latest main: the new TUI-resume and run regressions both failed because --auto was absent
  • pytest unsloth_cli/tests/test_start.py -q: 229 passed, 3 skipped
  • broader CLI suite excluding two unrelated frontend-build failures reproduced unchanged on clean main: 482 passed, 3 skipped, 2 deselected
  • ruff check and git diff --check: passed
  • generated TUI, resumed-TUI, run, and global-flag-before-run forms parsed successfully with released OpenCode 1.18.2

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for OpenCode's native --auto CLI flag when running in YOLO mode, replacing the configuration-based permission fallback for supported subcommands. It introduces version detection to ensure the local opencode binary is at least version 1.17.12 before applying the flag, along with argument parsing to correctly place --auto and avoid applying it to unsupported subcommands. Comprehensive unit tests have been added to verify this new behavior, including version gating, argument routing, and fallback scenarios. No review comments were provided, so there is no feedback to address.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@Imagineer99
Imagineer99 marked this pull request as ready for review July 17, 2026 10:32

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 18d73f7360

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread unsloth_cli/commands/start.py Outdated
Comment on lines +175 to +176
"completion acp mcp attach debug providers auth agent upgrade uninstall serve web "
"models stats export import github pr session plugin plug db".split()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add missing OpenCode utility commands to fallback list

When --yolo is used with OpenCode utility commands that are not in this denylist, _opencode_native_auto_args treats the first word as a TUI project path and appends --auto. Current OpenCode registers top-level console and generate commands, while --auto is only defined for the TUI/run, so commands such as unsloth start opencode --yolo --no-launch console login or ... generate now become strict-CLI unknown-argument failures instead of using the config fallback as before.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in dfd3315. Added the hidden console and generate commands to the native-auto denylist, so --yolo now keeps the config permission fallback for them instead of appending --auto to a command OpenCode rejects. Verified against opencode 1.18.3 that both reject --auto and now run cleanly.

Comment on lines +226 to +227
if arg.startswith("-"):
return None

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve yolo behavior for OpenCode --mini

When the passthrough starts the mini interface, e.g. unsloth start opencode --yolo --no-launch --mini, this branch classifies --mini as an auto-capable TUI option, so write_opencode_config is called with yolo=False and the config fallback is omitted. In OpenCode 1.18.x, the TUI --mini path calls runMini(...) without forwarding args.auto, and runMini invokes RunCommand with auto: false, so the appended --auto is ignored and permission prompts are no longer auto-approved for that mode.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in dfd3315. --mini now routes through the config permission fallback, since runMini always runs with auto=false and never forwards --auto, so appending --auto silently disabled auto-approval. The fallback restores it.

Add the hidden console and generate commands to the native-auto denylist so
--yolo does not append --auto to a subcommand OpenCode rejects, and route
--mini through the config permission block since runMini always runs with
auto=false and never forwards --auto.
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: dfd33150f6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: bdb8032eaf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 43557923a7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen danielhanchen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed: routes OpenCode --yolo to native --auto with correct fallback for no-auto commands (console/generate) and --mini. Verified against opencode 1.18.3.

@danielhanchen
danielhanchen merged commit 8fab1c5 into unslothai:main Jul 20, 2026
43 of 44 checks passed
VectorCipher pushed a commit to VectorCipher/unsloth that referenced this pull request Jul 20, 2026
Route --yolo to OpenCode native --auto for the default TUI and run; keep the config permission fallback for no-auto subcommands (including hidden console/generate) and for --mini, which ignores --auto.
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.

2 participants