{"record":{"id":"4acdede64843f86f","repo":"Hmbown/CodeWhale","slug":"repl-kernel-stays-alive-during-a-round","errorCode":null,"errorMessage":"REPL kernel stays alive during a round","messagePattern":"REPL kernel stays alive during a round","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/core/engine/turn_loop.rs","lineNumber":1725,"sourceCode":"                    let repl_started = Instant::now();\n\n                    let mut final_result: Option<String> = None;\n                    let mut kernel_failed = false;\n                    let mut empty_cap_hit = false;\n                    for (i, block) in repl_blocks.iter().enumerate() {\n                        let round_num = i + 1;\n                        let _ = self\n                            .tx_event\n                            .send(Event::status(format!(\n                                \"REPL round {round_num}: executing...\"\n                            )))\n                            .await;\n\n                        let round_result = match bridge.as_ref() {\n                            Some(bridge) => {\n                                self.repl_kernel\n                                    .as_mut()\n                                    .expect(\"REPL kernel stays alive during a round\")\n                                    .run(&block.code, Some(bridge))\n                                    .await\n                            }\n                            None => {\n                                self.repl_kernel\n                                    .as_mut()\n                                    .expect(\"REPL kernel stays alive during a round\")\n                                    .execute(&block.code)\n                                    .await\n                            }\n                        };\n\n                        match round_result {\n                            Ok(round) => {\n                                if let Some(val) = &round.final_value {\n                                    let _ = self\n                                        .tx_event\n                                        .send(Event::status(format!(","sourceCodeStart":1707,"sourceCodeEnd":1743,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/core/engine/turn_loop.rs#L1707-L1743","documentation":"During a REPL round the kernel is expected to remain alive for the whole block loop; the assertion that the kernel is still present mid-round guards against code that could drop or replace it between blocks. Firing means something released the kernel mid-round — an internal invariant violation.","triggerScenarios":"Thrown at crates/tui/src/core/engine/turn_loop.rs:1725 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Find code that clears/replaces repl_kernel during a round and move it to round boundaries","Keep the kernel owned for the duration of the round scope"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}