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:
ningyi-oaiandCodex authored and GitHub committed 2026-04-11 00:23:50 -07:00
1 parent dbfe855f4f
commit be13f03c39
14 files changed
+290 -65

No files matched your search

+10 -2
View File
@@ -854,6 +854,7 @@ pub(crate) struct ChatWidget {
pending_status_indicator_restore: bool,
suppress_queue_autosend: bool,
thread_id: Option<ThreadId>,
last_turn_id: Option<String>,
thread_name: Option<String>,
forked_from: Option<ThreadId>,
frame_requester: FrameRequester,
@@ -1961,6 +1962,7 @@ impl ChatWidget {
self.set_skills(/*skills*/ None);
self.session_network_proxy = event.network_proxy.clone();
self.thread_id = Some(event.session_id);
self.last_turn_id = None;
self.thread_name = event.thread_name.clone();
self.forked_from = event.forked_from_id;
self.current_rollout_path = event.rollout_path.clone();
@@ -2143,6 +2145,7 @@ impl ChatWidget {
) {
let view = crate::bottom_pane::FeedbackNoteView::new(
category,
self.last_turn_id.clone(),
self.app_event_tx.clone(),
include_logs,
);
@@ -4827,6 +4830,7 @@ impl ChatWidget {
pending_status_indicator_restore: false,
suppress_queue_autosend: false,
thread_id: None,
last_turn_id: None,
thread_name: None,
forked_from: None,
queued_user_messages: VecDeque::new(),
@@ -6501,7 +6505,8 @@ impl ChatWidget {
}
}
}
ServerNotification::TurnStarted(_) => {
ServerNotification::TurnStarted(notification) => {
self.last_turn_id = Some(notification.turn.id);
self.last_non_retry_error = None;
if !matches!(replay_kind, Some(ReplayKind::ResumeInitialMessages)) {
self.on_task_started();
@@ -7072,8 +7077,11 @@ impl ChatWidget {
}
EventMsg::AgentReasoningSectionBreak(_) => self.on_reasoning_section_break(),
EventMsg::TurnStarted(event) => {
let turn_id = event.turn_id;
let model_context_window = event.model_context_window;
self.last_turn_id = Some(turn_id);
if !is_resume_initial_replay {
self.apply_turn_started_context_window(event.model_context_window);
self.apply_turn_started_context_window(model_context_window);
self.on_task_started();
}
}