Inherit the calling agent's model in build_app by default - #4744
Merged
Merged
Conversation
An agent that reaches for the app-build harness had to name a provider and model, or the server fell back to NODETOOL_APP_BUILD_PROVIDER / NODETOOL_APP_BUILD_MODEL — neither of which is what the caller usually wants: the model it is itself running on. Every tool-calling loop (chat turns in the websocket runner and the chat package, StepExecutor sub-agents) now stamps its own provider/model onto the ProcessingContext under ACTIVE_MODEL_CONTEXT_KEY, and build_app fills omitted provider/model params from it. Explicit params still win, and the env fallback remains for callers with no stamped selection (external MCP clients). The tool and parameter descriptions state the inheritance so the model driving the tool knows it can omit them. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K4Px39VmiyrGyanqioq6GL
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
When an agent calls the app-build harness through the
build_apptool, the call now inherits the calling agent's own provider/model by default, and the tool description says so.How
ACTIVE_MODEL_CONTEXT_KEY+ActiveModelSelection(@nodetool-ai/runtime): a ProcessingContext variable carrying the provider/model the currently running agent loop is itself talking to.processChatin@nodetool-ai/chat, andStepExecutorsub-agents.BuildAppTool.processfills omittedprovider/modelparams from the stamped selection. Explicit params still win, and the server-sideNODETOOL_APP_BUILD_PROVIDER/NODETOOL_APP_BUILD_MODELfallback remains for callers with no stamped selection (e.g. external MCP clients on/mcp).provider/modelparameter descriptions now explain the inheritance, so the model driving the tool knows it can omit them.build_appsection documents the new resolution order.Tests
packages/agents/tests/mcp-tools.test.ts: newBuildAppToolsuite — inherits when omitted, explicit wins, passes through untouched when nothing is stamped, and the descriptions document the behavior.🤖 Generated with Claude Code
https://claude.ai/code/session_01K4Px39VmiyrGyanqioq6GL
Generated by Claude Code