small revert

This commit is contained in:
jif-oai
2026-03-25 11:12:55 +00:00
parent 732ebd63f6
commit a5b99aa0b8
2 changed files with 20 additions and 5 deletions

View File

@@ -2,6 +2,7 @@ use std::sync::Arc;
use tokio::sync::mpsc;
use tracing::debug;
use tracing::warn;
use crate::connection::CHANNEL_CAPACITY;
use crate::connection::JsonRpcConnection;
@@ -27,7 +28,7 @@ pub(crate) async fn run_connection(connection: JsonRpcConnection) {
let json_message = match encode_server_message(message) {
Ok(json_message) => json_message,
Err(err) => {
let _ = err;
warn!("failed to serialize exec-server outbound message: {err}");
break;
}
};
@@ -41,6 +42,7 @@ pub(crate) async fn run_connection(connection: JsonRpcConnection) {
while let Some(event) = incoming_rx.recv().await {
match event {
JsonRpcConnectionEvent::MalformedMessage { reason } => {
warn!("ignoring malformed exec-server message: {reason}");
if outgoing_tx
.send(RpcServerOutboundMessage::Error {
request_id: codex_app_server_protocol::RequestId::Integer(-1),
@@ -76,19 +78,29 @@ pub(crate) async fn run_connection(connection: JsonRpcConnection) {
codex_app_server_protocol::JSONRPCMessage::Notification(notification) => {
let Some(route) = router.notification_route(notification.method.as_str())
else {
warn!(
"closing exec-server connection after unexpected notification: {}",
notification.method
);
break;
};
if let Err(err) = route(handler.clone(), notification).await {
let _ = err;
warn!("closing exec-server connection after protocol error: {err}");
break;
}
}
codex_app_server_protocol::JSONRPCMessage::Response(response) => {
let _ = response;
warn!(
"closing exec-server connection after unexpected client response: {:?}",
response.id
);
break;
}
codex_app_server_protocol::JSONRPCMessage::Error(error) => {
let _ = error;
warn!(
"closing exec-server connection after unexpected client error: {:?}",
error.id
);
break;
}
},

View File

@@ -2,6 +2,7 @@ use std::net::SocketAddr;
use tokio::net::TcpListener;
use tokio_tungstenite::accept_async;
use tracing::warn;
use crate::connection::JsonRpcConnection;
use crate::server::processor::run_connection;
@@ -72,7 +73,9 @@ async fn run_websocket_listener(
.await;
}
Err(err) => {
let _ = (peer_addr, err);
warn!(
"failed to accept exec-server websocket connection from {peer_addr}: {err}"
);
}
}
});