mirror of
https://github.com/openai/codex.git
synced 2026-10-19 17:28:46 +00:00
Expose environment status through app-server (#32920)
## What changed - Add the experimental `environment/status` request for inspecting a configured environment without starting or reconnecting it. - Report `ready`, `pending`, `disconnected`, or `unknown`, including error details for disconnected and unknown environments. - Probe ready remote environments over their existing exec-server connection. ## Testing - Add an app-server integration test covering local and remote ready, pending, disconnected, and unknown environments. GitOrigin-RevId: 397bba603aa9e0b59008ee6cb7cbde46e357652c
This commit is contained in:
committed by
copyberry
parent
80c6cd3014
commit
f96cf4d1c3
@@ -45,6 +45,7 @@ const IGNORED_DEFINITIONS: &[&str] = &["Option<()>"];
|
||||
const JSON_V1_ALLOWLIST: &[&str] = &["InitializeParams", "InitializeResponse"];
|
||||
const EXPERIMENTAL_CLIENT_METHOD_DEPENDENCY_TYPES: &[&str] = &[
|
||||
"EnvironmentShellInfo",
|
||||
"EnvironmentStatusKind",
|
||||
"PathUri",
|
||||
"RemoteControlClient",
|
||||
"RemoteControlClientsListOrder",
|
||||
|
||||
@@ -956,6 +956,13 @@ client_request_definitions! {
|
||||
serialization: global_shared_read("environment"),
|
||||
response: v2::EnvironmentInfoResponse,
|
||||
},
|
||||
#[experimental("environment/status")]
|
||||
/// Reads the current status of a configured execution environment.
|
||||
EnvironmentStatus => "environment/status" {
|
||||
params: v2::EnvironmentStatusParams,
|
||||
serialization: global_shared_read("environment"),
|
||||
response: v2::EnvironmentStatusResponse,
|
||||
},
|
||||
|
||||
McpServerOauthLogin => "mcpServer/oauth/login" {
|
||||
params: v2::McpServerOauthLoginParams,
|
||||
|
||||
@@ -37,6 +37,51 @@ pub struct EnvironmentInfoResponse {
|
||||
pub cwd: Option<PathUri>,
|
||||
}
|
||||
|
||||
/// Parameters for reading the current status of one configured environment.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct EnvironmentStatusParams {
|
||||
/// Environment id to inspect.
|
||||
pub environment_id: String,
|
||||
}
|
||||
|
||||
/// Current status for the requested environment.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct EnvironmentStatusResponse {
|
||||
/// Current status observed without starting or recovering the environment.
|
||||
pub status: EnvironmentStatusKind,
|
||||
/// Human-readable detail for `disconnected` and `unknown`; omitted for other statuses.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub error: Option<String>,
|
||||
}
|
||||
|
||||
/// Current status observed by app-server without starting or recovering an environment.
|
||||
///
|
||||
/// For a currently ready remote environment, app-server asks the existing
|
||||
/// exec-server connection for `environment/status` without allowing recovery.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(rename_all = "camelCase", export_to = "v2/")]
|
||||
pub enum EnvironmentStatusKind {
|
||||
/// The environment is local, or an already-connected remote exec-server answered
|
||||
/// `environment/status` over its existing initialized connection.
|
||||
Ready,
|
||||
/// The configured environment has no ready connection and no observed connection failure.
|
||||
/// This includes lazy environments that have never been started and initial startup that has
|
||||
/// not finished.
|
||||
Pending,
|
||||
/// A connection attempt, prior connection, or fail-fast `environment/status` probe observed
|
||||
/// a failure. This does not promise the failure is terminal: later normal environment use may
|
||||
/// recover it. This call does not trigger recovery; `error` contains the observed reason.
|
||||
Disconnected,
|
||||
/// The requested environment id is not configured in app-server.
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
|
||||
Reference in New Issue
Block a user