Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions codex-rs/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion codex-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ http = "1.3.1"
icu_decimal = "2.1"
icu_provider = { version = "2.1", features = ["sync"] }
icu_locale_core = "2.1"
ignore = "0.4.23"
ignore = "0.4.25"
image = { version = "^0.25.8", default-features = false }
indexmap = "2.12.0"
insta = "1.43.2"
Expand Down
36 changes: 25 additions & 11 deletions codex-rs/core/src/default_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,19 +260,33 @@ fn sanitize_user_agent(candidate: String, fallback: &str) -> String {
pub fn create_client() -> CodexHttpClient {
use reqwest::header::HeaderMap;

let mut headers = HeaderMap::new();
headers.insert("originator", originator().header_value.clone());
let mut default_headers = HeaderMap::new();
default_headers.insert("originator", originator().header_value.clone());
let ua = get_codex_user_agent();

let mut builder = reqwest::Client::builder()
// Set UA via dedicated helper to avoid header validation pitfalls
.user_agent(ua)
.default_headers(headers);
if is_sandboxed() {
builder = builder.no_proxy();
}

let inner = builder.build().unwrap_or_else(|_| reqwest::Client::new());
let build_client = || {
let mut builder = reqwest::Client::builder()
.use_rustls_tls()
.user_agent(ua.clone())
.default_headers(default_headers.clone());
if is_sandboxed() {
builder = builder.no_proxy();
}
builder.build()
};

let inner = match build_client() {
Ok(client) => client,
Err(error) => {
tracing::error!(?error, "Failed to build reqwest client with rustls");
match build_client() {
Ok(client) => client,
Err(error) => {
panic!("failed to build reqwest client with rustls: {error}");
}
}
}
};
CodexHttpClient::new(inner)
}

Expand Down
6 changes: 2 additions & 4 deletions codex-rs/tui/src/slash_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,8 @@ impl SlashCommand {
}

fn is_visible(self) -> bool {
match self {
SlashCommand::Rollout | SlashCommand::TestApproval => cfg!(debug_assertions),
_ => true,
}
!matches!(self, SlashCommand::Rollout | SlashCommand::TestApproval)
|| cfg!(debug_assertions)
}
}

Expand Down
Loading