Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Require organization ID when submitting feedback to Cloud (#65839)

Marshall Bowers9cd14daad768
diff --git a/crates/agent_ui/src/conversation_view.rs b/crates/agent_ui/src/conversation_view.rs
index 1876149d3e3..8f0ddf9aa5b 100644
--- a/crates/agent_ui/src/conversation_view.rs
+++ b/crates/agent_ui/src/conversation_view.rs
@@ -14,7 +14,7 @@ use agent_client_protocol::schema::v2 as acp_v2;
use agent_servers::AgentServerDelegate;
use agent_servers::{AgentServer, GEMINI_TERMINAL_AUTH_METHOD_ID};
use agent_settings::{AgentProfileId, AgentSettings};
-use anyhow::{Result, anyhow};
+use anyhow::{Context as _, Result, anyhow};
#[cfg(feature = "audio")]
use audio::{Audio, Sound};
use buffer_diff::BufferDiff;
diff --git a/crates/agent_ui/src/conversation_view/thread_view.rs b/crates/agent_ui/src/conversation_view/thread_view.rs
index 5789f12b302..94f523a39db 100644
--- a/crates/agent_ui/src/conversation_view/thread_view.rs
+++ b/crates/agent_ui/src/conversation_view/thread_view.rs
@@ -104,12 +104,15 @@ impl ThreadFeedbackState {
ThreadFeedback::Negative => "negative",
};
cx.background_spawn(async move {
+ let organization_id = organization
+ .map(|organization| organization.id.clone())
+ .context("no organization selected")?;
let thread = task.await?;
client
.cloud_client()
.submit_agent_feedback(SubmitAgentThreadFeedbackBody {
- organization_id: organization.map(|organization| organization.id.clone()),
+ organization_id,
agent: agent_telemetry_id.to_string(),
session_id: session_id.to_string(),
parent_session_id: parent_session_id.map(|id| id.to_string()),
@@ -148,12 +151,15 @@ impl ThreadFeedbackState {
let agent_telemetry_id = thread.read(cx).connection().telemetry_id();
let task = telemetry.thread_data(&session_id, cx);
cx.background_spawn(async move {
+ let organization_id = organization
+ .map(|organization| organization.id.clone())
+ .context("no organization selected")?;
let thread = task.await?;
client
.cloud_client()
.submit_agent_feedback_comments(SubmitAgentThreadFeedbackCommentsBody {
- organization_id: organization.map(|organization| organization.id.clone()),
+ organization_id,
agent: agent_telemetry_id.to_string(),
session_id: session_id.to_string(),
comments,
diff --git a/crates/cloud_api_types/src/cloud_api_types.rs b/crates/cloud_api_types/src/cloud_api_types.rs
index b09fd22e548..d13de05adc5 100644
--- a/crates/cloud_api_types/src/cloud_api_types.rs
+++ b/crates/cloud_api_types/src/cloud_api_types.rs
@@ -105,7 +105,7 @@ pub struct SystemSettings {
#[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct SubmitAgentThreadFeedbackBody {
- pub organization_id: Option<OrganizationId>,
+ pub organization_id: OrganizationId,
pub agent: String,
pub session_id: String,
pub parent_session_id: Option<String>,
@@ -115,7 +115,7 @@ pub struct SubmitAgentThreadFeedbackBody {
#[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct SubmitAgentThreadFeedbackCommentsBody {
- pub organization_id: Option<OrganizationId>,
+ pub organization_id: OrganizationId,
pub agent: String,
pub session_id: String,
pub comments: String,
@@ -124,7 +124,7 @@ pub struct SubmitAgentThreadFeedbackCommentsBody {
#[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct SubmitEditPredictionFeedbackBody {
- pub organization_id: Option<OrganizationId>,
+ pub organization_id: OrganizationId,
pub request_id: String,
pub rating: String,
pub inputs: serde_json::Value,
diff --git a/crates/edit_prediction/src/edit_prediction.rs b/crates/edit_prediction/src/edit_prediction.rs
index 0c85fa0f595..7e72a008e31 100644
--- a/crates/edit_prediction/src/edit_prediction.rs
+++ b/crates/edit_prediction/src/edit_prediction.rs
@@ -3356,10 +3356,14 @@ impl EditPredictionStore {
.edit_preview
.as_unified_diff(prediction.snapshot.file(), &prediction.edits);
async move {
+ let organization_id = organization
+ .map(|organization| organization.id.clone())
+ .context("no organization selected")?;
+
client
.cloud_client()
.submit_edit_prediction_feedback(SubmitEditPredictionFeedbackBody {
- organization_id: organization.map(|organization| organization.id.clone()),
+ organization_id,
request_id: prediction_id,
rating: match rating {
EditPredictionRating::Positive => "positive".to_string(),