{"record":{"id":"fb40f7e0fda78734","repo":"Hmbown/CodeWhale","slug":"offline-evaluation-harness-reported-failure","errorCode":null,"errorMessage":"offline evaluation harness reported failure","messagePattern":"offline evaluation harness reported failure","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":3135,"sourceCode":"        let failed_steps: Vec<_> = report.steps.iter().filter(|s| !s.success).collect();\n        if !failed_steps.is_empty() {\n            println!(\"failed_steps:\");\n            for step in failed_steps {\n                let error = step.error.as_deref().unwrap_or(\"unknown error\");\n                println!(\n                    \"  {} tool={} error={}\",\n                    step.kind.tool_name(),\n                    step.tool_name,\n                    error\n                );\n            }\n        }\n    }\n\n    if report.metrics.success {\n        Ok(())\n    } else {\n        bail!(\"offline evaluation harness reported failure\")\n    }\n}\n\n/// Score a run's token/cache/cost from recorded turns and (optionally) flag\n/// regressions against a committed baseline. Offline: reads recorded usage from\n/// a JSON file, reuses the pricing layer, never calls a model. Exits non-zero\n/// when a baseline is supplied and a metric regresses past the threshold, so it\n/// can be wired as a release gate (#3388).\nfn run_scorecard(args: ScorecardArgs) -> Result<()> {\n    use crate::scorecard::{RecordedTurn, Scorecard, ScorecardMetrics};\n\n    let raw = std::fs::read_to_string(&args.input)\n        .with_context(|| format!(\"failed to read scorecard input {}\", args.input.display()))?;\n    let recorded: Vec<RecordedTurn> = serde_json::from_str(&raw)\n        .with_context(|| format!(\"failed to parse scorecard input {}\", args.input.display()))?;\n\n    let card = Scorecard::from_recorded_turns(&recorded);\n","sourceCodeStart":3117,"sourceCodeEnd":3153,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/lib.rs#L3117-L3153","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Inspect the eval report printed before the error to see which checks set metrics.success to false","Re-record the turns JSON from a healthy session and rerun the eval","Fix the underlying agent/tool regression the replay exposes, then rerun","Verify the recorded JSON is the intended complete run, not a truncated session"],"exampleFix":"// before: unknown cause\nbail!(\"offline evaluation harness reported failure\")\n// after: run with verbose report output and check metrics\n// cargo run -- offline-eval --recorded turns.json\n// then inspect report.metrics for the failing dimension","handlingStrategy":"validation","validationCode":"let report = build_eval_report(&turns)?;\nif !report.metrics.success {\n    eprintln!(\"eval failed: {:?}\", report.metrics);\n    std::process::exit(1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Print the full metrics report before treating the run as failed","Keep recorded-turns fixtures from known-healthy sessions","Run offline evals with a generous but explicit pass criteria"],"tags":["cli","offline-eval","evaluation"],"backgroundTag":"evaluation-harness-failure","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}