Skip to content

core: add tool-free thread mode - #31922

Draft
river-oai wants to merge 1 commit into
mainfrom
river/thread-title-no-tools
Draft

core: add tool-free thread mode#31922
river-oai wants to merge 1 commit into
mainfrom
river/thread-title-no-tools

Conversation

@river-oai

Copy link
Copy Markdown

Summary

  • Add an opt-in tool_free feature for lightweight helper threads.
  • Prevent MCP startup and refresh work for tool-free sessions.
  • Skip skill, plugin, and tool enumeration, then enforce an empty tool router.

Why

Helper turns such as thread-title generation should not start unrelated MCP servers or expose tools they cannot use. A slow server can otherwise consume the helper's full timeout.

Validation

  • codex-features: 55 tests passed.
  • MCP refresh/runtime: 2 focused tests passed.
  • Tool planning: 28 tests passed.
  • cargo check -p codex-app-server passed.
  • Scoped Clippy and formatting passed.
  • Runtime control: the normal path started the configured MCP server and sent 11 tools; tool_free started no MCP server and sent zero tools.

argument-comment-lint is currently blocked because its pinned Rust 1.92 nightly cannot compile SQLx 0.9, which requires Rust 1.94.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@glook9001

Copy link
Copy Markdown

@codex review

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

Copy link
Copy Markdown
Contributor

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: 489d5b504a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +518 to +520
if turn_context.config.features.enabled(Feature::ToolFree) {
return Some((Vec::new(), HashSet::new()));
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Skip initial tool context in tool-free mode

In a fresh tool_free thread this guard runs only after run_turn has already called record_context_updates_and_set_reference_context_item, and that initial-context path still builds available-skill instructions, plugin recommendations, and plugin/app world-state from the configured MCP/plugin data. With any installed skills or plugin suggestions, the first Responses request can still advertise tool-related guidance while the router is empty, so helper turns remain exposed to the latency/context that this mode is meant to avoid; the ToolFree check needs to cover the initial context contributors too.

Useful? React with 👍 / 👎.

cancellation_token: &CancellationToken,
) -> CodexResult<Arc<ToolRouter>> {
let turn_context = step_context.turn.as_ref();
if turn_context.config.features.enabled(Feature::ToolFree) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Add integration coverage for tool-free turns

This feature gate changes the agent turn path by suppressing tool registration and skill/plugin handling, but the commit does not add any core/suite integration test (the diff contains no test files). Please add a TestCodex integration case that enables tool_free and verifies the outbound Responses request has no model-visible tools or skill/plugin injections while a normal session remains unchanged.

AGENTS.md reference: AGENTS.md:L114-L118

Useful? React with 👍 / 👎.

Comment on lines +337 to +340
let mcp_servers = if self.enabled(Feature::ToolFree) {
HashMap::new()
} else {
effective_mcp_servers(&mcp_config, auth.as_ref())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Honor tool-free for MCP status snapshots

This gate only empties the live session manager, but app-server mcpServerStatus/list with a thread_id still calls thread.runtime_mcp_config(&config) and then collect_mcp_server_status_snapshot_with_detail, which builds a temporary McpConnectionManager from effective_mcp_servers and starts the configured servers to collect status. In a tool_free helper thread, any client status poll can therefore start the same slow MCP servers that session init and refresh now avoid; return an empty/tool-free MCP config or skip snapshot collection for these threads too.

AGENTS.md reference: AGENTS.md:L102-L110

Useful? React with 👍 / 👎.

Comment on lines +697 to +700
let mcp_servers = if config_for_mcp.features.enabled(Feature::ToolFree) {
HashMap::new()
} else {
codex_mcp::effective_mcp_servers(mcp_config, auth.as_ref())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Skip plugin and skill warmup for tool-free startup

This branch empties mcp_servers only after runtime_config_for_step has already resolved plugin-backed MCP config, and session initialization later still runs session_init.plugin_skill_warmup, which calls plugins_for_config and snapshots skills unconditionally. In tool_free helper threads with enabled plugins/skills, startup can still spend the helper's timeout loading plugin and skill metadata even though no tools will be registered; short-circuit those startup plugin/skill paths when Feature::ToolFree is set.

Useful? React with 👍 / 👎.

@glook9001

Copy link
Copy Markdown

@codex think deeper

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

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