Files
codex/codex-rs/thread-manager-sample
Charlie Marsh e9919f4b4e Add process-local launch directories for shared MCP servers (#61444)
## What changed

- Add hidden app-server options `--plugin-mcp-launch-cwd` and `--mcp-launch-cwd` for host-supplied local stdio server launch directories without writing them to shared configuration.
- Apply these directories when both `mcp_shared_repl_cwd` and `mcp_connection_sharing` are enabled. For configured servers, require a matching executable and preserve any explicit working directory.
- Attach thread-specific sandbox state to direct MCP tool calls for servers advertising support, stripping caller-supplied sandbox and launcher metadata first.

## Testing

Add regression tests for launch-directory feature toggling and executable matching, and for direct MCP calls using each thread's sandbox working directory despite forged caller metadata.

GitOrigin-RevId: d7f78ea92163ec0ee9311f68ef17e87a6694b13b
2026-11-14 01:54:53 +00:00
..

ThreadManager Sample

Small one-shot binary that starts a Codex thread with ThreadManager from codex-core-api, submits a single user turn, and prints the final assistant message.

Authentication uses the configured credential storage under CODEX_HOME, including cli_auth_credentials_store, mcp_oauth_credentials_store, and features.secret_auth_storage. Local managed authentication requirements and auth routing settings are respected. This also applies to cargo run builds. Other execution settings remain the sample's built-in configuration.

cargo run -p codex-thread-manager-sample -- "Say hello"

Use --model to override the configured default model:

cargo run -p codex-thread-manager-sample -- --model gpt-5.2 "Say hello"

The prompt can also be piped through stdin:

printf 'Say hello\n' | cargo run -p codex-thread-manager-sample