Skip to content

Studio: only offer Agent Skills when Code is on - #12118

Merged
danielhanchen merged 3 commits into
mainfrom
studio-skills-require-code
Sep 28, 2026
Merged

danielhanchen merged 3 commits into
mainfrom
studio-skills-require-code

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

Summary

Agent Skills are discovered from ~/.agents/skills and ~/.claude/skills and are enabled by default. Other tools install skills there, for example hf skills add writes an hf-cli skill whose description asks to be used for anything related to Hugging Face or ML. Any enabled skill opened the Unsloth tool loop with read_skill, so a chat with every composer pill off (Search, Code, MCP, Docs, Artifacts, Research) was still offered a tool, and in Ask mode it kept pausing for approval. This is the behaviour reported in #11671.

Skills are instructions for running code, so they now follow the Code pill. The chat request offers read_skill and create_skill only while Code is on (the Code pill, or Full access where code is implied).

Changes

  • studio/frontend/src/features/chat/api/skill-tools.ts: new skillToolsOffered(skills, codeToolsOn).
  • studio/frontend/src/features/chat/api/chat-adapter.ts: the completion payload and the token-count extras both use it, so the counted prompt still matches the sent one.
  • Tests: tests/skill-tools.test.ts covers the rule, tests/skills-token-count-discovery.test.ts pins both call sites.

Behaviour

Composer pills Skills installed Before After
All off Yes Tool loop opens with read_skill, Ask mode prompts No tools, no prompts
Code on Yes read_skill offered Unchanged
Any No No skill tools Unchanged

No backend change: the backend already drops skill tools that the request does not list in enabled_tools.

Testing

  • New and touched tests: node --experimental-strip-types --test tests/skill-tools.test.ts tests/skills-token-count-discovery.test.ts tests/code-tool-placement.test.ts passes 21/21.
  • Full frontend suite, main vs this branch: 9158/9158 on main, 9159/9160 here. The one failure (tauri-backend-transport-failure.test.ts, a timing ladder) passes 3/3 when rerun alone and is not touched here.
  • tsc -b passes. ESLint on chat-adapter.ts reports the same 16 existing errors on main and on this branch.

Related: #11671, #11787.

Before / after

Studio built from the merge base (left) and from this branch (right). Both have the hf-cli skill that hf skills add installs in ~/.agents/skills, Qwen3-0.6B GGUF loaded, Ask mode, Search and Code off, and the same prompt.

  • Before: the chat run is sent with enable_tools: true and enabled_tools: ["read_skill", "create_skill"], and it stops on an approval prompt for read_skill.
  • After: the chat run is sent with enable_tools: false and the model answers directly.
  • With Code on, both builds send read_skill, create_skill, python, terminal and edit_file.

Before and after: all pills off with the hf-cli skill installed

Skills discovered from ~/.agents/skills and ~/.claude/skills are enabled by
default, so any installed skill opened the tool loop for read_skill even with
every composer pill off, and Ask mode kept pausing for approval (#11671).
Skills are instructions for running code, so the chat request now offers
read_skill and create_skill only while Code is on. The token count follows
the same rule so it matches the sent request.
@danielhanchen danielhanchen self-assigned this Sep 27, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-28T00:45:13.490853Z 24029ad 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.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 27, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex security 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: 24029adb0a

ℹ️ 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 on lines +6151 to +6153
const hasEnabledSkills = skillToolsOffered(
getSkillsSnapshot().skills,
codeToolsEnabled,

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 Skip skill discovery when Code is off

When Code is off, this returns false only after the preceding unconditional settleSkillsForText(...) has completed. An uninitialized or stale skills catalog—especially an unknown @skill mention—can therefore still delay an all-tools-off send by the full 3-second settlement timeout even though no skill tool can enter the payload; buildLocalTokenCountExtras has the same ordering. Guard both settlement calls with the effective Code state so disabling Code also removes this otherwise-unused request-path latency.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Latency only and unchanged by this PR: the settle ran before this change too, and no payload is wrong. Leaving the discovery path as is.

shimmyshimmer pushed a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Sep 28, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 28, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 24029adb0a

ℹ️ 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 pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 28, 2026
@danielhanchen
danielhanchen merged commit dbe2c6f into main Sep 28, 2026
41 of 43 checks passed
@danielhanchen
danielhanchen deleted the studio-skills-require-code branch September 28, 2026 01:11
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
Skills discovered from ~/.agents/skills and ~/.claude/skills are enabled by
default, so any installed skill opened the tool loop for read_skill even with
every composer pill off, and Ask mode kept pausing for approval (unslothai#11671). The
chat request now offers read_skill and create_skill only while Code is on, and
the token count follows the same rule.
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.

1 participant