Set the environment field in statusline MCP requests (#61272)

Initialize `environment_id` to `None` for statusline MCP inventory and resource-read requests, preserving existing server selection. Update request assertions to expect `environmentId: null`.

GitOrigin-RevId: 3ed5dde0de5ab69aa1349da7d829cc5e335db5c7
This commit is contained in:
Adam Perry @ OpenAI
2026-11-13 06:07:04 +00:00
committed by copyberry
parent 16280e19b1
commit 454bf339f0
4 changed files with 10 additions and 6 deletions
+1
View File
@@ -175,6 +175,7 @@ impl ResolvedStatuslineProvider {
params: McpResourceReadParams {
thread_id: Some(self.thread.to_string()),
server: provider.id.server.0.clone(),
environment_id: None,
uri: provider.uri.clone(),
connector_id: None,
origin_call_id: None,
@@ -110,6 +110,7 @@ pub(super) fn global_pages(
ListMcpServerStatusParams {
thread_id: None,
server_name: None,
environment_id: None,
detail: Some(McpServerStatusDetail::ToolsAndAuthOnly),
cursor,
limit: None,
@@ -150,6 +151,7 @@ pub(super) async fn server(
ListMcpServerStatusParams {
thread_id: thread.map(|id| id.to_string()),
server_name: Some(name.0.clone()),
environment_id: None,
detail: Some(McpServerStatusDetail::ToolsAndAuthOnly),
cursor: None,
limit: None,
@@ -157,13 +159,13 @@ pub(super) async fn server(
)
.await?;
if page.next_cursor.is_some() || page.data.len() > 1 {
bail!("targeted MCP inventory returned more than one server")
bail!("targeted MCP inventory returned more than one server");
}
let Some(value) = page.data.pop() else {
return Ok(None);
};
if value["name"] != name.as_str() {
bail!("targeted MCP inventory did not identify the requested server")
bail!("targeted MCP inventory did not identify the requested server");
}
local_server(value)
}
@@ -136,7 +136,7 @@ async fn global_pages_preserve_catalogs_and_skip_hosted_or_unidentified_transpor
reply(
&mut commands,
"mcpServerStatus/list",
json!({"threadId":null,"serverName":null,"detail":"toolsAndAuthOnly","cursor":cursor,"limit":null}),
json!({"threadId":null,"serverName":null,"environmentId":null,"detail":"toolsAndAuthOnly","cursor":cursor,"limit":null}),
json!({"data":rows,"nextCursor":next}),
).await;
}
@@ -177,7 +177,7 @@ async fn targeted_inventory_rejects_another_server() {
reply(
&mut commands,
"mcpServerStatus/list",
json!({"threadId":null,"serverName":"calendar","detail":"toolsAndAuthOnly","cursor":null,"limit":null}),
json!({"threadId":null,"serverName":"calendar","environmentId":null,"detail":"toolsAndAuthOnly","cursor":null,"limit":null}),
json!({"data":[other],"nextCursor":null}),
)
);
@@ -75,7 +75,7 @@ async fn named(commands: &mut Requests, thread: Option<ThreadId>, row: Value) {
commands,
"mcpServerStatus/list",
json!({"threadId":thread.map(|id| id.to_string()),"serverName":row["name"],
"detail":"toolsAndAuthOnly","cursor":null,"limit":null}),
"environmentId":null,"detail":"toolsAndAuthOnly","cursor":null,"limit":null}),
json!({"data":[row],"nextCursor":null}),
)
.await;
@@ -109,6 +109,7 @@ async fn picker_choice_reads_the_displayed_threads_uri_with_the_snapshot() -> Re
json!({
"threadId": thread.to_string(),
"server": "calendar",
"environmentId": null,
"uri": "ui://calendar/today",
"connectorId": null,
"target": null,
@@ -236,7 +237,7 @@ async fn selecting_a_plugin_requires_the_globally_advertised_tool_and_the_connec
"mcpServer/resource/read",
json!({
"threadId":thread.to_string(),"server":"calendar","uri":"ui://calendar/current",
"connectorId":null,"target":null,"originCallId":null,
"environmentId":null,"connectorId":null,"target":null,"originCallId":null,
"_meta":{"com.openai/codex-statusline-state":{"version":1}}
}),
json!({"contents":[],"originCallId":null}),