cleanup forbidden messaging

This commit is contained in:
kevin zhao
2025-12-03 17:57:40 +00:00
parent 572848d9f0
commit 7200d7fca3
+2 -1
View File
@@ -25,6 +25,7 @@ use crate::sandboxing::SandboxPermissions;
use crate::tools::sandboxing::ApprovalRequirement;
const FORBIDDEN_REASON: &str = "execpolicy forbids this command";
const PROMPT_CONFLICT_REASON: &str = "execpolicy requires approval for this command, but AskForApproval is set to Never";
const PROMPT_REASON: &str = "execpolicy requires approval for this command";
const POLICY_DIR_NAME: &str = "policy";
const POLICY_EXTENSION: &str = "codexpolicy";
@@ -189,7 +190,7 @@ pub(crate) async fn create_approval_requirement_for_command(
let prompt_reason = prompt_reason_for(&evaluation);
if matches!(approval_policy, AskForApproval::Never) {
ApprovalRequirement::Forbidden {
reason: prompt_reason.unwrap_or_else(|| PROMPT_REASON.to_string()),
reason: PROMPT_CONFLICT_REASON.to_string(),
}
} else {
ApprovalRequirement::NeedsApproval {