codex: address PR review feedback (#29902)

This commit is contained in:
Brent Traut
2026-07-08 10:51:28 -07:00
parent 014c3c541b
commit a690532576
10 changed files with 16 additions and 95 deletions
@@ -5176,10 +5176,6 @@
"format": "int64",
"type": "integer"
},
"createdAtMs": {
"format": "int64",
"type": "integer"
},
"cwd": {
"$ref": "#/definitions/AbsolutePathBuf"
},
@@ -5227,13 +5223,6 @@
"null"
]
},
"recencyAtMs": {
"format": "int64",
"type": [
"integer",
"null"
]
},
"source": {
"$ref": "#/definitions/SessionSource"
},
@@ -5250,22 +5239,16 @@
"updatedAt": {
"format": "int64",
"type": "integer"
},
"updatedAtMs": {
"format": "int64",
"type": "integer"
}
},
"required": [
"createdAt",
"createdAtMs",
"cwd",
"id",
"modelProvider",
"preview",
"source",
"updatedAt",
"updatedAtMs"
"updatedAt"
],
"type": "object"
},
@@ -19952,10 +19952,6 @@
"format": "int64",
"type": "integer"
},
"createdAtMs": {
"format": "int64",
"type": "integer"
},
"cwd": {
"$ref": "#/definitions/v2/AbsolutePathBuf"
},
@@ -20003,13 +19999,6 @@
"null"
]
},
"recencyAtMs": {
"format": "int64",
"type": [
"integer",
"null"
]
},
"source": {
"$ref": "#/definitions/v2/SessionSource"
},
@@ -20026,22 +20015,16 @@
"updatedAt": {
"format": "int64",
"type": "integer"
},
"updatedAtMs": {
"format": "int64",
"type": "integer"
}
},
"required": [
"createdAt",
"createdAtMs",
"cwd",
"id",
"modelProvider",
"preview",
"source",
"updatedAt",
"updatedAtMs"
"updatedAt"
],
"type": "object"
},
@@ -17731,10 +17731,6 @@
"format": "int64",
"type": "integer"
},
"createdAtMs": {
"format": "int64",
"type": "integer"
},
"cwd": {
"$ref": "#/definitions/AbsolutePathBuf"
},
@@ -17782,13 +17778,6 @@
"null"
]
},
"recencyAtMs": {
"format": "int64",
"type": [
"integer",
"null"
]
},
"source": {
"$ref": "#/definitions/SessionSource"
},
@@ -17805,22 +17794,16 @@
"updatedAt": {
"format": "int64",
"type": "integer"
},
"updatedAtMs": {
"format": "int64",
"type": "integer"
}
},
"required": [
"createdAt",
"createdAtMs",
"cwd",
"id",
"modelProvider",
"preview",
"source",
"updatedAt",
"updatedAtMs"
"updatedAt"
],
"type": "object"
},
@@ -179,10 +179,6 @@
"format": "int64",
"type": "integer"
},
"createdAtMs": {
"format": "int64",
"type": "integer"
},
"cwd": {
"$ref": "#/definitions/AbsolutePathBuf"
},
@@ -230,13 +226,6 @@
"null"
]
},
"recencyAtMs": {
"format": "int64",
"type": [
"integer",
"null"
]
},
"source": {
"$ref": "#/definitions/SessionSource"
},
@@ -253,22 +242,16 @@
"updatedAt": {
"format": "int64",
"type": "integer"
},
"updatedAtMs": {
"format": "int64",
"type": "integer"
}
},
"required": [
"createdAt",
"createdAtMs",
"cwd",
"id",
"modelProvider",
"preview",
"source",
"updatedAt",
"updatedAtMs"
"updatedAt"
],
"type": "object"
}
@@ -9,4 +9,4 @@ import type { ThreadSource } from "./ThreadSource";
/**
* Persisted metadata needed to render and order a thread catalog row.
*/
export type ThreadSummary = { id: string, forkedFromId: string | null, parentThreadId: string | null, preview: string, modelProvider: string, createdAt: number, createdAtMs: number, updatedAt: number, updatedAtMs: number, recencyAt: number | null, recencyAtMs: number | null, archivedAt: number | null, cwd: AbsolutePathBuf, source: SessionSource, threadSource: ThreadSource | null, agentNickname: string | null, agentRole: string | null, gitInfo: GitInfo | null, name: string | null, };
export type ThreadSummary = { id: string, forkedFromId: string | null, parentThreadId: string | null, preview: string, modelProvider: string, createdAt: number, updatedAt: number, recencyAt: number | null, archivedAt: number | null, cwd: AbsolutePathBuf, source: SessionSource, threadSource: ThreadSource | null, agentNickname: string | null, agentRole: string | null, gitInfo: GitInfo | null, name: string | null, };
@@ -238,16 +238,10 @@ pub struct ThreadSummary {
#[ts(type = "number")]
pub created_at: i64,
#[ts(type = "number")]
pub created_at_ms: i64,
#[ts(type = "number")]
pub updated_at: i64,
#[ts(type = "number")]
pub updated_at_ms: i64,
#[ts(type = "number | null")]
pub recency_at: Option<i64>,
#[ts(type = "number | null")]
pub recency_at_ms: Option<i64>,
#[ts(type = "number | null")]
pub archived_at: Option<i64>,
pub cwd: AbsolutePathBuf,
pub source: SessionSource,
-5
View File
@@ -107,7 +107,6 @@ fn server_notification_requires_delivery(notification: &ServerNotification) -> b
notification,
ServerNotification::TurnCompleted(_)
| ServerNotification::ThreadSettingsUpdated(_)
| ServerNotification::ThreadCatalogChanged(_)
| ServerNotification::ExternalAgentConfigImportCompleted(_)
)
}
@@ -744,7 +743,6 @@ mod tests {
use codex_app_server_protocol::ConfigRequirementsReadResponse;
use codex_app_server_protocol::ExternalAgentConfigImportCompletedNotification;
use codex_app_server_protocol::SessionSource as ApiSessionSource;
use codex_app_server_protocol::ThreadCatalogChangedNotification;
use codex_app_server_protocol::ThreadStartParams;
use codex_app_server_protocol::ThreadStartResponse;
use codex_app_server_protocol::Turn;
@@ -916,8 +914,5 @@ mod tests {
},
)
));
assert!(server_notification_requires_delivery(
&ServerNotification::ThreadCatalogChanged(ThreadCatalogChangedNotification::Invalidate,)
));
}
}
+2 -1
View File
@@ -251,9 +251,11 @@ impl MessageProcessor {
// affect per-thread behavior, but they must not move newly started,
// resumed, or forked threads to a different persistence backend/root.
let thread_store = codex_core::thread_store_from_config(config.as_ref(), state_db.clone());
let thread_list_state_permit = Arc::new(Semaphore::new(/*permits*/ 1));
let thread_catalog_subscriptions = ThreadCatalogSubscriptions::new(
outgoing.clone(),
Arc::clone(&thread_store),
Arc::clone(&thread_list_state_permit),
config.model_provider_id.clone(),
config.cwd.clone(),
);
@@ -317,7 +319,6 @@ impl MessageProcessor {
let pending_thread_unloads = Arc::new(Mutex::new(HashSet::new()));
let thread_watch_manager =
crate::thread_status::ThreadWatchManager::new_with_outgoing(outgoing.clone());
let thread_list_state_permit = Arc::new(Semaphore::new(/*permits*/ 1));
let workspace_settings_cache =
Arc::new(workspace_settings::WorkspaceSettingsCache::default());
let app_list_shutdown_token = CancellationToken::new();
+9 -6
View File
@@ -10,6 +10,7 @@ use codex_thread_store::ThreadCatalogChange;
use codex_thread_store::ThreadStore;
use codex_utils_absolute_path::AbsolutePathBuf;
use tokio::sync::Mutex;
use tokio::sync::Semaphore;
use tokio::sync::broadcast::error::RecvError;
use tracing::warn;
@@ -26,6 +27,7 @@ impl ThreadCatalogSubscriptions {
pub(crate) fn new(
outgoing: Arc<OutgoingMessageSender>,
thread_store: Arc<dyn ThreadStore>,
catalog_state_permit: Arc<Semaphore>,
fallback_provider: String,
fallback_cwd: AbsolutePathBuf,
) -> Self {
@@ -36,6 +38,7 @@ impl ThreadCatalogSubscriptions {
Arc::downgrade(&thread_store),
Arc::clone(&outgoing),
Arc::clone(&connection_ids),
catalog_state_permit,
fallback_provider,
fallback_cwd,
));
@@ -56,6 +59,7 @@ async fn run_catalog_listener(
thread_store: Weak<dyn ThreadStore>,
outgoing: Arc<OutgoingMessageSender>,
connection_ids: Arc<Mutex<HashSet<ConnectionId>>>,
catalog_state_permit: Arc<Semaphore>,
fallback_provider: String,
fallback_cwd: AbsolutePathBuf,
) {
@@ -78,6 +82,10 @@ async fn run_catalog_listener(
continue;
}
let Ok(permit) = catalog_state_permit.acquire().await else {
break;
};
let notification = match change {
Some(ThreadCatalogChange::Upsert { thread_id }) => {
let Some(thread_store) = thread_store.upgrade() else {
@@ -117,6 +125,7 @@ async fn run_catalog_listener(
ThreadCatalogChangedNotification::Invalidate,
),
};
drop(permit);
outgoing
.send_server_notification_to_connections(&connection_ids, notification)
.await;
@@ -128,9 +137,6 @@ fn thread_summary_from_stored_thread(
fallback_provider: &str,
fallback_cwd: &AbsolutePathBuf,
) -> ThreadSummary {
let created_at_ms = thread.created_at.timestamp_millis();
let updated_at_ms = thread.updated_at.timestamp_millis();
let recency_at_ms = thread.recency_at.timestamp_millis();
let archived_at = thread.archived_at.as_ref().map(chrono::DateTime::timestamp);
let (thread, _) = thread_from_stored_thread(thread, fallback_provider, fallback_cwd);
ThreadSummary {
@@ -140,11 +146,8 @@ fn thread_summary_from_stored_thread(
preview: thread.preview,
model_provider: thread.model_provider,
created_at: thread.created_at,
created_at_ms,
updated_at: thread.updated_at,
updated_at_ms,
recency_at: thread.recency_at,
recency_at_ms: Some(recency_at_ms),
archived_at,
cwd: thread.cwd,
source: thread.source,
@@ -60,10 +60,6 @@ async fn catalog_subscription_tracks_threads_the_client_never_listed() -> Result
};
assert_eq!(thread.id, thread_id);
assert_eq!(thread.name.as_deref(), Some("Renamed without listing"));
assert_eq!(
thread.recency_at_ms.map(|value| value / 1_000),
thread.recency_at
);
let delete_id = app
.send_thread_delete_request(ThreadDeleteParams {