Merge pull request #67 from router-for-me/dev
fix: resolve Rust 1.97 Clippy errors
This commit is contained in:
2 files changed
+34
-32
No files matched your search
@@ -339,8 +339,8 @@ pub(crate) fn repair_before_codex_launch(
|
||||
fn repair_before_codex_launch_from_home(
|
||||
codex_home: &Path,
|
||||
) -> Result<CodexSessionRepairResult, String> {
|
||||
validate_managed_codex_provider(&codex_home)?;
|
||||
match repair_codex_session_metadata_from_home(&codex_home, |_| {}) {
|
||||
validate_managed_codex_provider(codex_home)?;
|
||||
match repair_codex_session_metadata_from_home(codex_home, |_| {}) {
|
||||
Ok(result) => Ok(result),
|
||||
Err(error) if is_locked_error_message(&error) => Ok(CodexSessionRepairResult {
|
||||
target_provider: MANAGED_AGENT_PROVIDER_ID.to_string(),
|
||||
@@ -735,8 +735,7 @@ fn delete_one_session(
|
||||
});
|
||||
}
|
||||
let backup_dir = create_delete_backup(codex_home, session_id, &plans)?;
|
||||
let mut committed_databases = 0usize;
|
||||
for plan in &plans {
|
||||
for (committed_databases, plan) in plans.iter().enumerate() {
|
||||
if let Err(error) = apply_database_delete_plan(plan, session_id) {
|
||||
let status = if committed_databases > 0 {
|
||||
"partial"
|
||||
@@ -752,7 +751,6 @@ fn delete_one_session(
|
||||
backup_path: Some(backup_dir.to_string_lossy().to_string()),
|
||||
});
|
||||
}
|
||||
committed_databases += 1;
|
||||
}
|
||||
let mut rollout_errors = Vec::new();
|
||||
let mut rollout_paths = plans
|
||||
@@ -1505,8 +1503,8 @@ fn normalize_workspace_path(value: &str) -> Option<String> {
|
||||
if lower.starts_with(r"\\?\unc\") {
|
||||
return Some(format!(r"\\{}", value[8..].replace('/', r"\")));
|
||||
}
|
||||
if value.starts_with(r"\\?\") {
|
||||
return Some(value[4..].replace('\\', "/"));
|
||||
if let Some(stripped) = value.strip_prefix(r"\\?\") {
|
||||
return Some(stripped.replace('\\', "/"));
|
||||
}
|
||||
Some(value.to_string())
|
||||
}
|
||||
|
||||
+29
-25
@@ -754,6 +754,12 @@ struct AgentFileUpdate {
|
||||
after: String,
|
||||
}
|
||||
|
||||
struct AgentConfigurationOptions<'a> {
|
||||
models: &'a [AgentModelOption],
|
||||
codex_models: Option<&'a [CodexModelCatalogSpec]>,
|
||||
oauth_configuration: bool,
|
||||
}
|
||||
|
||||
type FileSnapshot = (PathBuf, Option<Vec<u8>>);
|
||||
#[cfg(test)]
|
||||
type AgentRecordExtension = (AgentModificationRecord, Vec<FileSnapshot>);
|
||||
@@ -1614,9 +1620,11 @@ async fn apply_agent_config(
|
||||
config.port,
|
||||
api_key,
|
||||
&model,
|
||||
&available_models,
|
||||
codex_models.as_deref(),
|
||||
oauth_configuration,
|
||||
AgentConfigurationOptions {
|
||||
models: &available_models,
|
||||
codex_models: codex_models.as_deref(),
|
||||
oauth_configuration,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@@ -3470,9 +3478,11 @@ fn build_agent_updates(
|
||||
port,
|
||||
api_key,
|
||||
model,
|
||||
models,
|
||||
codex_models,
|
||||
false,
|
||||
AgentConfigurationOptions {
|
||||
models,
|
||||
codex_models,
|
||||
oauth_configuration: false,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@@ -3482,10 +3492,13 @@ fn build_agent_updates_with_oauth(
|
||||
port: u16,
|
||||
api_key: &str,
|
||||
model: &str,
|
||||
models: &[AgentModelOption],
|
||||
codex_models: Option<&[CodexModelCatalogSpec]>,
|
||||
oauth_configuration: bool,
|
||||
options: AgentConfigurationOptions<'_>,
|
||||
) -> Result<Vec<AgentFileUpdate>, String> {
|
||||
let AgentConfigurationOptions {
|
||||
models,
|
||||
codex_models,
|
||||
oauth_configuration,
|
||||
} = options;
|
||||
let paths = agent_config_paths(client, home);
|
||||
let root_base = format!("http://127.0.0.1:{port}");
|
||||
let openai_base = format!("{root_base}/v1");
|
||||
@@ -5745,9 +5758,11 @@ fn apply_agent_configuration(
|
||||
port,
|
||||
api_key,
|
||||
model,
|
||||
models,
|
||||
codex_models,
|
||||
false,
|
||||
AgentConfigurationOptions {
|
||||
models,
|
||||
codex_models,
|
||||
oauth_configuration: false,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@@ -5757,20 +5772,9 @@ fn apply_agent_configuration_with_oauth(
|
||||
port: u16,
|
||||
api_key: &str,
|
||||
model: &str,
|
||||
models: &[AgentModelOption],
|
||||
codex_models: Option<&[CodexModelCatalogSpec]>,
|
||||
oauth_configuration: bool,
|
||||
options: AgentConfigurationOptions<'_>,
|
||||
) -> Result<AgentConfigActionResult, String> {
|
||||
let updates = build_agent_updates_with_oauth(
|
||||
client,
|
||||
home,
|
||||
port,
|
||||
api_key,
|
||||
model,
|
||||
models,
|
||||
codex_models,
|
||||
oauth_configuration,
|
||||
)?;
|
||||
let updates = build_agent_updates_with_oauth(client, home, port, api_key, model, options)?;
|
||||
commit_agent_configuration(client, home, model, &updates, "applied")
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user