Skip to content

Fix Code tool placement for ChatGPT subscriptions - #11628

Merged
wasimysaid merged 7 commits into
unslothai:mainfrom
lorenzozanee:fix/codex-local-code-tools
Sep 23, 2026
Merged

wasimysaid merged 7 commits into
unslothai:mainfrom
lorenzozanee:fix/codex-local-code-tools

Conversation

@lorenzozanee

@lorenzozanee lorenzozanee commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Treat ChatGPT/Codex subscription models as using Unsloth's local Code tools, so the Code toggle exposes Python, Terminal, and edit_file instead of an unavailable hosted code_execution tool.

Focused frontend and backend regression tests pass.

Fixes #11557

Before / after

ChatGPT subscription connection, model gpt-5.6-sol, only Code on, prompt "Use Python to compute 6*7". Left is main (ffa4ff6f9), right is this PR. On main the request asks for code_execution, Codex is offered no tools and the model answers without running anything. With the PR the request carries python, terminal, edit_file, the model calls Python and the card shows 42. The Codex upstream is stubbed identically on both sides; Studio, its tool loop and the Python run are real.

before and after

before and after recording

@danielhanchen

Copy link
Copy Markdown
Member

Confirmed that on main the Code toggle for ChatGPT subscription models requests hosted code_execution, which that connection never runs, so Python and Terminal never reach the model. Thanks for tracking this down, will get this reviewed.

Assert the Codex Code pill resolves to python/terminal/edit_file and stays offered, not only that the hosted sandbox flag is off, and correct the composer comment that named Anthropic as the only hosted code-execution provider.
@Lyxot

Lyxot commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

Pushed 6f25f64ffc on top of the fix, test and comment only:

  • The Codex test now runs the real capability checks through selectCodeToolNames / codeToolCanRun and asserts Code resolves to local python / terminal / edit_file and stays offered. Before, it only asserted the hosted flag was off, so adding openai_codex to the sandbox set would have silently brought [Studio Bug] Code enabled with ChatGPT/Codex but Python and Terminal are not exposed #11557 back with every test green.
  • Corrected the composer comment that called Anthropic the only provider with hosted code execution.

No production behavior change. Both mutations (restoring the removed Codex branch, and adding Codex to the sandbox set) fail exactly this test.

Derive tools.code from the Code placement the request actually sends, so an external connection without a hosted sandbox (ChatGPT/Codex, self-hosted) reports Code as enabled when it sends python/terminal/edit_file.
@danielhanchen danielhanchen self-assigned this Sep 23, 2026
providerSupportsBuiltinCodeExecution and providerHostsCodeExecution must only
claim a provider sandbox where PROVIDER_REGISTRY declares code_execution in
hosted_tools. unslothai#11557 was the per-model check answering true for openai_codex,
which hosts nothing, so Code sent code_execution to a connection that never
runs it. Fails on both the removed Codex branch and on adding openai_codex to
the sandbox set.
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 23, 2026
@danielhanchen

danielhanchen commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Review record for #11628, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#71.

Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found.

