Skip to content

bug(runtime): Code Mode on OpenAI Responses advertises maka_tool_search, which exec does not bind #5664

Description

@liugddx

What happened

In Code Mode, with a connection routed through the OpenAI Responses adapter, the model cannot load any deferred tool. Its first exec call fails before any tool runs:

return await tools.maka_tool_search({ query: "ScheduledTask", limit: 1 });
{ "ok": false, "error": { "kind": "execution_error", "message": "not a function" }, "toolCalls": [] }

Because discovery fails, ScheduledTask (and every other deferred tool) is unreachable in that session. The user's request ("create a scheduled task for 10:00 today") ended with no task created.

Root cause. OpenAI Responses reserves tool_search, so #3958 renames the provider-bound tool to maka_tool_search (model-adapter.ts, startStream) and also rewrites every \btool_search\b in the system prompt via remapProviderToolNamesInText. In Code Mode the provider only sees exec; tool_search is nested inside it and bound in the QuickJS cell as tools.tool_search (code-mode.ts / nestableToolSnapshot). The prose rewrite still reaches the Code Mode catalog prompt (renderCodeModeCatalogPrompt, "After tool_search, …" plus the JSON catalog), so the model is told to call a name the cell never binds.

The existing Code Mode backend test (code-mode-backend.test.ts) does not use a Responses runtime, so it does not cover this combination.

How to reproduce

  1. Enable Code Mode for new tasks (feat(settings): opt in to Code Mode for new tasks #5219).
  2. Use a connection whose model runs on the OpenAI Responses adapter.
  3. Ask for anything that needs a deferred tool, e.g. "create a scheduled task at 10:00 today".
  4. The model calls tools.maka_tool_search(...) inside exec and gets not a function; toolCalls is empty.

Environment

  • Maka Desktop 0.2.0-dev.48.20260923 (packaged)
  • Windows 10 x64 (10.0.19042)
  • Verified against source at apache/main@fef5b937a

Logs, screenshots, or additional context

Both conditions are required: Code Mode alone keeps tool_search; Responses alone exposes maka_tool_search as a real provider tool.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions