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:
Dhanji R. Prasanna
2026-01-20 22:49:55 +05:30
parent 60578e310c
commit 38b0019ad4
4 changed files with 16 additions and 11 deletions

View File

@@ -224,7 +224,7 @@ impl Completer for G3Helper {
let path: &str = &path_unescaped;
// 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() {
return Ok((pos, vec![]));

View File

@@ -164,6 +164,7 @@ impl G3Status {
/// Print an info message in dimmed/grey text.
/// Format: "... <message>"
#[allow(dead_code)]
pub fn info(message: &str) {
println!(
"{}... {}{}",
@@ -202,9 +203,13 @@ impl G3Status {
ResetColor
),
Status::Error(msg) => format!(
"{}[error: {}]{}",
"{}{}{}",
SetForegroundColor(Color::Red),
msg,
if msg.is_empty() {
"[error]".to_string()
} else {
format!("[error: {}]", msg)
},
ResetColor
),
Status::Resolved => format!(

View File

@@ -84,11 +84,11 @@ pub async fn execute_task_with_retry<W: UiWriter>(
// Print error status
G3Status::complete(
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)
G3Status::progress(&format!("retrying in {:.1}s", delay_secs));
G3Status::progress(&format!("retrying in {:.1}s ({}/{})", delay_secs, attempt, MAX_RETRIES));
// Wait before retrying
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.
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)
let error_type = classify_error(e);
let is_recoverable = matches!(error_type, ErrorType::Recoverable(_));

View File

@@ -10,7 +10,7 @@ use crate::ui_writer::UiWriter;
use crate::{Agent, DiscoveryOptions, TaskResult};
use anyhow::Result;
use std::time::Instant;
use tracing::{debug, warn};
use tracing::debug;
/// Configuration for retry behavior
#[derive(Debug, Clone)]
@@ -206,11 +206,11 @@ where
let delay_secs = delay.as_secs_f64();
// 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);
// 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);
debug!(
@@ -283,10 +283,10 @@ where
let delay_secs = delay.as_secs_f64();
// 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);
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);
tokio::time::sleep(delay).await;