Round 1 — reviewed mirror 33288402b1 (this PR's 7c04e5adf)

chatgpt-codex-connector[bot] (on the mirror)

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

Reviewed commit: 33288402b1

No triage reaction was recorded on the mirror

Verdict

The round converged at mirror 33288402b1 (this PR's 7c04e5adf).

This is the review as it stood at that commit. Anything pushed to this PR afterwards was not part of it.

@wasimysaid
wasimysaid merged commit 8d632de into unslothai:main Sep 23, 2026
1 check passed
shimmyshimmer pushed a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Sep 23, 2026
A full tests/studio run on main turned up five more contracts and two Playwright
drivers pinned to spellings those two PRs changed on purpose:

- test_update_release_notes: the update banners are 448px at the default scale, now
  written scale-wrapped; widths are read back through the scale before comparing.
- test_ui_font_scale_contract: the CSS default lives in the fallback of the derived
  --ui-font-scale, and icons scale linearly with it (unslothai#11648 said so), not at half rate.
- test_chat_response_details_ui_contract: response details record Code from the
  placement actually sent, hosted sandbox or local tools (unslothai#11628).
- playwright_chat_ui / playwright_update_banner_layout: --ui-font-scale is now a calc()
  and an unregistered custom property reads back as that text, so float() failed
  ('unreadable --ui-font-scale') and the banner's 'is it scaled' string compare
  could no longer fail. Both resolve the scale through a length instead.
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 23, 2026
…lacement in the studio contracts (unslothai#11673)

* Follow unslothai#11648's UI-scale layout in four studio contract tests

unslothai#11648 merged with Repo tests (CPU, studio) red, and main has failed those four since:

- The Images and Audio rails are now min(408px, 100% - 13rem) at the default scale, so
  the canvas keeps the 13rem its header column reserves. Both pages pin that exact
  expression through a shared RAIL_WIDTH, so they still have to match each other.
- The settings dialog stacks on its own measured width (data-stacked) rather than the
  max-sm viewport breakpoint, which a larger interface scale does not move. The test
  now requires the attribute to be set and the stacking class keyed on it.
- The Thinking caret is 15px at the default scale in either spelling, since the
  composer's lengths are now wrapped in the space scale.

* Cover the rest of unslothai#11648's and unslothai#11628's studio fallout

A full tests/studio run on main turned up five more contracts and two Playwright
drivers pinned to spellings those two PRs changed on purpose:

- test_update_release_notes: the update banners are 448px at the default scale, now
  written scale-wrapped; widths are read back through the scale before comparing.
- test_ui_font_scale_contract: the CSS default lives in the fallback of the derived
  --ui-font-scale, and icons scale linearly with it (unslothai#11648 said so), not at half rate.
- test_chat_response_details_ui_contract: response details record Code from the
  placement actually sent, hosted sandbox or local tools (unslothai#11628).
- playwright_chat_ui / playwright_update_banner_layout: --ui-font-scale is now a calc()
  and an unregistered custom property reads back as that text, so float() failed
  ('unreadable --ui-font-scale') and the banner's 'is it scaled' string compare
  could no longer fail. Both resolve the scale through a length instead.

* Read the Code placement inside buildResponseDetails, not anywhere in the adapter

* Pin the rail's scale wrapper as written, since the default-scale read cannot see it

* Pin the scaled spelling of the Thinking caret and the update notes width

* Read the font-size setter and the stacking attribute where they take effect
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
* fix(studio): route Codex Code to local tools

* test(studio): pin Codex Code placement to local tools

Assert the Codex Code pill resolves to python/terminal/edit_file and stays offered, not only that the hosted sandbox flag is off, and correct the composer comment that named Anthropic as the only hosted code-execution provider.

* fix(studio): record local Code in response details

Derive tools.code from the Code placement the request actually sends, so an external connection without a hosted sandbox (ChatGPT/Codex, self-hosted) reports Code as enabled when it sends python/terminal/edit_file.

* test(studio): pin hosted Code claims to the backend registry

providerSupportsBuiltinCodeExecution and providerHostsCodeExecution must only
claim a provider sandbox where PROVIDER_REGISTRY declares code_execution in
hosted_tools. unslothai#11557 was the per-model check answering true for openai_codex,
which hosts nothing, so Code sent code_execution to a connection that never
runs it. Fails on both the removed Codex branch and on adding openai_codex to
the sandbox set.

* test(studio): tighten registry guard comments

* Add GPT-6 Sol and Luna to ChatGPT subscription models

---------

Co-authored-by: Lyxot <[email protected]>
Co-authored-by: Daniel Han <[email protected]>
Co-authored-by: wasimysaid <[email protected]>
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
…lacement in the studio contracts (unslothai#11673)

* Follow unslothai#11648's UI-scale layout in four studio contract tests

unslothai#11648 merged with Repo tests (CPU, studio) red, and main has failed those four since:

- The Images and Audio rails are now min(408px, 100% - 13rem) at the default scale, so
  the canvas keeps the 13rem its header column reserves. Both pages pin that exact
  expression through a shared RAIL_WIDTH, so they still have to match each other.
- The settings dialog stacks on its own measured width (data-stacked) rather than the
  max-sm viewport breakpoint, which a larger interface scale does not move. The test
  now requires the attribute to be set and the stacking class keyed on it.
- The Thinking caret is 15px at the default scale in either spelling, since the
  composer's lengths are now wrapped in the space scale.

* Cover the rest of unslothai#11648's and unslothai#11628's studio fallout

A full tests/studio run on main turned up five more contracts and two Playwright
drivers pinned to spellings those two PRs changed on purpose:

- test_update_release_notes: the update banners are 448px at the default scale, now
  written scale-wrapped; widths are read back through the scale before comparing.
- test_ui_font_scale_contract: the CSS default lives in the fallback of the derived
  --ui-font-scale, and icons scale linearly with it (unslothai#11648 said so), not at half rate.
- test_chat_response_details_ui_contract: response details record Code from the
  placement actually sent, hosted sandbox or local tools (unslothai#11628).
- playwright_chat_ui / playwright_update_banner_layout: --ui-font-scale is now a calc()
  and an unregistered custom property reads back as that text, so float() failed
  ('unreadable --ui-font-scale') and the banner's 'is it scaled' string compare
  could no longer fail. Both resolve the scale through a length instead.

* Read the Code placement inside buildResponseDetails, not anywhere in the adapter

* Pin the rail's scale wrapper as written, since the default-scale read cannot see it

* Pin the scaled spelling of the Thinking caret and the update notes width

* Read the font-size setter and the stacking attribute where they take effect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Studio Bug] Code enabled with ChatGPT/Codex but Python and Terminal are not exposed

4 participants