Format all Rust sources and clean up repository checks (#57314)

## Why

Rust formatting should include source files that Cargo cannot discover, while keeping command lines within Windows limits.

## What changed

- Update `scripts/format.py` to discover tracked and non-ignored untracked Rust files with Git and invoke `rustfmt` in batches of 64 files. Use the workspace configuration and skip recursive child-module formatting.
- Pass `SystemDrive` and `LOCALAPPDATA` to Windows Bazel tests.
- Extend the spelling allowlist, remove a manifest feature exception, and clean up an unused import, an empty MCP scenario module, and its snapshot.

GitOrigin-RevId: c0d625fda9290ead6a63919325d65f7352abfa40
This commit is contained in:
Joe Savona authored and copyberry committed 2026-10-27 00:23:39 +00:00
1 parent 9526f8d0d0
commit 95cafae96c
8 files changed
+43 -57

No files matched your search

+2
View File
@@ -45,6 +45,8 @@ common:macos --strategy=CcConfigureMakeRule=remote,sandboxed,local
common:windows --test_env=SYSTEMROOT
common:windows --test_env=COMSPEC
common:windows --test_env=WINDIR
common:windows --test_env=SystemDrive
common:windows --test_env=LOCALAPPDATA
# Rust's libtest harness runs test bodies on std-spawned threads. The default
# 2 MiB stack can be too small for large async test futures on Windows CI; see
# https://github.com/openai/codex/pull/19067 for the motivating failure.
+2
View File
@@ -1,7 +1,9 @@
iTerm
iTerm2
numer
oint
psuedo
SOM
te
TE
WRONLY
@@ -26,7 +26,6 @@ UTILITY_NAME_EXCEPTIONS = {
"path-utils": "codex-utils-path",
}
MANIFEST_FEATURE_EXCEPTIONS = {
"codex-rs/code-mode/Cargo.toml": {"sandbox": ("v8/v8_enable_sandbox",)},
"codex-rs/v8-poc/Cargo.toml": {"sandbox": ("v8/v8_enable_sandbox",)},
}
OPTIONAL_DEPENDENCY_EXCEPTIONS = set()
+3 -3
View File
@@ -385,11 +385,11 @@ impl MessageProcessor {
outgoing.clone(),
thread_state_manager.clone(),
)),
Some({
{
let time_provider =
app_server_time_provider(outgoing.clone(), thread_state_manager.clone());
time_provider
}),
Some(time_provider)
},
);
match code_mode_session_provider {
Some(provider) => manager.with_code_mode_session_provider(provider),
@@ -44,7 +44,6 @@ use serde_json::json;
use wiremock::Mock;
use wiremock::MockServer;
use wiremock::ResponseTemplate;
use wiremock::matchers::body_json;
use wiremock::matchers::body_partial_json;
use wiremock::matchers::header;
use wiremock::matchers::method;
@@ -1 +0,0 @@
//! Thread policy reaches MCP discovery and execution without relying on model arguments.
@@ -1,48 +0,0 @@
---
source: core/tests/suite/scenarios_read_only_mcp.rs
expression: "context_snapshot::format_request_history_snapshot(\"A read-only thread receives only read tools from the MCP server and executes a read.\",\n&mock.requests(),\n&ContextSnapshotOptions::default().rewrite_known_segments().include_request_settings(),)"
---
Scenario: A read-only thread receives only read tools from the MCP server and executes a read.
## Window 1
Settings:
include: ["reasoning.encrypted_content"]
model: "gpt-5.5"
parallel_tool_calls: true
prompt_cache_key: "<PROMPT_CACHE_KEY 1>"
reasoning: {"effort":"medium"}
store: false
stream: true
text: {"verbosity":"low"}
tool_choice: "auto"
tools (11; hash=14a76ba72d609d9e):
- function/exec_command: Runs a command in a PTY, returning output or a session ID for ongoing interaction.; args=[cmd, justification, login, max_output_tokens, prefix_rule, sandbox_permissions, shell, tty, workdir, yield_time_ms]; hash=c04108e51a8548c5
- function/write_stdin: Writes characters to an existing unified exec session and returns recent output.; args=[chars, max_output_tokens, session_id, yield_time_ms]; hash=7fb62d8a3e2df4e2
- function/list_mcp_resources: Lists resources provided by MCP servers. Resources allow servers to share data that provides cont...; args=[cursor, server]; hash=6792edaff13561bd
- function/list_mcp_resource_templates: Lists resource templates provided by MCP servers. Parameterized resource templates allow servers ...; args=[cursor, server]; hash=60f17c90ef7a4ebb
- function/read_mcp_resource: Read a specific resource from an MCP server given the server name and resource URI.; args=[server, uri]; hash=24246896b39008ae
- function/request_user_input: Request user input for one to three short questions and wait for the response. This tool is only ...; args=[questions]; hash=64a729b25c424fc6
- custom/apply_patch: The `apply_patch` tool can be used to edit files. This is a FREEFORM tool, so do not wrap the pat...; hash=dea9f12b0111a4ba
- function/view_image: View a local image file from the filesystem when visual inspection is needed. Use this for images...; args=[detail, path]; hash=3b766d5bdec5d50e
- namespace/multi_agent_v1: Tools for spawning and managing sub-agents.; hash=2327142bda177c50
- function/close_agent
- function/resume_agent
- function/send_input
- function/spawn_agent
- function/wait_agent
- namespace/mcp__policy: Tools in the mcp__policy namespace.; hash=4868c429e15f1bec
- function/read
- web_search; hash=e214d4db1bc49e89
-- request 1 (turn) --
00:message/developer:
<MODEL_INSTRUCTIONS>
01:message/developer:
<PERMISSIONS_INSTRUCTIONS>
02:message/user:
<ENVIRONMENT_CONTEXT>
03:message/user:
Read the report.
-- request 2 (turn) --
04:function_call/mcp__policy.read:{}
05:function_call_output:Wall time: <DURATION> seconds
Output: | Report ready.
+36 -3
View File
@@ -41,11 +41,44 @@ def just_formatter_group(*, check: bool) -> FormatterGroup:
def rust_formatter_group(*, check: bool) -> FormatterGroup:
args = ["cargo", "fmt", "--", "--config", "imports_granularity=Item"]
rust_workspace = REPO_ROOT / "codex-rs"
repository_files = subprocess.check_output(
[
"git",
"ls-files",
"-z",
"--cached",
"--others",
"--exclude-standard",
"--",
"*.rs",
],
cwd=REPO_ROOT,
).split(b"\0")
rust_files = sorted(
os.path.relpath(REPO_ROOT / os.fsdecode(encoded_path), rust_workspace)
for encoded_path in repository_files
if encoded_path and (REPO_ROOT / os.fsdecode(encoded_path)).is_file()
)
# Git supplies every source file, including files Cargo cannot discover.
# Do not recursively format child modules again or include ignored files.
args = [
"rustfmt",
"--edition",
"2024",
"--config-path",
str(rust_workspace / "rustfmt.toml"),
"--config",
"imports_granularity=Item,skip_children=true",
]
if check:
args.append("--check")
command = Command(tuple(args), REPO_ROOT / "codex-rs")
return FormatterGroup("Rust", (command,))
# Batch relative paths to stay below Windows command-line limits.
commands = tuple(
Command(tuple(args + rust_files[start : start + 64]), rust_workspace)
for start in range(0, len(rust_files), 64)
)
return FormatterGroup("Rust", commands)
def buildifier_formatter_group(*, check: bool) -> FormatterGroup: