{"record":{"id":"02e711a776bc7b15","repo":"Hmbown/CodeWhale","slug":"the-approval-ui-cannot-persist-deny-rules","errorCode":null,"errorMessage":"the approval UI cannot persist deny rules","messagePattern":"the approval UI cannot persist deny rules","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tui/ui/session_state.rs","lineNumber":742,"sourceCode":"        }\n    }\n    app.needs_redraw = true;\n}\n\npub(crate) fn persist_rules_from_approval(\n    app: &mut App,\n    config: &mut Config,\n    rules: &[codewhale_config::ToolAskRule],\n) {\n    let action = rules.first().map(|rule| rule.action);\n    match codewhale_config::ConfigStore::load(app.config_path.clone()).and_then(|mut store| {\n        let added = match action {\n            Some(codewhale_execpolicy::PermissionAction::Ask) => store.append_ask_rules(rules)?,\n            Some(codewhale_execpolicy::PermissionAction::Allow) => {\n                store.append_allow_rules(rules)?\n            }\n            Some(codewhale_execpolicy::PermissionAction::Deny) => {\n                anyhow::bail!(\"the approval UI cannot persist deny rules\")\n            }\n            None => 0,\n        };\n        let permissions_path = store.permissions_path();\n        config.exec_policy_engine = store.exec_policy_engine();\n        Ok((added, permissions_path))\n    }) {\n        Ok((added, path)) if added > 0 => {\n            let action = match action {\n                Some(codewhale_execpolicy::PermissionAction::Allow) => \"allow\",\n                _ => \"ask\",\n            };\n            app.status_message = Some(format!(\n                \"Saved {added} {action} permission rule(s) to {}\",\n                path.display()\n            ));\n        }\n        Ok((_added, path)) => {","sourceCodeStart":724,"sourceCodeEnd":760,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/tui/ui/session_state.rs#L724-L760","documentation":"Raised from the approval-UI persistence path (persist_rules_from_approval) when attempting to persist deny rules. The match on the rule action handles Ask and Allow rules by appending them to the config store, but deny rules have no persistent store representation from the approval dialog, so the request is rejected with this sentinel error rather than silently dropped.","triggerScenarios":"Thrown at crates/tui/src/tui/ui/session_state.rs:742 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add deny rules through the config file or execpolicy tooling that supports persisting denies","Use Ask or Allow actions in the approval UI if persistence is required","Treat an in-session deny from the approval UI as session-only by design"],"exampleFix":null,"handlingStrategy":"validation","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"}