Skip to content

Studio: Skills pill stays with every skill unticked; its X or the + menu turns Skills off - #13687

Merged
shimmyshimmer merged 4 commits into
mainfrom
studio-skills-pill-switch
Oct 14, 2026
Merged

shimmyshimmer merged 4 commits into
mainfrom
studio-skills-pill-switch

Conversation

@shimmyshimmer

@shimmyshimmer shimmyshimmer commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Summary

Unticking the last skill in the composer's Skills pill removed the pill from the toolbar, so there was no way back without going through the + menu's Manage skills dialog. Skills now has its own on/off switch, the way MCP does.

  • The Skills pill stays while Skills is on, even with every skill unticked. It greys out in that state, since nothing would run.
  • Hovering the pill's icon turns it into an X; clicking the X turns Skills off and hides the pill, without opening its menu. The rest of the pill still opens the skill list and Manage skills.
  • The + menu's Skills item is now an on/off toggle with a tick, in both composers, like MCP.
  • With Skills off, the chat adapter offers no skill tools (read_skill / create_skill), whatever is ticked.
  • Ticking a skill turns Skills back on, wherever it is ticked: the pill, Manage skills, or Settings.
  • Existing installs keep their behaviour. The switch (unsloth_chat_skills_on) is unset until first used, and unset follows whether any skill is ticked, exactly as before. Any skill change first pins an unset switch to its current value, so unticking or deleting the last skill on an existing install keeps the pill too. Reset to defaults returns the switch to unset.
  • While Skills is off, typing @ no longer offers skills in either composer, since no skill would load.

Verification

  • npm run typecheck, npm test (12076 pass), npm run build. New: skills-switch-pin.test.ts runs the real skills API against a stubbed server for the untick, reset and bulk paths (the reset case fails on the earlier commit), plus pill, + menu, adapter and mention-gate checks in skills-composer-pill.test.ts.
  • Staging on Ubuntu, macOS and Windows: the PR's 19 tests pass on each, and the Studio Playwright smoke passes.
  • An isolated Studio driven with Playwright: Skills on from the + menu shows the pill; ticking then unticking a skill keeps it (greyed); hovering shows the X; clicking the X removes the pill without opening the menu; the + menu then shows Skills unticked; the choice survives a reload; the + menu turns it off again. On an install that never used the switch, unticking its only ticked skill hid the pill before the fix and keeps it after.

Not tested here: a model call with Skills off (no model loads on this CPU host). The request side is covered by the adapter change and its test.

Screenshots

Skills on with every skill unticked: the pill stays, greyed.

Skills pill, nothing ticked

Hovering the pill: its icon becomes the X that turns Skills off.

Skills pill hover X

shimmyshimmer added a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Oct 14, 2026
shimmyshimmer added a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Oct 14, 2026
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 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-10-14T04:42:36.084194Z 0960c36 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 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: b3a236059f

ℹ️ 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 +56 to +57
const skillsForTools = () =>
useSkillsSwitchStore.getState().on === false ? [] : getSkillsSnapshot().skills;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Snapshot the Skills switch for queued sends

When a prompt is queued or waits for model loading, the adapter deliberately uses snapshotQueuedChatRunSettings so later composer changes cannot alter that turn, but this helper bypasses the captured runtime and reads the live global switch during payload construction. Because changing this new store also does not advance queuedSettingsEpoch, toggling Skills while a queued prompt is waiting silently changes whether that already-queued turn receives skill tools; capture the switch with the other queued settings instead of reading it live here.

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.

Not changing this: which skills are ticked is already read live from the skills snapshot when a queued turn's payload is built, so the switch behaves the same as ticking or unticking a skill during that wait.

