Skip to content

fix(codemode): forward capability handlers to inner toolsets#3809

Merged
Sayt-0 merged 1 commit into
mainfrom
fix-codemode-oauth-forwarding
Jul 24, 2026
Merged

fix(codemode): forward capability handlers to inner toolsets#3809
Sayt-0 merged 1 commit into
mainfrom
fix-codemode-oauth-forwarding

Conversation

@aheritier

Copy link
Copy Markdown
Contributor

Problem

With code_mode_tools: true, the code-mode wrapper prevents capability handlers from reaching wrapped remote MCP toolsets. OAuth elicitation is therefore never surfaced, and the toolset registers 0 tools.

Fix

Forward the five capability interfaces (Elicitable, Sampleable, SampleableWithTools, OAuthCapable, and ChangeNotifier) from codemode.codeModeTool to every inner toolset that supports them.

Fixes #3808

Testing

  • Added unit tests in pkg/tools/codemode/codemode_test.go covering forwarding via tools.ConfigureHandlers and through a tools.NewStartable wrapper.
  • Added runtime regression test TestConfigureToolsetHandlers_ReachesThroughCodeModeWrapper in pkg/runtime/runtime_test.go (fails pre-fix, passes post-fix).
  • task build
  • task test
  • task lint

All pass.

An agent with code_mode_tools:true wraps all its toolsets in a single
codeModeTool meta-toolset. That wrapper implemented none of the capability
interfaces (Elicitable, Sampleable, SampleableWithTools, OAuthCapable,
ChangeNotifier) and, wrapping N inner toolsets, is not an Unwrapper that
tools.As can walk through. As a result tools.ConfigureHandlers stopped at
the wrapper boundary and the inner MCP toolset never received its
elicitation/OAuth handlers: an OAuth elicitation found no handler wired up
and deferred forever, so the toolset never surfaced its authorization
dialog and registered 0 tools.

Implement the five capability interfaces on codeModeTool, forwarding each
to every inner toolset that supports it (mirroring the mcpcatalog toolset
pattern). Add unit tests covering forwarding through tools.ConfigureHandlers
and a runtime regression test exercising configureToolsetHandlers through
the code-mode wrapper.
@aheritier
aheritier requested a review from a team as a code owner July 23, 2026 19:46
@aheritier aheritier added area/runtime Runtime engine, agent loop execution, tool dispatch, loop detection area/tools For features/issues/fixes related to the usage of built-in and MCP tools kind/fix PR fixes a bug (maps to fix:). Use on PRs only. labels Jul 23, 2026
@Sayt-0
Sayt-0 merged commit 8a94bc8 into main Jul 24, 2026
14 checks passed
@Sayt-0
Sayt-0 deleted the fix-codemode-oauth-forwarding branch July 24, 2026 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/runtime Runtime engine, agent loop execution, tool dispatch, loop detection area/tools For features/issues/fixes related to the usage of built-in and MCP tools kind/fix PR fixes a bug (maps to fix:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

code_mode_tools breaks OAuth for wrapped MCP toolsets (authorization dialog never appears, 0 tools)

3 participants