Show the selected ChatGPT workspace in /status (#57366)

## What changed

- Return the selected workspace's display name as `workspaceName` in ChatGPT account responses, caching it alongside workspace routing and updating generated schemas and bindings.
- Display a `ChatGPT workspace` row with the name and account ID, falling back to the ID when the name is unavailable or invalid. Refresh workspace details with account identity updates and hide the row for providers that do not use ChatGPT authentication.

## Testing

Update account-response tests to cover workspace names and null values, add workspace details to the status snapshot, and verify that switching to a custom API-key provider hides the workspace row.

GitOrigin-RevId: 4b30ab8a39e1fa7ad1ba7367c5295544be8f6001
This commit is contained in:
Eric Traut
2026-10-27 05:22:23 +00:00
committed by copyberry
parent 6c0db39b94
commit 155dde7ff6
26 changed files with 216 additions and 38 deletions
+9 -2
View File
@@ -213,10 +213,17 @@ impl ChatWidget {
self.model_catalog.clone()
}
pub(crate) fn on_account_email_loaded(&mut self, current_email: Option<String>) {
if let Some(StatusAccountDisplay::ChatGpt { email, .. }) = &mut self.status_account_display
pub(crate) fn on_account_email_loaded(
&mut self,
current_email: Option<String>,
current_workspace: Option<String>,
) {
if let Some(StatusAccountDisplay::ChatGpt {
email, workspace, ..
}) = &mut self.status_account_display
{
*email = current_email;
*workspace = current_workspace;
}
}
@@ -123,10 +123,21 @@ async fn session_and_settings_sync_server_provider_id() {
let first_id = ThreadId::new();
let mut first = configured_thread_session(first_id);
first.model_provider_id = "server-ollama".to_string();
chat.status_account_display = Some(StatusAccountDisplay::ChatGpt {
email: None,
plan: None,
workspace: Some("account-123".to_string()),
});
let mut provider = chat.config.model_provider.clone();
provider.env_key = Some("CUSTOM_API_KEY".to_string());
chat.config
.model_providers
.insert(first.model_provider_id.clone(), provider);
chat.handle_thread_session(first.clone());
let displayed = status(&mut chat);
assert!(displayed.contains("Model provider:") && displayed.contains("server-ollama"));
assert!(!displayed.contains("local-provider.example"));
assert!(!displayed.contains("ChatGPT workspace:"));
let mut other = configured_thread_session(ThreadId::new());
other.model_provider_id = "server-bedrock".to_string();
@@ -3917,6 +3917,7 @@ async fn account_update_discards_stale_workspace_headline_results() {
Some(StatusAccountDisplay::ChatGpt {
email: Some("first@example.com".to_string()),
plan: None,
workspace: None,
}),
/*plan_type*/ None,
/*has_chatgpt_account*/ true,
@@ -3928,6 +3929,7 @@ async fn account_update_discards_stale_workspace_headline_results() {
Some(StatusAccountDisplay::ChatGpt {
email: Some("second@example.com".to_string()),
plan: None,
workspace: None,
}),
/*plan_type*/ None,
/*has_chatgpt_account*/ true,