{"record":{"id":"3037390cc1ae6388","repo":"Hmbown/CodeWhale","slug":"fleet-executor-outcome-must-contain-a-terminal-wor","errorCode":null,"errorMessage":"fleet executor outcome must contain a terminal worker event","messagePattern":"fleet executor outcome must contain a terminal worker event","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/fleet/manager.rs","lineNumber":1654,"sourceCode":"            || current.entry.attempts != task.entry.attempts\n        {\n            return Ok(false);\n        }\n\n        let FleetWorkerTerminalEvent {\n            payload,\n            exit_code,\n            tail_payloads,\n            reported_route,\n            requires_reported_route,\n        } = terminal;\n        let (receipt_result, failure_kind, exit_code) = task_receipt_outcome(&payload, exit_code);\n        let terminal_completed = matches!(&payload, FleetWorkerEventPayload::Completed { .. });\n        let expected_terminal_status = match &payload {\n            FleetWorkerEventPayload::Completed { .. } => FleetTaskLedgerStatus::Completed,\n            FleetWorkerEventPayload::Failed { .. } => FleetTaskLedgerStatus::Failed,\n            FleetWorkerEventPayload::Cancelled { .. } => FleetTaskLedgerStatus::Cancelled,\n            _ => bail!(\"fleet executor outcome must contain a terminal worker event\"),\n        };\n        for tail_payload in tail_payloads {\n            if is_terminal_payload(&tail_payload) {\n                continue;\n            }\n            if self\n                .ledger\n                .append_event_if_leased(\n                    &task.entry.run_id,\n                    &task.worker_id,\n                    &task.entry.task_id,\n                    task.entry.attempts,\n                    &timestamp(),\n                    tail_payload,\n                )?\n                .is_none()\n            {\n                return Ok(false);","sourceCodeStart":1636,"sourceCodeEnd":1672,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/fleet/manager.rs#L1636-L1672","documentation":"The terminal-outcome handler destructures a FleetExecutorTerminalEvent and requires payload to be Completed, Failed, or Cancelled; anything else hits the 'must contain a terminal worker event' bail. This is an internal invariant violation: the executor emitted an outcome labelled terminal whose payload is not a terminal event type.","triggerScenarios":"Produced only by a mismatch between the executor and manager: a version-skewed worker/executor sending a non-terminal payload in the terminal slot, or a bug in outcome construction. No user configuration causes it.","commonSituations":"Running mixed Codewhale binary versions in a fleet (SSH remote workers older than the local manager); a custom build patched to add a new event type without updating this match.","solutions":["Ensure the manager and all workers (including SSH remotes) run the same Codewhale version","Restart the affected run with a single consistent binary","Collect the ledger events around the failure and report it as a bug with versions attached"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"fn payload_is_terminal(payload: &FleetWorkerEventPayload) -> bool {\n    matches!(\n        payload,\n        FleetWorkerEventPayload::Completed { .. }\n            | FleetWorkerEventPayload::Failed { .. }\n            | FleetWorkerEventPayload::Cancelled { .. }\n    )\n}","tryCatchPattern":"match handle_terminal(outcome) {\n    Ok(receipt) => Ok(receipt),\n    Err(err) if err.to_string().contains(\"must contain a terminal worker event\") => {\n        // log ledger context + versions and report upstream; do not retry blindly\n        Err(err)\n    }\n    Err(err) => Err(err),\n}","preventionTips":["Pin matching Codewhale versions on the manager and all SSH remote workers","Include binary versions in fleet logs to diagnose skew quickly","Never construct terminal outcomes with non-terminal payloads in custom executors"],"tags":["fleet","invariant-violation","version-mismatch","rust","codewhale"],"backgroundTag":"protocol-invariant-violation","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}