Skip to content
This repository was archived by the owner on Sep 23, 2025. It is now read-only.

Commit f7c27d8

Browse files
committed
handle a missing data field as null
1 parent 20e142a commit f7c27d8

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

server/src/ipc.rs

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,10 @@ impl IPCCommunicator {
180180
Ok(())
181181
}
182182

183-
pub async fn present_walkthrough(&self, walkthrough: crate::ide::ResolvedWalkthrough) -> Result<()> {
183+
pub async fn present_walkthrough(
184+
&self,
185+
walkthrough: crate::ide::ResolvedWalkthrough,
186+
) -> Result<()> {
184187
if self.test_mode {
185188
info!("Present walkthrough called (test mode): {:?}", walkthrough);
186189
return Ok(());
@@ -192,7 +195,7 @@ impl IPCCommunicator {
192195
let inner = self.inner.lock().await;
193196
inner.terminal_shell_pid
194197
};
195-
198+
196199
let message = IPCMessage {
197200
shell_pid,
198201
message_type: IPCMessageType::PresentWalkthrough,
@@ -587,19 +590,12 @@ impl IPCCommunicator {
587590
.map_err(|_| IPCError::ChannelClosed)?;
588591

589592
// Parse UserFeedback from response data
590-
if let Some(data) = response.data {
591-
let user_feedback: R =
592-
serde_json::from_value(data).map_err(IPCError::SerializationError)?;
593-
Ok(user_feedback)
593+
let user_feedback: R = if let Some(data) = response.data {
594+
serde_json::from_value(data).map_err(IPCError::SerializationError)?
594595
} else {
595-
Err(IPCError::ConnectionFailed {
596-
path: format!("{:?}", message.message_type),
597-
source: std::io::Error::new(
598-
std::io::ErrorKind::InvalidData,
599-
"No response data in response",
600-
),
601-
})
602-
}
596+
serde_json::from_value(serde_json::Value::Null)?
597+
};
598+
Ok(user_feedback)
603599
}
604600

605601
/// Sends an IPC message without waiting for a response (fire-and-forget)
@@ -919,15 +915,21 @@ impl IPCCommunicator {
919915
context_lines: feedback_payload.context_lines,
920916
},
921917
"complete_review" => {
922-
let completion_action = feedback_payload.completion_action.as_deref()
918+
let completion_action = feedback_payload
919+
.completion_action
920+
.as_deref()
923921
.and_then(|action| match action {
924-
"request_changes" => Some(crate::synthetic_pr::CompletionAction::RequestChanges),
925-
"checkpoint" => Some(crate::synthetic_pr::CompletionAction::Checkpoint),
922+
"request_changes" => {
923+
Some(crate::synthetic_pr::CompletionAction::RequestChanges)
924+
}
925+
"checkpoint" => {
926+
Some(crate::synthetic_pr::CompletionAction::Checkpoint)
927+
}
926928
"return" => Some(crate::synthetic_pr::CompletionAction::Return),
927929
_ => None,
928930
})
929931
.unwrap_or(crate::synthetic_pr::CompletionAction::Return);
930-
932+
931933
crate::synthetic_pr::FeedbackData::CompleteReview {
932934
completion_action,
933935
additional_notes: feedback_payload.additional_notes,
@@ -936,8 +938,8 @@ impl IPCCommunicator {
936938
_ => crate::synthetic_pr::FeedbackData::CompleteReview {
937939
completion_action: crate::synthetic_pr::CompletionAction::Return,
938940
additional_notes: None,
939-
}
940-
}
941+
},
942+
},
941943
};
942944

943945
// Send to waiting MCP tool

0 commit comments

Comments
 (0)