mirror of
https://github.com/openai/codex.git
synced 2026-11-06 00:30:29 +00:00
Remove the codex-tui app-server originator workaround (#16116)
## Summary - remove the temporary `codex-tui` special-case when setting the default originator during app-server initialization
This commit is contained in:
1 parent
48144a7fa4
commit
178d2b00b1
3 files changed
+3
-9
No files matched your search
@@ -61,7 +61,6 @@ use codex_core::ThreadManager;
|
|||||||
use codex_core::config::Config;
|
use codex_core::config::Config;
|
||||||
use codex_core::config_loader::CloudRequirementsLoader;
|
use codex_core::config_loader::CloudRequirementsLoader;
|
||||||
use codex_core::config_loader::LoaderOverrides;
|
use codex_core::config_loader::LoaderOverrides;
|
||||||
use codex_core::default_client::DEFAULT_ORIGINATOR;
|
|
||||||
use codex_core::default_client::SetOriginatorError;
|
use codex_core::default_client::SetOriginatorError;
|
||||||
use codex_core::default_client::USER_AGENT_SUFFIX;
|
use codex_core::default_client::USER_AGENT_SUFFIX;
|
||||||
use codex_core::default_client::get_codex_user_agent;
|
use codex_core::default_client::get_codex_user_agent;
|
||||||
@@ -88,7 +87,6 @@ use toml::Value as TomlValue;
|
|||||||
use tracing::Instrument;
|
use tracing::Instrument;
|
||||||
|
|
||||||
const EXTERNAL_AUTH_REFRESH_TIMEOUT: Duration = Duration::from_secs(10);
|
const EXTERNAL_AUTH_REFRESH_TIMEOUT: Duration = Duration::from_secs(10);
|
||||||
const TUI_CLIENT_NAME: &str = "codex-tui";
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
struct ExternalAuthRefreshBridge {
|
struct ExternalAuthRefreshBridge {
|
||||||
@@ -569,13 +567,7 @@ impl MessageProcessor {
|
|||||||
} = params.client_info;
|
} = params.client_info;
|
||||||
session.app_server_client_name = Some(name.clone());
|
session.app_server_client_name = Some(name.clone());
|
||||||
session.client_version = Some(version.clone());
|
session.client_version = Some(version.clone());
|
||||||
let originator = if name == TUI_CLIENT_NAME {
|
let originator = name.clone();
|
||||||
// TODO: Remove this temporary workaround once the TUI no longer
|
|
||||||
// needs to retain the `codex_cli_rs` originator behavior.
|
|
||||||
DEFAULT_ORIGINATOR.to_string()
|
|
||||||
} else {
|
|
||||||
name.clone()
|
|
||||||
};
|
|
||||||
if let Err(error) = set_default_originator(originator) {
|
if let Err(error) = set_default_originator(originator) {
|
||||||
match error {
|
match error {
|
||||||
SetOriginatorError::InvalidHeaderValue => {
|
SetOriginatorError::InvalidHeaderValue => {
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ pub fn originator() -> Originator {
|
|||||||
|
|
||||||
pub fn is_first_party_originator(originator_value: &str) -> bool {
|
pub fn is_first_party_originator(originator_value: &str) -> bool {
|
||||||
originator_value == DEFAULT_ORIGINATOR
|
originator_value == DEFAULT_ORIGINATOR
|
||||||
|
|| originator_value == "codex-tui"
|
||||||
|| originator_value == "codex_vscode"
|
|| originator_value == "codex_vscode"
|
||||||
|| originator_value.starts_with("Codex ")
|
|| originator_value.starts_with("Codex ")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ fn test_get_codex_user_agent() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn is_first_party_originator_matches_known_values() {
|
fn is_first_party_originator_matches_known_values() {
|
||||||
assert_eq!(is_first_party_originator(DEFAULT_ORIGINATOR), true);
|
assert_eq!(is_first_party_originator(DEFAULT_ORIGINATOR), true);
|
||||||
|
assert_eq!(is_first_party_originator("codex-tui"), true);
|
||||||
assert_eq!(is_first_party_originator("codex_vscode"), true);
|
assert_eq!(is_first_party_originator("codex_vscode"), true);
|
||||||
assert_eq!(is_first_party_originator("Codex Something Else"), true);
|
assert_eq!(is_first_party_originator("Codex Something Else"), true);
|
||||||
assert_eq!(is_first_party_originator("codex_cli"), false);
|
assert_eq!(is_first_party_originator("codex_cli"), false);
|
||||||
|
|||||||
Reference in new issue
Block a user