{"record":{"id":"43f08ae26af880d8","repo":"Hmbown/CodeWhale","slug":"metric-s-regressed-past-the-1-threshold","errorCode":null,"errorMessage":"{} metric(s) regressed past the {:.1}% threshold","messagePattern":"(.+?) metric\\(s\\) regressed past the (.+?)% threshold","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":3185,"sourceCode":"            \"per_turn\": card.per_turn,\n            \"metrics\": card.metrics,\n            \"regressions\": regressions,\n        });\n        println!(\"{}\", serde_json::to_string_pretty(&out)?);\n    } else {\n        print!(\"{}\", card.to_summary());\n        for r in &regressions {\n            println!(\n                \"REGRESSION {}: baseline {:.4} -> current {:.4} (+{:.1}%)\",\n                r.metric, r.baseline, r.current, r.pct_increase\n            );\n        }\n    }\n\n    if regressions.is_empty() {\n        Ok(())\n    } else {\n        bail!(\n            \"{} metric(s) regressed past the {:.1}% threshold\",\n            regressions.len(),\n            args.threshold\n        )\n    }\n}\n\nasync fn run_fleet_command(workspace: &Path, config: &Config, args: FleetArgs) -> Result<()> {\n    use crate::fleet::alerts::{\n        FleetAlertAdapterConfig, FleetAlertConfig, FleetAlertDispatcher, FleetAlertEvent,\n        FleetEnvSecretResolver,\n    };\n    use crate::fleet::control as fleet_control;\n    use crate::fleet::executor::FleetExecutor;\n    use crate::fleet::manager::{FleetManager, FleetStatusSnapshot, FleetWorkerInspection};\n    use codewhale_lane::{ControlOperation, ControlSurface};\n    use codewhale_protocol::fleet::{FleetAlertEventClass, FleetArtifactKind, FleetRunId};\n","sourceCodeStart":3167,"sourceCodeEnd":3203,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/lib.rs#L3167-L3203","documentation":"The offline score/regression command compares a run's token/cache/cost metrics against a committed baseline and bails when one or more metrics regressed by more than the user-supplied threshold percentage. The message reports the count of regressed metrics and the threshold used.","triggerScenarios":"Running the score command where regressions is non-empty: at least one metric (tokens, cache hit rate, cost) got worse by more than args.threshold percent versus the baseline JSON.","commonSituations":"A prompt or context change inflated token usage; cache behavior regressed after a prompt-prefix change; a too-tight --threshold value flags ordinary variance in CI.","solutions":["Read the printed regression list to see which metrics and by how much they moved","If the change is intentional, regenerate/commit a new baseline file","Loosen --threshold if ordinary run-to-run variance is being flagged","Fix the prompt/context change that caused the regression"],"exampleFix":"// before\n// codewhale score --baseline baseline.json --threshold 1.0  // fails\n// after: allow realistic variance or refresh the baseline\n// codewhale score --baseline baseline.json --threshold 5.0\n// or re-record an intentional baseline","handlingStrategy":"validation","validationCode":"let regressions = compare_to_baseline(&metrics, &baseline, threshold);\nif !regressions.is_empty() {\n    eprintln!(\"regressed: {regressions:?}\");\n    std::process::exit(1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set --threshold above ordinary run-to-run variance","Refresh the committed baseline whenever an intentional cost/usage change lands","Review the per-metric regression list before rerunning CI"],"tags":["cli","regression","metrics","ci"],"backgroundTag":"metric-regression-threshold","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"}