修复 Direct 诊断留痕的编译错误
- direct_runtime:分段 trace 改用 crate 级 app_log!,crate::append_application_log 在宿主并不存在 - thread_manager::dispatch:兜底收口与 panic hook 同样改用 app_log! - thread_manager::dispatch:补上 emitter 取用 turn_id 后的 clone,修掉借用已移动值
This commit is contained in:
@@ -4302,11 +4302,7 @@ pub(crate) fn check_direct_turn_preconditions(
|
||||
/// 具体停在哪一步。测试态不写,避免污染本机 AppData。
|
||||
#[cfg(not(test))]
|
||||
pub(crate) fn direct_turn_trace(stage: &str) {
|
||||
let _ = crate::append_application_log(
|
||||
"info".to_string(),
|
||||
"direct-turn".to_string(),
|
||||
format!("agent.direct_turn.trace stage={stage}"),
|
||||
);
|
||||
app_log!("agent.direct_turn.trace stage={stage}");
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -104,17 +104,13 @@ impl Drop for TurnReservation {
|
||||
),
|
||||
};
|
||||
let _ = record_direct_codex_failure(Path::new(&self.thread_id), &failure, None);
|
||||
let _ = crate::append_application_log(
|
||||
"error".to_string(),
|
||||
"direct-turn".to_string(),
|
||||
format!(
|
||||
"agent.direct_turn.host_dropped threadId={} turnToken={} userItemId={} panicking={}",
|
||||
self.thread_id,
|
||||
self.token,
|
||||
self.user_item_id.as_deref().unwrap_or("-"),
|
||||
// true = 这一轮是被 panic 带走的;false = future 被丢弃或取消。
|
||||
std::thread::panicking()
|
||||
),
|
||||
app_log!(
|
||||
"agent.direct_turn.host_dropped threadId={} turnToken={} userItemId={} panicking={}",
|
||||
self.thread_id,
|
||||
self.token,
|
||||
self.user_item_id.as_deref().unwrap_or("-"),
|
||||
// true = 这一轮是被 panic 带走的;false = future 被丢弃或取消。
|
||||
std::thread::panicking()
|
||||
);
|
||||
}
|
||||
// 占用的释放就是"这个项目腾出了跑回合的位置":踢一脚,队里排着的消息不必等下一次用户动作。
|
||||
@@ -152,16 +148,12 @@ fn ensure_direct_turn_panic_hook() {
|
||||
})
|
||||
.unwrap_or_else(|| "未知位置".to_string());
|
||||
#[cfg(not(test))]
|
||||
let _ = crate::append_application_log(
|
||||
"error".to_string(),
|
||||
"direct-turn".to_string(),
|
||||
format!(
|
||||
"agent.direct_turn.panic threadId={} turnToken={} location={} payload={}",
|
||||
thread_id,
|
||||
token,
|
||||
location,
|
||||
info.payload_as_str().unwrap_or("未知 panic 负载")
|
||||
),
|
||||
app_log!(
|
||||
"agent.direct_turn.panic threadId={} turnToken={} location={} payload={}",
|
||||
thread_id,
|
||||
token,
|
||||
location,
|
||||
info.payload_as_str().unwrap_or("未知 panic 负载")
|
||||
);
|
||||
#[cfg(test)]
|
||||
let _ = (thread_id, token, location);
|
||||
@@ -241,7 +233,7 @@ async fn run_dispatched_direct_turn(
|
||||
// 未通过验收、历史注入失败)都靠它把失败说明挂回自己那一轮。
|
||||
crate::agent::codex_app_server::emit_direct_thread_user_item(&root, &canonical_user_item);
|
||||
let capture = crate::analytics::gui::capture_writer_context();
|
||||
let emitter = DirectGameCreatorTurnUpdateEmitter::new(&root, turn_id);
|
||||
let emitter = DirectGameCreatorTurnUpdateEmitter::new(&root, turn_id.clone());
|
||||
// 回合体 panic 不能落到 `TurnReservation` 的 Drop 兜底:那会把这一轮收成"说不出原因"的
|
||||
// `HostDropped`,症状正是用户看到的「本轮执行已中断,请重试」,而项目侧诊断与应用日志
|
||||
// **一行都不会有**(真实案例:2026-10-02 连续两轮)。这里把 panic 转成分类失败,
|
||||
|
||||
Reference in New Issue
Block a user