[feedback] Add source info into feedback metadata. (#7140)

Verified the source info is correctly attached based on whether it's cli
or vscode.
This commit is contained in:
Matthew Zeng
2025-11-24 11:05:37 -08:00
committed by GitHub
parent 35d89e820f
commit c31663d745
5 changed files with 36 additions and 0 deletions

View File

@@ -2794,6 +2794,7 @@ impl CodexMessageProcessor {
} else {
None
};
let session_source = self.conversation_manager.session_source();
let upload_result = tokio::task::spawn_blocking(move || {
let rollout_path_ref = validated_rollout_path.as_deref();
@@ -2802,6 +2803,7 @@ impl CodexMessageProcessor {
reason.as_deref(),
include_logs,
rollout_path_ref,
Some(session_source),
)
})
.await;

View File

@@ -56,6 +56,10 @@ impl ConversationManager {
)
}
pub fn session_source(&self) -> SessionSource {
self.session_source.clone()
}
pub async fn new_conversation(&self, config: Config) -> CodexResult<NewConversation> {
self.spawn_conversation(config, self.auth_manager.clone())
.await

View File

@@ -10,6 +10,7 @@ use std::time::Duration;
use anyhow::Result;
use anyhow::anyhow;
use codex_protocol::ConversationId;
use codex_protocol::protocol::SessionSource;
use tracing_subscriber::fmt::writer::MakeWriter;
const DEFAULT_MAX_BYTES: usize = 4 * 1024 * 1024; // 4 MiB
@@ -174,6 +175,7 @@ impl CodexLogSnapshot {
reason: Option<&str>,
include_logs: bool,
rollout_path: Option<&std::path::Path>,
session_source: Option<SessionSource>,
) -> Result<()> {
use std::collections::BTreeMap;
use std::fs;
@@ -203,6 +205,9 @@ impl CodexLogSnapshot {
(String::from("classification"), classification.to_string()),
(String::from("cli_version"), cli_version.to_string()),
]);
if let Some(source) = session_source.as_ref() {
tags.insert(String::from("session_source"), source.to_string());
}
if let Some(r) = reason {
tags.insert(String::from("reason"), r.to_string());
}

View File

@@ -1131,6 +1131,29 @@ pub enum SubAgentSource {
Other(String),
}
impl fmt::Display for SessionSource {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
SessionSource::Cli => f.write_str("cli"),
SessionSource::VSCode => f.write_str("vscode"),
SessionSource::Exec => f.write_str("exec"),
SessionSource::Mcp => f.write_str("mcp"),
SessionSource::SubAgent(sub_source) => write!(f, "subagent_{sub_source}"),
SessionSource::Unknown => f.write_str("unknown"),
}
}
}
impl fmt::Display for SubAgentSource {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
SubAgentSource::Review => f.write_str("review"),
SubAgentSource::Compact => f.write_str("compact"),
SubAgentSource::Other(other) => f.write_str(other),
}
}
}
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, TS)]
pub struct SessionMeta {
pub id: ConversationId,

View File

@@ -19,6 +19,7 @@ use crate::app_event::FeedbackCategory;
use crate::app_event_sender::AppEventSender;
use crate::history_cell;
use crate::render::renderable::Renderable;
use codex_core::protocol::SessionSource;
use super::CancellationEvent;
use super::bottom_pane_view::BottomPaneView;
@@ -85,6 +86,7 @@ impl FeedbackNoteView {
} else {
None
},
Some(SessionSource::Cli),
);
match result {