app-server: Use shared receivers for app-server message processors (#17256)

We do not rely on the mutability here, so express it in the type system.
This commit is contained in:
Ruslan Nigmatullin
2026-04-09 12:53:50 -07:00
committed by GitHub
parent a92a5085bd
commit 545f3daba0
2 changed files with 44 additions and 60 deletions

View File

@@ -298,7 +298,7 @@ impl MessageProcessor {
}
pub(crate) async fn process_request(
&mut self,
&self,
connection_id: ConnectionId,
request: JSONRPCRequest,
transport: AppServerTransport,
@@ -372,7 +372,7 @@ impl MessageProcessor {
/// This bypasses JSON request deserialization but keeps identical request
/// semantics by delegating to `handle_client_request`.
pub(crate) async fn process_client_request(
&mut self,
&self,
connection_id: ConnectionId,
request: ClientRequest,
session: &mut ConnectionSessionState,
@@ -470,7 +470,7 @@ impl MessageProcessor {
}
pub(crate) async fn try_attach_thread_listener(
&mut self,
&self,
thread_id: ThreadId,
connection_ids: Vec<ConnectionId>,
) {
@@ -497,7 +497,7 @@ impl MessageProcessor {
self.codex_message_processor.shutdown_threads().await;
}
pub(crate) async fn connection_closed(&mut self, connection_id: ConnectionId) {
pub(crate) async fn connection_closed(&self, connection_id: ConnectionId) {
self.outgoing.connection_closed(connection_id).await;
self.fs_watch_manager.connection_closed(connection_id).await;
self.codex_message_processor
@@ -511,20 +511,20 @@ impl MessageProcessor {
}
/// Handle a standalone JSON-RPC response originating from the peer.
pub(crate) async fn process_response(&mut self, response: JSONRPCResponse) {
pub(crate) async fn process_response(&self, response: JSONRPCResponse) {
tracing::info!("<- response: {:?}", response);
let JSONRPCResponse { id, result, .. } = response;
self.outgoing.notify_client_response(id, result).await
}
/// Handle an error object received from the peer.
pub(crate) async fn process_error(&mut self, err: JSONRPCError) {
pub(crate) async fn process_error(&self, err: JSONRPCError) {
tracing::error!("<- error: {:?}", err);
self.outgoing.notify_client_error(err.id, err.error).await;
}
async fn handle_client_request(
&mut self,
&self,
connection_request_id: ConnectionRequestId,
codex_request: ClientRequest,
session: &mut ConnectionSessionState,