Repository navigation
studio: add native IFM reasoning and tool-call support - #10948
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b8189d294a
ℹ️ 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".
| for signal in TOOL_XML_SIGNALS: | ||
| if signal == _IFM_TOOL_CALLS_OPEN: | ||
| continue |
There was a problem hiding this comment.
Skip bare [ARGS] prose during IFM precedence checks
When ordinary explanatory text before a valid IFM envelope contains [ARGS] (for example, The [ARGS] marker denotes arguments. <ifm|tool_calls>...), this loop treats it as an earlier foreign protocol signal because [ARGS] is included in TOOL_XML_SIGNALS. Unlike the other entries, a bare [ARGS] is only executable when preceded by an enabled tool name, and the rehearsal regex below already detects that genuine form. As written, _parse_ifm_tool_calls_with_spans stops before parsing the valid IFM envelope, so the requested tool is silently never executed.
Useful? React with 👍 / 👎.
|
The guard is doing its job: this PR adds new names to The rest of the red on this PR ( |
|
General validation note for my open PRs: I’m no longer able to keep my primary machine pinned several versions behind, or repeatedly rebuild historical ROCm/Unsloth environments solely for PR testing. My current priority is restoring and maintaining a stable training setup, because training attempts are currently crashing my system and blocking normal work. Going forward, I can validate changes on my current working/supported local stack and provide logs or reproductions there. If a PR requires hardware validation on an older ROCm/Unsloth stack, that will need CI or another tester who already has an appropriate environment. If I later have dedicated isolated lab hardware available, I may be able to test older stacks there, but I will not hold back or destabilize my primary environment for PR validation. This does not withdraw the PR; it is a boundary on what version-specific hardware validation I can personally provide. |
|
Hardware testing update: I’m planning to put Ubuntu on an NVMe so I can help with any additional validation you still need on these PRs. It’s going to take me a couple of days to get that environment set up, but once it’s ready I should be available for hardware-specific testing. |
|
@codex review |
1 similar comment
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 409e9627fa
ℹ️ 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".
| spans: list[tuple[int, int, bool]] = [] | ||
| pos = 0 | ||
| while True: | ||
| start = text.find(_IFM_BLOCK_OPEN, pos) |
There was a problem hiding this comment.
Exclude quoted and fenced examples from IFM envelope detection
When a tool-enabled model outputs a complete IFM call as a quoted or fenced documentation example, this unconditional opener search accepts it, and both strict and Auto-Heal parsing return an executable call. The safetensors agentic loop consequently dispatches an enabled tool shown only as an example, while display stripping removes the example from the answer. Exclude top-level quote/code regions when identifying IFM envelopes, without excluding quote or fence characters inside genuine argument values.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing: every envelope format on main (Hermes <tool_call>, MiniMax, GLM) executes a complete call inside a fence or quotes the same way; IFM matches that. Quote/fence heuristics also hid real calls after an unmatched apostrophe in the original version of this PR, which dropped legitimate calls.
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 858322cbef
ℹ️ 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".
| (_ds_pos, _parse_deepseek_tool_calls), | ||
| (_km_pos, _parse_kimi_tool_calls), | ||
| (_mm_pos if _mm_pos >= 0 else len(content), _parse_minimax_tool_calls), | ||
| (_ifm_pos if _ifm_pos >= 0 else len(content), _parse_ifm_tool_calls), |
There was a problem hiding this comment.
Preserve enclosing rehearsals before the IFM pre-pass
With web_search and terminal enabled, a valid web_search[ARGS]{"query":"..."} rehearsal whose query string contains a complete IFM terminal example now returns the inner terminal call in both strict and Auto-Heal modes; the parent returns web_search. _marker_inside_leading_envelope() does not recognize NAME[ARGS], and the existing _inside_leading_markerless_body() guard runs only after this pre-pass, so it cannot preserve the string as argument data. Check rehearsal ownership before dispatching IFM; otherwise, the safetensors loop can execute a tool that appeared only in another tool’s input.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing here: the same input with a MiniMax block (minimax:tool_call) returns the inner call on main in both modes, so this is how the shared pre-pass treats every native envelope inside a bracket rehearsal, not an IFM regression. IFM models do not emit NAME[ARGS] rehearsals; changing pre-pass ownership for all formats belongs in its own PR.
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Co-authored-by: Natani L. Mayday <[email protected]>
fb01a99 to
23b5376
Compare
|
Thank you so much for the PR and for all the work on IFM / K2-Horizon support! After discussing it, we've decided not to add model-specific tool-call syntax for individual custom models in Studio for now, so we won't be merging the parser changes. We still really appreciate the contribution and want you credited, so this PR is merged as a single empty commit authored by you. Thanks again, and we'd be happy to see more PRs from you in the future! |
Summary
Adds native IFM protocol support to Unsloth Studio, motivated by IFM/K2-Horizon models.
This PR adds:
Validation
Focused current-upstream verification on this branch:
git diff --checkcleanThe IFM-specific suite passes 67/67 tests, including regressions for unmatched quotes, unclosed fences, multi-envelope parsing, and quoted fake-envelope suppression.
I also validated the behavior end-to-end with IFM/K2-Horizon in Studio for reasoning and native tool calling.
Scope notes
This PR intentionally does not include:
Those are being kept separate so this PR stays focused on the generic Studio IFM protocol support.