Skip to content

fix(api): accept bash as a terminal tool alias - #18084

Merged
danielhanchen merged 3 commits into
unslothai:mainfrom
bezabyte:codex/issue-18056-bash-tool-alias
Nov 17, 2026
Merged

danielhanchen merged 3 commits into
unslothai:mainfrom
bezabyte:codex/issue-18056-bash-tool-alias

Conversation

@bezabyte

@bezabyte bezabyte commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Fixes fix(docs): curl guide lists bash as a built-in tool name but the API selects terminal #18056.
  • The curl and Python SDK guides listed bash as an enabled_tools value, but the built-in shell tool is named terminal and built-ins are filtered by exact name, so "enabled_tools": ["bash"] silently dropped the shell tool.
  • bash is now mapped to terminal by a field validator on enabled_tools in ChatCompletionRequest, ChatCountTokensRequest and AnthropicMessagesRequest, so /v1/chat/completions, /v1/messages and token counting all see the canonical name (tool selection, the confirmation gate and sandbox checks included).
  • The tool schema sent to the model and the execution name stay terminal. The docs are corrected separately in unslothai/docs#50.

Verification

  • python -m pytest -q studio/backend/tests/test_full_access_tool_prompt.py (57 passed); the new test fails with the validator reverted (['bash', 'python'] != ['terminal', 'python']).
  • Every backend test file that references enabled_tools (except the live-server test_studio_api.py): 8906 passed, 0 failed.

@danielhanchen danielhanchen self-assigned this Nov 17, 2026
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T06:39:07.896325Z d1e23cd Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: d1e23cd3d0

ℹ️ 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 added a commit that referenced this pull request Nov 17, 2026
… -bf16 check by its new call (10 failures since #18061) (#18110)

`tests/python/test_loader_resolution_reporting.py` has 10 failures on
main in the CPU `studio` shard since #18061 (seen on the staging runs of
#18084 and #18087):

```
unsloth/models/loader.py:1555: in <module>
    if bf16_repo_loads_16bit(model_name, load_in_16bit):
E   NameError: name 'bf16_repo_loads_16bit' is not defined
test_adapter_base_resolution_updates_report_before_base_config_load[*]
E   StopIteration
```

This is the same root cause as #18096, in a second harness that test did
not cover.

## Cause

The test runs slices of the real `from_pretrained` bodies in a
hand-built scope. #18061 moved the inline
`model_name.lower().endswith("-bf16") and (...)` check into
`mapper.bf16_repo_loads_16bit`, which is correct, but:

- the scopes do not define `bf16_repo_loads_16bit`, so 8 cases die with
`NameError`;
- the adapter test found the end of its slice by the `if
model_name.lower().endswith(...)` statement in the `is_peft` block,
which no longer exists, so `next()` raises `StopIteration`.

## Fix

- `_mapper_function` lifts the real `bf16_repo_loads_16bit` out of
`mapper.py` by AST (the file deliberately avoids importing unsloth), and
each scope gets it, so the check runs for real instead of being stubbed.
- `_is_bf16_check` finds the slice end by either form (the helper call
or the old inline check).

## Verification

- main: 10 failed, 2 passed.
- this branch: 12 passed.
@danielhanchen
danielhanchen merged commit 944464c into unslothai:main Nov 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.

fix(docs): curl guide lists bash as a built-in tool name but the API selects terminal

3 participants