Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

add(feedback): over-refusal / safety check (#11948)

Fouad Matinb37555dd75d8
diff --git a/codex-rs/feedback/src/lib.rs b/codex-rs/feedback/src/lib.rs
index 4a227fe093..adda7173a1 100644
--- a/codex-rs/feedback/src/lib.rs
+++ b/codex-rs/feedback/src/lib.rs
@@ -279,7 +279,7 @@ impl CodexLogSnapshot {
}
let level = match classification {
- "bug" | "bad_result" => Level::Error,
+ "bug" | "bad_result" | "safety_check" => Level::Error,
_ => Level::Info,
};
@@ -342,6 +342,7 @@ fn display_classification(classification: &str) -> String {
"bug" => "Bug".to_string(),
"bad_result" => "Bad result".to_string(),
"good_result" => "Good result".to_string(),
+ "safety_check" => "Safety check".to_string(),
_ => "Other".to_string(),
}
}
diff --git a/codex-rs/tui/src/app_event.rs b/codex-rs/tui/src/app_event.rs
index 8bf3ab3703..1c9e8ce88e 100644
--- a/codex-rs/tui/src/app_event.rs
+++ b/codex-rs/tui/src/app_event.rs
@@ -371,5 +371,6 @@ pub(crate) enum FeedbackCategory {
BadResult,
GoodResult,
Bug,
+ SafetyCheck,
Other,
}
diff --git a/codex-rs/tui/src/bottom_pane/feedback_view.rs b/codex-rs/tui/src/bottom_pane/feedback_view.rs
index 6bc0ab4474..6cbfbdb9e5 100644
--- a/codex-rs/tui/src/bottom_pane/feedback_view.rs
+++ b/codex-rs/tui/src/bottom_pane/feedback_view.rs
@@ -353,6 +353,10 @@ fn feedback_title_and_placeholder(category: FeedbackCategory) -> (String, String
"Tell us more (bug)".to_string(),
"(optional) Write a short description to help us further".to_string(),
),
+ FeedbackCategory::SafetyCheck => (
+ "Tell us more (safety check)".to_string(),
+ "(optional) Share what was refused and why it should have been allowed".to_string(),
+ ),
FeedbackCategory::Other => (
"Tell us more (other)".to_string(),
"(optional) Write a short description to help us further".to_string(),
@@ -365,6 +369,7 @@ fn feedback_classification(category: FeedbackCategory) -> &'static str {
FeedbackCategory::BadResult => "bad_result",
FeedbackCategory::GoodResult => "good_result",
FeedbackCategory::Bug => "bug",
+ FeedbackCategory::SafetyCheck => "safety_check",
FeedbackCategory::Other => "other",
}
}
@@ -378,14 +383,15 @@ fn issue_url_for_category(
// the external GitHub behavior identical while routing internal users to
// the internal go link.
match category {
- FeedbackCategory::Bug | FeedbackCategory::BadResult | FeedbackCategory::Other => {
- Some(match feedback_audience {
- FeedbackAudience::OpenAiEmployee => slack_feedback_url(thread_id),
- FeedbackAudience::External => {
- format!("{BASE_BUG_ISSUE_URL}&steps=Uploaded%20thread:%20{thread_id}")
- }
- })
- }
+ FeedbackCategory::Bug
+ | FeedbackCategory::BadResult
+ | FeedbackCategory::SafetyCheck
+ | FeedbackCategory::Other => Some(match feedback_audience {
+ FeedbackAudience::OpenAiEmployee => slack_feedback_url(thread_id),
+ FeedbackAudience::External => {
+ format!("{BASE_BUG_ISSUE_URL}&steps=Uploaded%20thread:%20{thread_id}")
+ }
+ }),
FeedbackCategory::GoodResult => None,
}
}
@@ -423,6 +429,12 @@ pub(crate) fn feedback_selection_params(
"Helpful, correct, high‑quality, or delightful result worth celebrating.",
FeedbackCategory::GoodResult,
),
+ make_feedback_item(
+ app_event_tx.clone(),
+ "safety check",
+ "Benign usage blocked due to safety checks or refusals.",
+ FeedbackCategory::SafetyCheck,
+ ),
make_feedback_item(
app_event_tx,
"other",
@@ -616,7 +628,14 @@ mod tests {
}
#[test]
- fn issue_url_available_for_bug_bad_result_and_other() {
+ fn feedback_view_safety_check() {
+ let view = make_view(FeedbackCategory::SafetyCheck);
+ let rendered = render(&view, 60);
+ insta::assert_snapshot!("feedback_view_safety_check", rendered);
+ }
+
+ #[test]
+ fn issue_url_available_for_bug_bad_result_safety_check_and_other() {
let bug_url = issue_url_for_category(
FeedbackCategory::Bug,
"thread-1",
@@ -639,6 +658,13 @@ mod tests {
);
assert!(other_url.is_some());
+ let safety_check_url = issue_url_for_category(
+ FeedbackCategory::SafetyCheck,
+ "thread-4",
+ FeedbackAudience::OpenAiEmployee,
+ );
+ assert!(safety_check_url.is_some());
+
assert!(
issue_url_for_category(
FeedbackCategory::GoodResult,
diff --git a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__feedback_view__tests__feedback_view_safety_check.snap b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__feedback_view__tests__feedback_view_safety_check.snap
new file mode 100644
index 0000000000..52148d0e86
--- /dev/null
+++ b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__feedback_view__tests__feedback_view_safety_check.snap
@@ -0,0 +1,9 @@
+---
+source: tui/src/bottom_pane/feedback_view.rs
+expression: rendered
+---
+▌ Tell us more (safety check)
+▌
+▌ (optional) Share what was refused and why it should have b
+
+Press enter to confirm or esc to go back
diff --git a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__feedback_selection_popup.snap b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__feedback_selection_popup.snap
index 4a98242027..1b7627a97e 100644
--- a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__feedback_selection_popup.snap
+++ b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__feedback_selection_popup.snap
@@ -4,8 +4,10 @@ expression: popup
---
How was this?
-› 1. bug Crash, error message, hang, or broken UI/behavior.
- 2. bad result Output was off-target, incorrect, incomplete, or unhelpful.
- 3. good result Helpful, correct, high‑quality, or delightful result worth
- celebrating.
- 4. other Slowness, feature suggestion, UX feedback, or anything else.
+› 1. bug Crash, error message, hang, or broken UI/behavior.
+ 2. bad result Output was off-target, incorrect, incomplete, or unhelpful.
+ 3. good result Helpful, correct, high‑quality, or delightful result worth
+ celebrating.
+ 4. safety check Benign usage blocked due to safety checks or refusals.
+ 5. other Slowness, feature suggestion, UX feedback, or anything
+ else.