Skip to content

feat(mcp): load pending tools through lazy search [5 of 5]#24987

Open
fcoury-oai wants to merge 3 commits into
fcoury/hide-mcp-4-lazy-tool-registryfrom
fcoury/hide-mcp
Open

feat(mcp): load pending tools through lazy search [5 of 5]#24987
fcoury-oai wants to merge 3 commits into
fcoury/hide-mcp-4-lazy-tool-registryfrom
fcoury/hide-mcp

Conversation

@fcoury-oai
Copy link
Copy Markdown
Contributor

@fcoury-oai fcoury-oai commented May 28, 2026

Why

Search-capable turns should not wait for uncached optional MCP servers during initial tool construction. When the model actually needs a deferred MCP capability, tool_search can load the pending inventory on demand without keeping MCP initialization on the ordinary critical path.

What Changed

  • Track MCP servers whose tool inventory is neither cached nor ready.
  • Supply ready and pending MCP inventory loaders to tool_search for search-capable namespaced providers.
  • Wait for pending inventory only when lazy search needs it, then rebuild searchable MCP exposure from the current normalized inventory.
  • Preserve eager waiting for providers without search support.
  • Omit connector-install suggestions while Apps inventory is unresolved, while retaining independent plugin suggestions.
  • Keep the startup header handoff stable when deferred draws need terminal autoresizing.

MCP Error Reporting

With the default [tui] show_mcp_startup_status = false, unused background startup failures remain quiet. Explicit app, plugin, and skill dependencies still emit MCP dependency \` requested for this turn is unavailable: `. A search-only server that fails startup contributes no lazy search results; this PR does not add a new warning for that path.

Stack

  1. #25212 background MCP startup status
  2. #25213 atomic startup header handoff
  3. #25214 explicit MCP dependency readiness
  4. #25211 lazy tool-search registration
  5. feat(mcp): load pending tools through lazy search [5 of 5] #24987 pending MCP inventory integration (this PR)

How to Test

  1. Configure a slow optional MCP server and submit a normal prompt with a search-capable model.
  2. Confirm the first request can begin before the optional inventory is ready.
  3. Search for a deferred MCP tool and confirm it appears once needed and can be called on the same turn.
  4. Use a provider without search support and confirm MCP tools remain eagerly available.
  5. Keep Apps startup pending and confirm connector-install candidates are not advertised prematurely while plugin candidates remain available.

Targeted tests run:

  • just test -p codex-core -E 'test(tool_search_returns_deferred_tools_without_follow_up_tool_injection) | test(non_search_model_waits_for_pending_apps_tools_on_first_request) | test(codex_apps_file_params_upload_local_paths_before_mcp_tool_call) | test(pending_apps_inventory_omits_connector_install_suggestions_but_keeps_plugins)'
  • just test -p codex-tui -E 'test(startup_header_commit_defers_draw_until_session_info_is_committed) | test(quiet_session_configuration_does_not_defer_draw_for_header_commit)'

@fcoury-oai fcoury-oai requested a review from a team as a code owner May 28, 2026 23:41
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b361c419ba

ℹ️ 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".

Comment thread codex-rs/core/src/tools/handlers/tool_search.rs Outdated
Comment thread codex-rs/core/src/tools/spec_plan.rs
Comment thread codex-rs/core/src/tools/handlers/tool_search.rs Outdated
@fcoury-oai
Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ 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".

@fcoury-oai fcoury-oai changed the title feat(mcp): load pending tools through lazy search feat(mcp): load pending tools through lazy search [5 of 5] May 31, 2026
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.

1 participant