Fix compile warnings and tweak error message format
Warnings fixed: - Remove unused 'warn' import from retry.rs - Prefix unused 'output' param with underscore - Prefix unused 'rel_start' with underscore - Add #[allow(dead_code)] to G3Status::info() Message format tweaked per feedback: - 'g3: model overloaded [error]' (no attempt info) - 'g3: retrying in 2.2s (1/3) ... [done]' (attempt info moved here) - Handle empty error message in Status::Error to show just '[error]'
This commit is contained in:
@@ -224,7 +224,7 @@ impl Completer for G3Helper {
|
|||||||
let path: &str = &path_unescaped;
|
let path: &str = &path_unescaped;
|
||||||
|
|
||||||
// Complete just the path portion
|
// Complete just the path portion
|
||||||
let (rel_start, completions) = self.file_completer.complete(path, path.len(), ctx)?;
|
let (_rel_start, completions) = self.file_completer.complete(path, path.len(), ctx)?;
|
||||||
|
|
||||||
if completions.is_empty() {
|
if completions.is_empty() {
|
||||||
return Ok((pos, vec![]));
|
return Ok((pos, vec![]));
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ impl G3Status {
|
|||||||
|
|
||||||
/// Print an info message in dimmed/grey text.
|
/// Print an info message in dimmed/grey text.
|
||||||
/// Format: "... <message>"
|
/// Format: "... <message>"
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn info(message: &str) {
|
pub fn info(message: &str) {
|
||||||
println!(
|
println!(
|
||||||
"{}... {}{}",
|
"{}... {}{}",
|
||||||
@@ -202,9 +203,13 @@ impl G3Status {
|
|||||||
ResetColor
|
ResetColor
|
||||||
),
|
),
|
||||||
Status::Error(msg) => format!(
|
Status::Error(msg) => format!(
|
||||||
"{}[error: {}]{}",
|
"{}{}{}",
|
||||||
SetForegroundColor(Color::Red),
|
SetForegroundColor(Color::Red),
|
||||||
msg,
|
if msg.is_empty() {
|
||||||
|
"[error]".to_string()
|
||||||
|
} else {
|
||||||
|
format!("[error: {}]", msg)
|
||||||
|
},
|
||||||
ResetColor
|
ResetColor
|
||||||
),
|
),
|
||||||
Status::Resolved => format!(
|
Status::Resolved => format!(
|
||||||
|
|||||||
@@ -84,11 +84,11 @@ pub async fn execute_task_with_retry<W: UiWriter>(
|
|||||||
// Print error status
|
// Print error status
|
||||||
G3Status::complete(
|
G3Status::complete(
|
||||||
recoverable_error_name(&recoverable_error),
|
recoverable_error_name(&recoverable_error),
|
||||||
crate::g3_status::Status::Error(format!("attempt {}/{}", attempt, MAX_RETRIES)),
|
crate::g3_status::Status::Error(String::new()),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Print retry message (no newline, will show [done] after sleep)
|
// Print retry message (no newline, will show [done] after sleep)
|
||||||
G3Status::progress(&format!("retrying in {:.1}s", delay_secs));
|
G3Status::progress(&format!("retrying in {:.1}s ({}/{})", delay_secs, attempt, MAX_RETRIES));
|
||||||
|
|
||||||
// Wait before retrying
|
// Wait before retrying
|
||||||
tokio::time::sleep(delay).await;
|
tokio::time::sleep(delay).await;
|
||||||
@@ -106,7 +106,7 @@ pub async fn execute_task_with_retry<W: UiWriter>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Handle execution errors with detailed logging and user-friendly output.
|
/// Handle execution errors with detailed logging and user-friendly output.
|
||||||
pub fn handle_execution_error(e: &anyhow::Error, input: &str, output: &SimpleOutput, attempt: u32) {
|
pub fn handle_execution_error(e: &anyhow::Error, input: &str, _output: &SimpleOutput, attempt: u32) {
|
||||||
// Check if this is a recoverable error type (for logging level decision)
|
// Check if this is a recoverable error type (for logging level decision)
|
||||||
let error_type = classify_error(e);
|
let error_type = classify_error(e);
|
||||||
let is_recoverable = matches!(error_type, ErrorType::Recoverable(_));
|
let is_recoverable = matches!(error_type, ErrorType::Recoverable(_));
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ use crate::ui_writer::UiWriter;
|
|||||||
use crate::{Agent, DiscoveryOptions, TaskResult};
|
use crate::{Agent, DiscoveryOptions, TaskResult};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
use tracing::{debug, warn};
|
use tracing::debug;
|
||||||
|
|
||||||
/// Configuration for retry behavior
|
/// Configuration for retry behavior
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
@@ -206,11 +206,11 @@ where
|
|||||||
let delay_secs = delay.as_secs_f64();
|
let delay_secs = delay.as_secs_f64();
|
||||||
|
|
||||||
// Clean error message
|
// Clean error message
|
||||||
let msg = format!("g3: {:?} [error: attempt {}/{}]", recoverable_type, retry_count, config.max_retries);
|
let msg = format!("g3: {:?} [error]", recoverable_type);
|
||||||
print_fn(&msg);
|
print_fn(&msg);
|
||||||
|
|
||||||
// Retry message - note: can't show [done] here since we don't control when sleep finishes
|
// Retry message - note: can't show [done] here since we don't control when sleep finishes
|
||||||
let retry_msg = format!("g3: retrying in {:.1}s ...", delay_secs);
|
let retry_msg = format!("g3: retrying in {:.1}s ({}/{}) ...", delay_secs, retry_count, config.max_retries);
|
||||||
print_fn(&retry_msg);
|
print_fn(&retry_msg);
|
||||||
|
|
||||||
debug!(
|
debug!(
|
||||||
@@ -283,10 +283,10 @@ where
|
|||||||
let delay_secs = delay.as_secs_f64();
|
let delay_secs = delay.as_secs_f64();
|
||||||
|
|
||||||
// Clean error message
|
// Clean error message
|
||||||
let msg = format!("g3: {:?} [error: attempt {}/{}]", recoverable_type, retry_count, max_retries);
|
let msg = format!("g3: {:?} [error]", recoverable_type);
|
||||||
print_fn(&msg);
|
print_fn(&msg);
|
||||||
|
|
||||||
let retry_msg = format!("g3: retrying in {:.1}s ...", delay_secs);
|
let retry_msg = format!("g3: retrying in {:.1}s ({}/{}) ...", delay_secs, retry_count, max_retries);
|
||||||
print_fn(&retry_msg);
|
print_fn(&retry_msg);
|
||||||
|
|
||||||
tokio::time::sleep(delay).await;
|
tokio::time::sleep(delay).await;
|
||||||
|
|||||||
Reference in New Issue
Block a user