Hmbown/CodeWhale · error · anyhow::Error

offline evaluation harness reported failure

Error message

offline evaluation harness reported failure

What it means

The offline evaluation harness (an offline replay of recorded turns) completed but its computed report has metrics.success == false, so the CLI bails with a non-zero exit. The library throws this because an offline eval whose success metric failed is a failed evaluation even though no model/network call occurred.

Solutions

  1. Inspect the eval report printed before the error to see which checks set metrics.success to false
  2. Re-record the turns JSON from a healthy session and rerun the eval
  3. Fix the underlying agent/tool regression the replay exposes, then rerun
  4. Verify the recorded JSON is the intended complete run, not a truncated session

Example fix

// before: unknown cause
bail!("offline evaluation harness reported failure")
// after: run with verbose report output and check metrics
// cargo run -- offline-eval --recorded turns.json
// then inspect report.metrics for the failing dimension
Defensive patterns

Strategy: validation

Validate before calling

let report = build_eval_report(&turns)?;
if !report.metrics.success {
    eprintln!("eval failed: {:?}", report.metrics);
    std::process::exit(1);
}

Prevention

When it happens

Trigger: Running the offline evaluation command over a recorded-turns JSON file whose replayed run produces report.metrics.success == false (e.g. the recorded run contained tool failures, errors, or an incomplete turn).

Common situations: CI offline-eval jobs failing after a code change altered agent behavior so recorded runs no longer succeed; feeding an eval file captured from a broken session; malformed usage records causing metric computation to mark the run unsuccessful.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/fb40f7e0fda78734. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/lib.rs:3135

        let failed_steps: Vec<_> = report.steps.iter().filter(|s| !s.success).collect();
        if !failed_steps.is_empty() {
            println!("failed_steps:");
            for step in failed_steps {
                let error = step.error.as_deref().unwrap_or("unknown error");
                println!(
                    "  {} tool={} error={}",
                    step.kind.tool_name(),
                    step.tool_name,
                    error
                );
            }
        }
    }

    if report.metrics.success {
        Ok(())
    } else {
        bail!("offline evaluation harness reported failure")
    }
}

/// Score a run's token/cache/cost from recorded turns and (optionally) flag
/// regressions against a committed baseline. Offline: reads recorded usage from
/// a JSON file, reuses the pricing layer, never calls a model. Exits non-zero
/// when a baseline is supplied and a metric regresses past the threshold, so it
/// can be wired as a release gate (#3388).
fn run_scorecard(args: ScorecardArgs) -> Result<()> {
    use crate::scorecard::{RecordedTurn, Scorecard, ScorecardMetrics};

    let raw = std::fs::read_to_string(&args.input)
        .with_context(|| format!("failed to read scorecard input {}", args.input.display()))?;
    let recorded: Vec<RecordedTurn> = serde_json::from_str(&raw)
        .with_context(|| format!("failed to parse scorecard input {}", args.input.display()))?;

    let card = Scorecard::from_recorded_turns(&recorded);

View on GitHub (pinned to 73e0f67d83)