BigPizzaV3/CodexPlusPlus · info
微信连接已停止
Error message
微信连接已停止
What it means
During a WeChat-triggered Codex turn, the bridge races the turn against a stop flag: every 200ms it checks the shared AtomicBool, and if a stop was requested it aborts waiting and bails with this message. The turn task itself is dropped; this is the normal signal-initiated shutdown path, not a bug in Codex processing.
Solutions
- Treat this as an expected cancellation: catch it and exit the connect loop cleanly
- If it fires unexpectedly, audit who sets the stop flag (UI stop button, shutdown hook)
- Re-run the message/turn if its result is still needed — the turn was dropped, not completed
Example fix
// before
let reply = process_weixin_message(...).await?; // propagates 微信连接已停止
// after
match process_weixin_message(...).await {
Err(e) if e.to_string().contains("微信连接已停止") => {
tracing::info!("weixin bridge stopped by request");
return Ok(()); // expected shutdown
}
other => other?,
} Defensive patterns
Strategy: try-catch
Validate before calling
// check the stop flag before starting an expensive turn
if stop.load(Ordering::SeqCst) { return Ok(()); } Try / catch
match process_weixin_message(...).await {
Err(e) if e.to_string().contains("微信连接已停止") => { /* expected shutdown */ Ok(()) }
other => other,
} Prevention
- Treat this message as normal cancellation, not a failure
- Check the stop flag before queuing new turns
- Distinguish stop-caused errors from real failures in logs/UI
- Persist turn state if resumability after stop matters
When it happens
Trigger: Calling stop (setting the SharedStopFlag AtomicBool) while run_weixin_connect_with_codex_path is inside process_weixin_message awaiting a Codex turn reply.
Common situations: User clicks 'stop' in the manager UI mid-turn; app shutdown or profile switch cancels the bridge; a supervisor aborts a long-running turn.
Related errors
- archived lookup task failed
- Codex app-server 已关闭
- 请先扫码登录微信
- export markdown task failed
- Remote Control candidate check failed
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/628bd2b213fd4b95.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/connect/mod.rs:335
server
.prepare_thread(None)
.await
.with_context(|| format!("恢复原会话失败({error}),新建会话也失败"))?
}
Err(error) => return Err(error),
};
state
.thread_ids
.insert(message.from_user_id.clone(), thread_id.clone());
let turn = server.run_turn(&thread_id, text);
tokio::pin!(turn);
let turn_result = loop {
tokio::select! {
reply = &mut turn => break reply?,
_ = tokio::time::sleep(std::time::Duration::from_millis(200)) => {
if stop.load(Ordering::SeqCst) {
bail!("微信连接已停止");
}
}
}
};
let reply = if turn_result.reply.trim().is_empty() {
"Codex 已完成处理,但没有返回文字内容。"
} else {
turn_result.reply.trim()
};
let reply_with_footer = append_reply_footer(reply, &turn_result, &app_config.work_dir);
client
.send_text_chunks(
&message.from_user_id,
&reply_with_footer,
&message.context_token,
)
.await
}View on GitHub (pinned to b1ed92e5e4)