{"record":{"id":"139555e5a73d042e","repo":"Hmbown/CodeWhale","slug":"message-publication-publication-completed-review-passes","errorCode":null,"errorMessage":"{message}; publication: {publication}; completed review passes: {completed_passes}/{planned_passes}; accumulated usage: {usage}","messagePattern":"(.+?); publication: (.+?); completed review passes: (.+?)/(.+?); accumulated usage: (.+?)","errorType":"error_code","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":9038,"sourceCode":") -> Result<()> {\n    let message = message.into();\n    if args.json {\n        println!(\n            \"{}\",\n            serde_json::to_string_pretty(&review_failure_payload(\n                provider,\n                model,\n                usage,\n                completed_passes,\n                planned_passes,\n                publication,\n                &message,\n            ))?\n        );\n    }\n    let usage = serde_json::to_string(usage)?;\n    let publication = publication.as_str();\n    bail!(\n        \"{message}; publication: {publication}; completed review passes: {completed_passes}/{planned_passes}; accumulated usage: {usage}\"\n    )\n}\n\n/// Apply `codewhale review --provider <name>` and decide whether the route is\n/// authoritative (no cross-provider inventory inference).\n///\n/// This mirrors `codewhale exec --provider` (#4093): the flag sets ONLY the\n/// non-secret provider identity, and pinning the route is what lets a model\n/// offered by more than one configured route resolve instead of hard-erroring\n/// in `resolve_cli_auto_route`.\nfn review_execution_route(config: &Config, args: &ReviewArgs) -> Result<(Config, bool)> {\n    let explicit_provider = non_empty_flag(args.provider.as_deref());\n    let explicit_model = non_empty_flag(args.model.as_deref());\n    let mut resolved = config.clone();\n    if let Some(provider_arg) = explicit_provider {\n        apply_exec_provider_override(&mut resolved, provider_arg)?;\n    }","sourceCodeStart":9020,"sourceCodeEnd":9056,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/lib.rs#L9020-L9056","documentation":"Terminal bail for a failed PR review run: it wraps the underlying failure message and appends the publication mode, how many of the planned review passes completed, and the accumulated token usage serialized as JSON. It exists so a failed multi-pass review still reports progress and cost context in one message.","triggerScenarios":"Any failure during a `codewhale review` run after passes have started: the underlying error `message` is caught, then this bail re-raises it with publication status, completed_passes/planned_passes, and usage JSON appended.","commonSituations":"A review pass fails mid-run (API error, provider failure); diagnosing how far a multi-pass review got and how much budget it consumed before failing.","solutions":["Read the leading `{message}` segment for the root cause and fix that underlying error","Check completed passes vs planned; re-run with a higher --max-passes if the run was cut short","Inspect the accumulated usage JSON to check whether token/char limits contributed to the failure"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// the bail appends progress/usage to the root cause; parse the leading message for the real error\nlet err = run_review().await.unwrap_err();\nlet root = err.to_string().split(\"; publication:\").next().unwrap_or(\"\");\neprintln!(\"review failed: {root}\");","preventionTips":["Fix the underlying cause named before the first `;` in the message","Monitor accumulated usage so token/char budgets are not exhausted mid-run","Re-run with the same --max-passes to resume-equivalent coverage"],"tags":["cli","review","usage","failure-summary"],"backgroundTag":"review-run-failed","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T16:17:23.217Z"}