Repository navigation
Conversation
mahiatlinux
self-requested a review
August 28, 2026 05:09
…gent Claude Code's Foundry/Bedrock/Vertex routing outranks ANTHROPIC_BASE_URL, so a parent shell configured for a corporate gateway silently sent every local-agent task to that gateway, which 404s the local model id — and prompts meant to stay on-device left the machine. _CLAUDE_ENV_UNSET now strips the routing toggles (and the Foundry pair), covering the MCP bridge, unsloth start claude, and the --no-launch recipes with one list. Fixes unslothai#9864
lonexreb
force-pushed
the
fix/claude-subagent-provider-routing
branch
from
August 28, 2026 05:22
2cee9ca to
57ed954
Compare
Contributor
|
Thanks for the contribution. #9871 now supersedes this PR. The focused provider-routing regression test from this branch is now in #9871, with your authorship preserved in commit d2cf858. The combined PR also covers the AWS, Google Cloud, and Mantle selectors. Closing this one so the fix continues in one place. |
2 tasks done
mahiatlinux
pushed a commit
that referenced
this pull request
Aug 28, 2026
) Fixes #9864. Pin Claude direct and MCP subagent sessions to the local Studio endpoint even when user settings or the inherited environment select Foundry, Bedrock, Vertex, AWS, Google Cloud, Mantle, or a Unix socket. Preserve compatibility with older Claude versions, WSL path translation, forwarded settings, subcommands, and concurrent sessions. Includes focused inherited-provider regression coverage adapted from #9907 by @lonexreb.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes #9864. With Claude Code configured for Azure AI Foundry (or Bedrock/Vertex) in the parent shell, the Unsloth local-agent bridge spawned a child that inherited those routing vars — and Claude Code's provider routing outranks
ANTHROPIC_BASE_URL, so everyunsloth_agenttask went to the remote gateway instead of the local server, failing with a misleadingunrecognized_model404. Beyond the breakage, prompts the user intended to keep on-device left the machine.How
_CLAUDE_ENV_UNSETgrows the routing toggles (CLAUDE_CODE_USE_FOUNDRY/_BEDROCK/_VERTEX) plus the Foundry pair (ANTHROPIC_FOUNDRY_BASE_URL,ANTHROPIC_FOUNDRY_RESOURCE), exactly as the issue proposed. One list covers all three consumers: the MCP subagent bridge,unsloth start claude, and the printed--no-launchrecipes (POSIX inline blanks and PowerShellRemove-Itemlines alike). With the toggles unset the provider-specific*_BASE_URLcompanions for Bedrock/Vertex are inert, so those are left alone — the goal is restoring local routing, not scrubbing unrelated cloud config.Reproduced → fixed
New test
test_local_child_sheds_inherited_provider_routingsets the five vars in the parent env and asserts the child env carries none of them whileANTHROPIC_BASE_URLstill points at the local server. It fails on main (the child inherits all five) and passes with this change. The WSL-bridge path blanks the same names to empty strings, the treatment the existing credential vars already get.Tests
Full
unsloth_cli/tests: 1053 passed, 7 skipped. Ruff clean, kwarg-spacing formatter applied.