Skip to content

unsloth start/run: tool-call flags, positional model, and grouped help - #7328

Merged
danielhanchen merged 6 commits into
mainfrom
unsloth-tool-call-flags
Jul 23, 2026
Merged

danielhanchen merged 6 commits into
mainfrom
unsloth-tool-call-flags

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Exposes the existing tool-call controls as first-class CLI flags on both unsloth run and unsloth start, adds positional model detection with a GGUF quant default, and groups --help into panels so it is readable.

Tool-call flags

unsloth run gains:

  • --enable-tool-call-healing/--disable-tool-call-healing (default on): promote text-form tool calls (small GGUFs often emit <tool_call>...) back into structured calls on the client-tool passthrough. Disable is an absolute server kill-switch.
  • --enable-tool-call-nudging/--disable-tool-call-nudging (default on): on the non-streaming client-tool passthrough, retry once with a short nudge when a tool signal cannot be healed. No effect on streaming requests or the server-side agentic loop.

unsloth start gains:

  • --enable-tools/--disable-tools (default off, so the agent's own tools are relayed unchanged).
  • the same healing/nudging flags (default on).

These map to the controls that already existed (UNSLOTH_DISABLE_TOOL_CALL_HEALING, UNSLOTH_TOOL_CALL_NUDGE, and set_tool_policy); no new competing env vars are introduced. run resolves them before any re-exec and writes the env so the in-venv server reads them at import; an omitted flag respects a value the parent already set. start conveys its choice to the auto-started run via the child env plus the tools flag, which stays correct even if run re-execs into an older Studio venv. The flags apply only when start auto-starts the server; a pre-existing server is reused unchanged (same as --model).

Positional model + quant default

unsloth start claude unsloth/gemma-4-E2B-it-GGUF:UD-Q4_K_XL now works without --model: a leading org/name(:variant) token routes to --model. Only the first token is considered and only when --model is absent, so an option value like --profile owner/repo and ordinary agent passthrough args (e.g. --continue) are never stolen; paths, flags and Windows drives are ignored.

A bare GGUF repo with no variant defaults its quant: UD-Q4_K_XL for the unsloth namespace, Q4_K_M elsewhere. This is applied only on the fresh auto-serve path, so attaching to an already-loaded model never triggers a reload.

Help formatting

--help for both commands is grouped into rich panels (Model / Server / Agent session for start; Model / Server and network / Tool calls / Advanced for run) instead of one long unaligned list.

Testing

python -m pytest unsloth_cli/tests/test_start.py unsloth_cli/tests/test_studio_run_parallel_flag.py unsloth_cli/tests/test_studio_run_short_alias_clashes.py -> 413 passed. New cases cover the positional/quant helpers, the _start_studio_server command-and-env forwarding, the auto-serve quant default, and the run env resolution (default, explicit disable, and respecting an inherited value).

Expose the existing tool-call controls as first-class CLI flags on both
unsloth run and unsloth start, add positional model detection with a GGUF
quant default, and group --help into rich panels.

Flags (unsloth run): --enable-tool-call-healing/--disable-tool-call-healing
(default on), --enable-tool-call-nudging/--disable-tool-call-nudging
(default on). Resolved before any re-exec and written to the existing env
controls (UNSLOTH_DISABLE_TOOL_CALL_HEALING, UNSLOTH_TOOL_CALL_NUDGE) so the
in-venv server reads them at import; an omitted flag respects a value the
parent already set.

Flags (unsloth start): --enable-tools/--disable-tools (default off, passthrough),
plus the same healing/nudging flags (default on). start conveys them to the
auto-started run via the child env and the tools flag, so it stays correct even
if run re-execs into an older Studio venv.

Positional model: a leading org/name(:variant) token routes to --model when
--model is absent, without stealing an option value or an agent passthrough arg.
A bare GGUF repo with no variant defaults to UD-Q4_K_XL for the unsloth namespace
and Q4_K_M elsewhere, applied only on the fresh auto-serve path so attaching to a
loaded model never reloads.

Help is grouped into rich panels (Model / Server / Session for start; Model /
Server and network / Tool calls / Advanced for run) so --help reads cleanly.

Adds unit coverage for the helpers, the start command-and-env forwarding, the
positional/quant defaulting, and the run env resolution.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@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: 33e91ca482

ℹ️ 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 Resolved
…not stolen

Route a bare org/name positional to --model only when it resolves as a hub id
(via the existing _is_hub_model_id, which rejects local paths and existing
dirs), so an OpenCode project dir like owner/repo is left for the agent. Apply
the same guard to the auto-serve GGUF quant default so a local -GGUF path is
not forced to a quant it may not contain.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@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: c9469d01ad

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread unsloth_cli/commands/start.py Resolved
Comment thread unsloth_cli/commands/start.py Resolved
Comment thread unsloth_cli/commands/start.py Resolved
…t inherited tool-call env

- Require typer>=0.12.0. The rich_help_panel options added here crash at import
  on typer<0.6, and the dependency was previously unbounded.
- Stop forcing a default GGUF quant for a bare org/name-GGUF on auto-serve. The
  server's own quant preference already picks UD-Q4_K_XL for Unsloth uploads and
  Q4_K_M otherwise, and falls back when that exact quant is missing, so forcing a
  fixed variant broke external repos that only publish Q5_K_M/Q8_0.
- Make the healing/nudging start flags tri-state so an omitted flag keeps an
  operator's inherited UNSLOTH_DISABLE_TOOL_CALL_HEALING / UNSLOTH_TOOL_CALL_NUDGE
  instead of overwriting it with the start defaults.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 9b606015aa

ℹ️ 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".

@oobabooga

Copy link
Copy Markdown
Member
  • No follow-up changes were needed for this PR.
  • The existing implementation already handles the positional model, grouped help, explicit tool-call flags, and inherited tool-call environment correctly.
  • The PR was kept unchanged and used as the first step in the combined integration tests.

@oobabooga

Copy link
Copy Markdown
Member

@codex review

@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: 9b606015aa

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread unsloth_cli/commands/start.py Resolved
Comment thread pyproject.toml Resolved
@oobabooga

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 60e06c49dd

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 4fedb51 into main Jul 23, 2026
65 of 69 checks passed
@danielhanchen
danielhanchen deleted the unsloth-tool-call-flags branch July 23, 2026 08:45
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