core: add tool-free thread mode - #31922
Conversation
|
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. |
|
@codex review |
There was a problem hiding this comment.
💡 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".
| if turn_context.config.features.enabled(Feature::ToolFree) { | ||
| return Some((Vec::new(), HashSet::new())); | ||
| } |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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 👍 / 👎.
| let mcp_servers = if self.enabled(Feature::ToolFree) { | ||
| HashMap::new() | ||
| } else { | ||
| effective_mcp_servers(&mcp_config, auth.as_ref()) |
There was a problem hiding this comment.
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 👍 / 👎.
| let mcp_servers = if config_for_mcp.features.enabled(Feature::ToolFree) { | ||
| HashMap::new() | ||
| } else { | ||
| codex_mcp::effective_mcp_servers(mcp_config, auth.as_ref()) |
There was a problem hiding this comment.
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 👍 / 👎.
|
@codex think deeper |
|
Note To use Codex here, create a Codex account and connect to github. |
Summary
tool_freefeature for lightweight helper threads.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.cargo check -p codex-app-serverpassed.tool_freestarted no MCP server and sent zero tools.argument-comment-lintis currently blocked because its pinned Rust 1.92 nightly cannot compile SQLx 0.9, which requires Rust 1.94.