Skip to content

Inherit the calling agent's model in build_app by default - #4744

Merged
georgi merged 1 commit into
mainfrom
claude/agent-harness-model-inherit-rbpcif
Aug 5, 2026
Merged

georgi merged 1 commit into
mainfrom
claude/agent-harness-model-inherit-rbpcif

Conversation

@georgi

@georgi georgi commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

What

When an agent calls the app-build harness through the build_app tool, 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.
  • Every tool-calling loop stamps it: the websocket runner's chat turn, processChat in @nodetool-ai/chat, and StepExecutor sub-agents.
  • BuildAppTool.process fills omitted provider/model params from the stamped selection. Explicit params still win, and the server-side NODETOOL_APP_BUILD_PROVIDER / NODETOOL_APP_BUILD_MODEL fallback remains for callers with no stamped selection (e.g. external MCP clients on /mcp).
  • The tool description and the provider/model parameter descriptions now explain the inheritance, so the model driving the tool knows it can omit them.
  • CLAUDE.md's build_app section documents the new resolution order.

Tests

  • packages/agents/tests/mcp-tools.test.ts: new BuildAppTool suite — inherits when omitted, explicit wins, passes through untouched when nothing is stamped, and the descriptions document the behavior.
  • Full suites green: agents (2067), chat (30), websocket (2206), runtime (2699). Lint and web/electron typecheck pass; the mobile typecheck failure is missing Expo deps in this sandbox, unrelated to the diff.

🤖 Generated with Claude Code

https://claude.ai/code/session_01K4Px39VmiyrGyanqioq6GL


Generated by Claude Code

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
@georgi
georgi enabled auto-merge (squash) August 5, 2026 22:24
@georgi
georgi merged commit b3ed323 into main Aug 5, 2026
24 checks passed
@georgi
georgi deleted the claude/agent-harness-model-inherit-rbpcif branch August 5, 2026 22:38
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.

2 participants