Comment on lines +15 to +16
persist((set) => ({ on: null, setOn: (on) => set({ on }) }), {
name: "unsloth_chat_skills_on",

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 Recount context usage when toggling Skills

With a local model loaded and at least one enabled skill, using the pill X or the + menu only calls this setter. The request and token-count builders now honor the switch, but no context-usage invalidation or recount is triggered, so the displayed token usage continues including—or excluding—the skill tool schema until some unrelated event causes another count. The setter should trigger the same context refresh performed after changing an individual skill.

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.

Not changing this: toggling Search, Code or MCP does not recount either; the bar keeps the last exact count until the next turn, and the switch follows that.

Comment on lines +15 to +17
persist((set) => ({ on: null, setOn: (on) => set({ on }) }), {
name: "unsloth_chat_skills_on",
}),

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 Clear the Skills switch during preference reset

The new persisted key is not included in GeneralTab's PREFS_KEYS, even though that list backs “Reset all local preferences.” After a user explicitly turns Skills on or off, running that reset and reloading leaves unsloth_chat_skills_on intact, so the composer does not return to the unset/default behavior advertised by the reset. Add this key to the reset list alongside the other chat preferences.

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.

Not changing this: the switch is composer state like MCP's per-chat on/off key (unsloth_chat_mcp_enabled), which is also not in PREFS_KEYS.

Comment on lines 6686 to 6689
const skillTools = skillToolNames(
getSkillsSnapshot().skills,
skillsForTools(),
codeToolsEnabled,
userTexts(outboundMessages),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Explicitly filter skill tools when Skills is off

When Skills is off and no other composer tool is selected, skillsForTools() makes skillTools empty, causing the local request branch to omit both enable_tools and enabled_tools. On a server whose launcher default or --enable-tools policy enables tools, _effective_enable_tools treats that omission as tools-on and _select_request_tools treats the absent allow-list as the full catalog, re-adding read_skill/create_skill for enabled skills. Thus the switch still exposes skill tools in this common configuration; the request must explicitly exclude them rather than relying on an omitted tool block.

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.

Not reproducible: with no tool selected the local branch sends an explicit enable_tools: false, not an omitted block, and --enable-tools outranking that is the intended operator override for every UI-off tool. With other tools on, enabled_tools is an explicit list without the skill tools.

@shimmyshimmer

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: 282619ffe8

ℹ️ 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 +171 to +173
// Ticking a skill means using it, so it switches Skills back on.
if (updated.enabled) {
useSkillsSwitchStore.getState().setOn(true);

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 a later Skills-off action during enable requests

When enabling a skill takes long enough for the user to close the skill menu and click the pill's X, that later action sets the switch to false, but the successful request then unconditionally writes true here and turns Skills back on. This makes network completion order override the user's most recent explicit choice; only apply the automatic enable if the switch has not changed since the request began.

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.

Not changing this: it needs the X clicked after closing the menu but before a local PUT returns, which is not a real session path; the switch follows the latest completed skill change.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 0960c361d8

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

Two failures, both from this PR. Main passes both checks, and this branch merged into current main reproduces the first locally (5 failed, 9 passed vs 14 passed on main).

1. Repo tests (CPU, studio): tests/studio/test_token_count_prompt_parity.py

ReferenceError: skillsForTools is not defined

The app itself is fine: skillsForTools is a module-level helper in chat-adapter.ts. The parity test slices the outbound and extras builders out of that file verbatim and runs them against a prelude that stubs each module-level dependency they read. That prelude includes, for example, browserAgentToolsForTurn. The builder now calls skillsForTools() and the prelude has no stub for it. Adding one next to browserAgentToolsForTurn in the test's HARNESS prelude, driven from the seeded state the way the others are, fixes it. It also lets the count test cover the skills it sends.

2. Frontend build + bundle sanity: locale check in strict mode

Missing keys (will fall back to en): 1
  - skills.turnOff
Missing keys above. Add them to every overlay, or run without --strict to accept the English fallback.

skills.turnOff is new in en.ts and needs an entry in each locale overlay.

@shimmyshimmer
shimmyshimmer merged commit 61d17ec into main Oct 14, 2026
@shimmyshimmer
shimmyshimmer deleted the studio-skills-pill-switch branch October 14, 2026 07:46
danielhanchen added a commit that referenced this pull request Oct 14, 2026
#13687 added the Skills switch's Turn off skills label in en only, so the
strict overlay check in Frontend CI fails with it missing from all 13.
danielhanchen added a commit that referenced this pull request Oct 14, 2026
…earch contract, zoo 2026.10.5 scan baseline (#13701)

* Studio i18n: move the Italian rewind filesNotRestored string into rewind

#13676 added it under settings.data.library, so the overlay parity check
in Frontend CI fails with an overlay key missing from en.

* Tests: lift arrow-function consts like functions in the node harness resolver

#13687 added const skillsForTools = () => ..., which reads the zustand
Skills switch store. The resolver treated it as an eagerly evaluated const
and dropped it because the store cannot be lifted, so the token count
parity harness failed with ReferenceError: skillsForTools is not defined.
An arrow or function expression reads its references only when called.
The parity harness also gets a stand-in Skills switch store.

* Baseline the unsloth-zoo 2026.10.5 findings after review

Five pinned zoo sites moved digest in 2026.10.5. Four have the same matched
code; speculative.py adds two mx.eval calls (MLX array evaluation). The rest
of each file's 2026.10.4 to 2026.10.5 diff adds no network, exec or
process code.

* Studio i18n: translate skills.turnOff in every overlay

#13687 added the Skills switch's Turn off skills label in en only, so the
strict overlay check in Frontend CI fails with it missing from all 13.

* Tests: follow the keyed + menu in the deep research contract

#13679 builds the chat + menu from a keyed list, so the one-shot gate is now
deepResearch: researchAvailable ? ( ... ) : null.

* Tests: shorten the deep research contract comment
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.

2 participants