core-agent-ide/codex-rs/app-server/src
Owen Lin 77c457121e
fix: remove serde(flatten) annotation for TurnError (#7499)
The problem with using `serde(flatten)` on Turn status is that it
conditionally serializes the `error` field, which is not the pattern we
want in API v2 where all fields on an object should always be returned.

```
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct Turn {
    pub id: String,
    /// Only populated on a `thread/resume` response.
    /// For all other responses and notifications returning a Turn,
    /// the items field will be an empty list.
    pub items: Vec<ThreadItem>,
    #[serde(flatten)]
    pub status: TurnStatus,
}

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(tag = "status", rename_all = "camelCase")]
#[ts(tag = "status", export_to = "v2/")]
pub enum TurnStatus {
    Completed,
    Interrupted,
    Failed { error: TurnError },
    InProgress,
}
```

serializes to:
```
{
  "id": "turn-123",
  "items": [],
  "status": "completed"
}

{
  "id": "turn-123",
  "items": [],
  "status": "failed",
  "error": {
    "message": "Tool timeout",
    "codexErrorInfo": null
  }
}
```

Instead we want:
```
{
  "id": "turn-123",
  "items": [],
  "status": "completed",
  "error": null
}

{
  "id": "turn-123",
  "items": [],
  "status": "failed",
  "error": {
    "message": "Tool timeout",
    "codexErrorInfo": null
  }
}
```
2025-12-02 21:39:10 +00:00
..
bespoke_event_handling.rs fix: remove serde(flatten) annotation for TurnError (#7499) 2025-12-02 21:39:10 +00:00
codex_message_processor.rs fix: remove serde(flatten) annotation for TurnError (#7499) 2025-12-02 21:39:10 +00:00
config_api.rs feat[app-serve]: config management (#7241) 2025-11-25 09:29:38 +00:00
error_code.rs fix: separate codex mcp into codex mcp-server and codex app-server (#4471) 2025-09-30 07:06:18 +00:00
fuzzy_file_search.rs nit: app server (#6830) 2025-11-18 16:34:13 +00:00
lib.rs feat[app-serve]: config management (#7241) 2025-11-25 09:29:38 +00:00
main.rs fix: separate codex mcp into codex mcp-server and codex app-server (#4471) 2025-09-30 07:06:18 +00:00
message_processor.rs feat[app-serve]: config management (#7241) 2025-11-25 09:29:38 +00:00
models.rs feat: support models with single reasoning effort (#6300) 2025-11-05 23:06:45 -08:00
outgoing_message.rs storing credits (#6858) 2025-11-19 10:49:35 -08:00