mirror of
https://github.com/openai/codex.git
synced 2026-11-19 23:05:23 +00:00
Pass turn id with feedback uploads (#17314)
## Summary - Add an optional `tags` dictionary to feedback upload params. - Capture the active app-server turn id in the TUI and submit it as `tags.turn_id` with `/feedback` uploads. - Merge client-provided feedback tags into Sentry feedback tags while preserving reserved system fields like `thread_id`, `classification`, `cli_version`, `session_source`, and `reason`. ## Behavior / impact Existing feedback upload callers remain compatible because `tags` is optional and nullable. The wire shape is still a normal JSON object / TypeScript dictionary, so adding future feedback metadata will not require a new top-level protocol field each time. This change only adds feedback metadata for Codex CLI/TUI uploads; it does not affect existing pipelines, DAGs, exports, or downstream consumers unless they choose to read the new `turn_id` feedback tag. ## Tests - `cargo fmt -- --config imports_granularity=Item` passed; stable rustfmt warned that `imports_granularity` is nightly-only. - `cargo run -p codex-app-server-protocol --bin write_schema_fixtures` - `cargo test -p codex-feedback upload_tags_include_client_tags_and_preserve_reserved_fields` - `cargo test -p codex-app-server-protocol schema_fixtures_match_generated` - `cargo test -p codex-tui build_feedback_upload_params` - `cargo test -p codex-tui live_app_server_turn_started_sets_feedback_turn_id` - `cargo check -p codex-app-server --tests` - `git diff --check` --------- Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
1 parent
dbfe855f4f
commit
be13f03c39
14 files changed
+290
-65
No files matched your search
+18
-1
@@ -2020,6 +2020,7 @@ impl App {
|
||||
app_server: &AppServerSession,
|
||||
category: FeedbackCategory,
|
||||
reason: Option<String>,
|
||||
turn_id: Option<String>,
|
||||
include_logs: bool,
|
||||
) {
|
||||
let request_handle = app_server.request_handle();
|
||||
@@ -2035,6 +2036,7 @@ impl App {
|
||||
rollout_path,
|
||||
category,
|
||||
reason,
|
||||
turn_id,
|
||||
include_logs,
|
||||
);
|
||||
tokio::spawn(async move {
|
||||
@@ -4630,9 +4632,10 @@ impl App {
|
||||
AppEvent::SubmitFeedback {
|
||||
category,
|
||||
reason,
|
||||
turn_id,
|
||||
include_logs,
|
||||
} => {
|
||||
self.submit_feedback(app_server, category, reason, include_logs);
|
||||
self.submit_feedback(app_server, category, reason, turn_id, include_logs);
|
||||
}
|
||||
AppEvent::FeedbackSubmitted {
|
||||
origin_thread_id,
|
||||
@@ -6249,6 +6252,7 @@ fn build_feedback_upload_params(
|
||||
rollout_path: Option<PathBuf>,
|
||||
category: FeedbackCategory,
|
||||
reason: Option<String>,
|
||||
turn_id: Option<String>,
|
||||
include_logs: bool,
|
||||
) -> FeedbackUploadParams {
|
||||
let extra_log_files = if include_logs {
|
||||
@@ -6256,12 +6260,14 @@ fn build_feedback_upload_params(
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let tags = turn_id.map(|turn_id| BTreeMap::from([(String::from("turn_id"), turn_id)]));
|
||||
FeedbackUploadParams {
|
||||
classification: crate::bottom_pane::feedback_classification(category).to_string(),
|
||||
reason,
|
||||
thread_id: origin_thread_id.map(|thread_id| thread_id.to_string()),
|
||||
include_logs,
|
||||
extra_log_files,
|
||||
tags,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9644,12 +9650,21 @@ guardian_approval = true
|
||||
Some(rollout_path.clone()),
|
||||
FeedbackCategory::SafetyCheck,
|
||||
Some("needs follow-up".to_string()),
|
||||
Some("turn-123".to_string()),
|
||||
/*include_logs*/ true,
|
||||
);
|
||||
|
||||
assert_eq!(params.classification, "safety_check");
|
||||
assert_eq!(params.reason, Some("needs follow-up".to_string()));
|
||||
assert_eq!(params.thread_id, Some(thread_id.to_string()));
|
||||
assert_eq!(
|
||||
params
|
||||
.tags
|
||||
.as_ref()
|
||||
.and_then(|tags| tags.get("turn_id"))
|
||||
.map(String::as_str),
|
||||
Some("turn-123")
|
||||
);
|
||||
assert_eq!(params.include_logs, true);
|
||||
assert_eq!(params.extra_log_files, Some(vec![rollout_path]));
|
||||
}
|
||||
@@ -9661,12 +9676,14 @@ guardian_approval = true
|
||||
Some(PathBuf::from("/tmp/rollout.jsonl")),
|
||||
FeedbackCategory::GoodResult,
|
||||
/*reason*/ None,
|
||||
/*turn_id*/ None,
|
||||
/*include_logs*/ false,
|
||||
);
|
||||
|
||||
assert_eq!(params.classification, "good_result");
|
||||
assert_eq!(params.reason, None);
|
||||
assert_eq!(params.thread_id, None);
|
||||
assert_eq!(params.tags, None);
|
||||
assert_eq!(params.include_logs, false);
|
||||
assert_eq!(params.extra_log_files, None);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user