Conversation
Test Failure AnalysisSummary: The Windows CI job failed because Root Cause: The test at Suggested Solution: In
Option 1 is simpler and still validates the basic intent (no multi-second startup cost). Detailed AnalysisFailed job: "Tests: Python 3.10 on windows-latest" (Job ID: 65171185865) Log excerpt: The test passed on:
But failed on:
This is a performance assertion that's sensitive to CI runner speed. The 100ms threshold is reasonable for a development machine but too tight for Windows CI runners, which are known to be slower than Linux runners. All other 4,415 tests passed. This appears to be a pre-existing flakiness issue introduced with the test itself, not caused by the CodeMode transform changes. Related Files
🤖 Automated triage via Claude Code · edited to reflect latest analysis |
🤖 Generated with Claude Code
🤖 Generated with Claude Code Co-Authored-By: Claude Opus 4.6 <[email protected]>
🤖 Generated with Claude Code Co-Authored-By: Claude Opus 4.6 <[email protected]>
Removes the duplicate ContextVar bypass pattern in favor of the shared CatalogTransform machinery. Also fixes a pre-existing bug where `from __future__ import annotations` caused NameError for Annotated in nested function scopes at runtime.
call_tool() inside execute blocks now returns structured content as-is,
preserving the {"result": value} wrapping. This means the output schema
shown in search results accurately describes what call_tool() returns,
so LLMs can trust the schema when writing code.
Also adds examples/code_mode/ with a server and narrated client demo.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d1b4c50977
ℹ️ 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".
|
|
||
| async def call_tool(tool_name: str, params: dict[str, Any]) -> Any: | ||
| backend_tools = await _get_cached_tools() | ||
| tool = transform._find_tool(tool_name, backend_tools) |
There was a problem hiding this comment.
Select highest-version backend tool before execute call
execute resolves a backend tool by scanning the list_tools() catalog and taking the first name match, then pins that exact version for the call. Because list_tools() returns all versions in provider/registration order, a versioned tool like foo@1 + foo@2 can be invoked as foo@1 through CodeMode even though normal call_tool("foo", ...) semantics return the highest version; this causes silent behavior drift for any server that relies on versioned tools.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a296d4e895
ℹ️ 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".
Closes #3296
Summary
Adds
CodeMode, an experimental transform inspired by Cloudflare's Code Mode that collapses a large tool surface into two meta-tools:search(inspect tool metadata via Python) andexecute(chaincall_tool(...)invocations in Python). Useful when LLMs need to plan multi-step workflows against many tools without listing them all in context.Changes
fastmcp.experimental.transforms.CodeModetransform with pluggableSandboxProviderprotocolMontySandboxProviderbacked bypydantic-monty(newfastmcp[code-mode]optional dep)docs/servers/transforms/code-mode.mdxDesign notes
Placed under
fastmcp.experimental.transformssince this is an experimental API. The sandbox provider is a protocol so third-party runtimes (remote sandboxes, WASM, etc.) can plug in without changes to the transform itself.JL notes update from review: