Skip to content

Commit 770df7d

Browse files
authored
Fix rustfmt formatting violations to unblock CI on release/v0.0.11 (#99)
Run cargo fmt --all to fix formatting across 8 files that failed the rustfmt check in CI (runs/23273074858 and runs/23273086485).
1 parent 360525f commit 770df7d

8 files changed

Lines changed: 65 additions & 71 deletions

File tree

crates/llm-cli-wrapper/src/session/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ pub mod subprocess_session_backend;
1717
pub(crate) async fn kill_and_reap_child(child: &mut tokio::process::Child) {
1818
#[cfg(unix)]
1919
if let Some(pid) = child.id() {
20-
let _ = std::process::Command::new("kill")
21-
.args(["-9", &format!("-{}", pid)])
22-
.output();
20+
let _ = std::process::Command::new("kill").args(["-9", &format!("-{}", pid)]).output();
2321
}
2422
#[cfg(not(unix))]
2523
let _ = child.kill().await;

crates/oai-runner/src/config.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ pub fn resolve_config(model: &str, api_base: Option<String>, api_key: Option<Str
3636
}
3737

3838
fn infer_structured_output_support(normalized_model: &str) -> StructuredOutputSupport {
39-
if normalized_model.starts_with("zai")
40-
|| normalized_model.starts_with("glm")
41-
|| normalized_model.contains("glm")
42-
{
39+
if normalized_model.starts_with("zai") || normalized_model.starts_with("glm") || normalized_model.contains("glm") {
4340
return StructuredOutputSupport::JsonObjectOnly;
4441
}
4542
if normalized_model.starts_with("minimax/") || normalized_model.contains("minimax") {

crates/oai-runner/src/main.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,7 @@ async fn main() -> Result<()> {
156156
cancel_for_signal.cancel();
157157
});
158158

159-
let structured_output = if no_response_format {
160-
None
161-
} else {
162-
Some(resolved_config.structured_output)
163-
};
159+
let structured_output = if no_response_format { None } else { Some(resolved_config.structured_output) };
164160

165161
let result = runner::agent_loop::run_agent_loop(
166162
&client,

crates/oai-runner/src/runner/agent_loop.rs

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,12 @@ fn build_json_schema_format(schema: &Value) -> ResponseFormat {
5252
}
5353
ResponseFormat {
5454
type_: "json_schema".to_string(),
55-
json_schema: Some(JsonSchemaSpec {
56-
name: "phase_output".to_string(),
57-
strict: true,
58-
schema: strict_schema,
59-
}),
55+
json_schema: Some(JsonSchemaSpec { name: "phase_output".to_string(), strict: true, schema: strict_schema }),
6056
}
6157
}
6258

6359
fn build_json_object_format() -> ResponseFormat {
64-
ResponseFormat {
65-
type_: "json_object".to_string(),
66-
json_schema: None,
67-
}
60+
ResponseFormat { type_: "json_object".to_string(), json_schema: None }
6861
}
6962

7063
fn build_schema_injection(schema: &Value) -> String {
@@ -117,8 +110,8 @@ pub async fn run_agent_loop(
117110
}
118111
}
119112

120-
let needs_schema_in_prompt = structured_output == Some(StructuredOutputSupport::JsonObjectOnly)
121-
&& response_schema.is_some();
113+
let needs_schema_in_prompt =
114+
structured_output == Some(StructuredOutputSupport::JsonObjectOnly) && response_schema.is_some();
122115

123116
if messages.is_empty() {
124117
let mut sys = system_prompt.to_string();
@@ -195,10 +188,22 @@ pub async fn run_agent_loop(
195188
if let Some(schema) = response_schema {
196189
if let Err(errors) = validate_output_against_schema(content, schema) {
197190
let system_msg = messages.iter().find(|m| m.role == "system").cloned();
198-
let corrected =
199-
retry_schema_validation(client, model, system_msg.as_ref(), &mut messages, schema, &errors, output, structured_output).await;
191+
let corrected = retry_schema_validation(
192+
client,
193+
model,
194+
system_msg.as_ref(),
195+
&mut messages,
196+
schema,
197+
&errors,
198+
output,
199+
structured_output,
200+
)
201+
.await;
200202
if !corrected {
201-
eprintln!("Warning: schema validation failed after {} retries, synthesizing fallback result", SCHEMA_RETRY_LIMIT);
203+
eprintln!(
204+
"Warning: schema validation failed after {} retries, synthesizing fallback result",
205+
SCHEMA_RETRY_LIMIT
206+
);
202207
schema_ok = false;
203208
}
204209
}
@@ -302,12 +307,8 @@ async fn retry_schema_validation(
302307
) -> bool {
303308
let mut last_errors = initial_errors.to_string();
304309

305-
let last_assistant_content = messages
306-
.iter()
307-
.rev()
308-
.find(|m| m.role == "assistant")
309-
.and_then(|m| m.content.clone())
310-
.unwrap_or_default();
310+
let last_assistant_content =
311+
messages.iter().rev().find(|m| m.role == "assistant").and_then(|m| m.content.clone()).unwrap_or_default();
311312

312313
for attempt in 1..=SCHEMA_RETRY_LIMIT {
313314
eprintln!("Schema validation failed (attempt {}/{}): {}", attempt, SCHEMA_RETRY_LIMIT, last_errors);
@@ -389,14 +390,17 @@ fn validate_output_against_schema(content: &str, schema: &Value) -> std::result:
389390

390391
let validator = jsonschema::validator_for(schema).map_err(|e| format!("Invalid schema: {}", e))?;
391392

392-
let errors: Vec<String> = validator.iter_errors(&parsed).map(|e| {
393-
let path = e.instance_path().to_string();
394-
if path.is_empty() {
395-
format!("{}", e)
396-
} else {
397-
format!("at '{}': {}", path, e)
398-
}
399-
}).collect();
393+
let errors: Vec<String> = validator
394+
.iter_errors(&parsed)
395+
.map(|e| {
396+
let path = e.instance_path().to_string();
397+
if path.is_empty() {
398+
format!("{}", e)
399+
} else {
400+
format!("at '{}': {}", path, e)
401+
}
402+
})
403+
.collect();
400404

401405
if errors.is_empty() {
402406
Ok(())

crates/orchestrator-cli/src/services/operations/ops_mcp/runner_tools.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,11 @@ impl AoMcpServer {
4444
description = "Clean up orphaned runner processes. Purpose: Remove runner processes that are no longer managed by the daemon. Prerequisites: Use ao.runner.orphans-detect first to identify orphaned run IDs. Example: {\"run_id\": [\"abc123\"]}. Sequencing: Use after ao.runner.orphans-detect to find orphan IDs, then ao.runner.health to verify cleanup.",
4545
input_schema = ao_schema_for_type::<RunnerOrphansCleanupInput>()
4646
)]
47-
async fn ao_runner_orphans_cleanup(&self, params: Parameters<RunnerOrphansCleanupInput>) -> Result<CallToolResult, McpError> {
48-
let mut args = vec![
49-
"runner".to_string(),
50-
"orphans".to_string(),
51-
"cleanup".to_string(),
52-
];
47+
async fn ao_runner_orphans_cleanup(
48+
&self,
49+
params: Parameters<RunnerOrphansCleanupInput>,
50+
) -> Result<CallToolResult, McpError> {
51+
let mut args = vec!["runner".to_string(), "orphans".to_string(), "cleanup".to_string()];
5352
for id in &params.0.run_id {
5453
args.push("--run-id".to_string());
5554
args.push(id.clone());

crates/orchestrator-cli/src/services/operations/ops_workflow/mod.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,22 @@ async fn resolve_workflow_run_dispatch_from_input(
7373
project_root: &str,
7474
input: WorkflowRunInput,
7575
) -> Result<protocol::SubjectDispatch> {
76-
let WorkflowRunInput { subject, workflow_ref, input, vars, task_id: flat_task_id, requirement_id: flat_requirement_id, .. } = input;
77-
let effective_task_id = subject.task_id().filter(|id| !id.is_empty()).map(|s| s.to_string())
76+
let WorkflowRunInput {
77+
subject,
78+
workflow_ref,
79+
input,
80+
vars,
81+
task_id: flat_task_id,
82+
requirement_id: flat_requirement_id,
83+
..
84+
} = input;
85+
let effective_task_id = subject
86+
.task_id()
87+
.filter(|id| !id.is_empty())
88+
.map(|s| s.to_string())
7889
.or_else(|| (!flat_task_id.is_empty()).then_some(flat_task_id));
79-
let effective_requirement_id = subject.requirement_id().filter(|id| !id.is_empty()).map(|s| s.to_string())
80-
.or(flat_requirement_id);
90+
let effective_requirement_id =
91+
subject.requirement_id().filter(|id| !id.is_empty()).map(|s| s.to_string()).or(flat_requirement_id);
8192
if let Some(id) = effective_task_id {
8293
let task = hub.tasks().get(&id).await?;
8394
Ok(protocol::SubjectDispatch::for_task_with_metadata(

crates/orchestrator-cli/src/services/runtime/runtime_daemon/daemon_reconciliation.rs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -173,18 +173,11 @@ fn workflow_is_waiting_on_manual_phase(project_root: &str, workflow: &orchestrat
173173
.unwrap_or(false)
174174
}
175175

176-
pub async fn reconcile_runner_blocked_tasks(
177-
hub: Arc<dyn ServiceHub>,
178-
_project_root: &str,
179-
) -> Result<usize> {
176+
pub async fn reconcile_runner_blocked_tasks(hub: Arc<dyn ServiceHub>, _project_root: &str) -> Result<usize> {
180177
let tasks = match hub.tasks().list().await {
181178
Ok(tasks) => tasks,
182179
Err(error) => {
183-
eprintln!(
184-
"{}: failed to list tasks for runner-blocked reconciliation: {}",
185-
protocol::ACTOR_DAEMON,
186-
error
187-
);
180+
eprintln!("{}: failed to list tasks for runner-blocked reconciliation: {}", protocol::ACTOR_DAEMON, error);
188181
return Ok(0);
189182
}
190183
};
@@ -202,12 +195,7 @@ pub async fn reconcile_runner_blocked_tasks(
202195
// Escalated to human review — task left blocked
203196
}
204197
Err(error) => {
205-
eprintln!(
206-
"{}: failed to reconcile runner-blocked task {}: {}",
207-
protocol::ACTOR_DAEMON,
208-
task.id,
209-
error
210-
);
198+
eprintln!("{}: failed to reconcile runner-blocked task {}: {}", protocol::ACTOR_DAEMON, task.id, error);
211199
}
212200
}
213201
}

crates/orchestrator-core/src/execution_projection.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,7 @@ pub fn is_workflow_runner_blocked(task: &OrchestratorTask) -> bool {
4444
/// been reset. Once the count reaches `MAX_RUNNER_FAILURE_RESETS` the task is
4545
/// left blocked and an error message is logged, signalling that human
4646
/// intervention is needed.
47-
pub async fn reconcile_runner_blocked_task(
48-
hub: Arc<dyn ServiceHub>,
49-
task: &OrchestratorTask,
50-
) -> anyhow::Result<bool> {
47+
pub async fn reconcile_runner_blocked_task(hub: Arc<dyn ServiceHub>, task: &OrchestratorTask) -> anyhow::Result<bool> {
5148
let count = task.consecutive_dispatch_failures.unwrap_or(0).saturating_add(1);
5249

5350
if count > MAX_RUNNER_FAILURE_RESETS {
@@ -243,7 +240,10 @@ mod tests {
243240
use chrono::Utc;
244241
use protocol::{SubjectExecutionFact, SUBJECT_KIND_TASK};
245242

246-
use super::{execution_fact_subject_kind, is_workflow_runner_blocked, project_execution_fact, reconcile_runner_blocked_task, MAX_RUNNER_FAILURE_RESETS};
243+
use super::{
244+
execution_fact_subject_kind, is_workflow_runner_blocked, project_execution_fact, reconcile_runner_blocked_task,
245+
MAX_RUNNER_FAILURE_RESETS,
246+
};
247247
use crate::{
248248
services::ServiceHub, InMemoryServiceHub, OrchestratorTask, Priority, ResourceRequirements, Scope,
249249
TaskMetadata, TaskStatus, TaskType, WorkflowMetadata,
@@ -450,7 +450,8 @@ mod tests {
450450
status: TaskStatus::Blocked,
451451
paused: true,
452452
blocked_reason: Some(
453-
"workflow runner exited without workflow status: workflow runner exited with status Some(1)".to_string(),
453+
"workflow runner exited without workflow status: workflow runner exited with status Some(1)"
454+
.to_string(),
454455
),
455456
..base_test_task("TASK-1")
456457
};

0 commit comments

Comments
 (0)