fix: add parse error logging in ws_worker, fix worker workdir path

This commit is contained in:
Fam Zheng 2026-04-06 15:54:06 +01:00
parent 54517b27f2
commit 9e07880132
2 changed files with 8 additions and 3 deletions

View File

@ -135,7 +135,7 @@ async fn connect_and_run(server_url: &str, worker_name: &str, llm_config: &crate
let llm = LlmClient::new(llm_config);
let exec = LocalExecutor::new(None);
let workdir = format!("/app/data/workspaces/{}", project_id);
let workdir = format!("workspaces/{}", project_id);
let instructions = String::new(); // TODO: load from template
// update channel → serialize → WebSocket

View File

@ -90,9 +90,14 @@ async fn handle_worker_socket(socket: WebSocket, state: Arc<WsWorkerState>) {
while let Some(Ok(msg)) = receiver.next().await {
match msg {
Message::Text(text) => {
if let Ok(worker_msg) = serde_json::from_str::<WorkerToServer>(&text) {
match serde_json::from_str::<WorkerToServer>(&text) {
Ok(worker_msg) => {
handle_worker_message(&state_clone, worker_msg).await;
}
Err(e) => {
tracing::warn!("Failed to parse worker message: {} — raw: {}", e, &text[..text.len().min(200)]);
}
}
}
Message::Close(_) => break,
_ => {}