修复:模型调用失败改按 typed kind 判定通道断开
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 2m39s
Project CI / Backend tests (pull_request) Failing after 16s
Project CI / AI game creator shell Rust crates (pull_request) Failing after 3m14s
Project CI / Frontend tests (pull_request) Successful in 2m4s
Project CI / Repository checks (pull_request) Failing after 22s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m46s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 9m14s
Project CI / Native shell tests (pull_request) Successful in 6m20s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Failing after 12m24s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 2m39s
Project CI / Backend tests (pull_request) Failing after 16s
Project CI / AI game creator shell Rust crates (pull_request) Failing after 3m14s
Project CI / Frontend tests (pull_request) Successful in 2m4s
Project CI / Repository checks (pull_request) Failing after 22s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m46s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 9m14s
Project CI / Native shell tests (pull_request) Successful in 6m20s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Failing after 12m24s
- direct_codex_error_code 原来对 ModelCallFailed 一律按宿主原文子串分类,ModelCallKind::TransportBroken 只有在原文恰好含 transport closed / 连接已关闭 时才会标成 transport-closed - 改为先看 payload.kind:TransportBroken 直接给 transport-closed,其余 kind 仍按原文兜底(TODO 文本判据) - 补用例 model_call_transport_broken_is_classified_from_the_typed_kind:原文不含任何分类标记,也只可能由 typed kind 得出该 code
This commit is contained in:
@@ -2012,11 +2012,17 @@ fn direct_codex_error_code(failure: &TurnError) -> &'static str {
|
||||
Deadline::TurnHardLimit => "turn-hard-timeout",
|
||||
},
|
||||
TurnError::TransportClosed(_) => "transport-closed",
|
||||
// typed 分类优先于文本判据:通道断开的原文不一定带 "transport closed",
|
||||
// 不能让分类结果取决于宿主换了哪句 Display。
|
||||
TurnError::ModelCallFailed(payload) => match payload.kind {
|
||||
ModelCallKind::TransportBroken => "transport-closed",
|
||||
// 其余 kind 还没有专属 code,仍按宿主原文兜底(TODO(文本判据))。
|
||||
_ => classify_direct_codex_error(&payload.detail),
|
||||
},
|
||||
// 产生层还没有 typed 出口:按宿主原文分类(TODO(文本判据))。
|
||||
TurnError::ProjectRootUnanchored(_)
|
||||
| TurnError::EnvironmentNotReady(_)
|
||||
| TurnError::HostStateUnavailable(_)
|
||||
| TurnError::ModelCallFailed(_)
|
||||
| TurnError::TurnInterrupted(_)
|
||||
| TurnError::ReviewRequired { .. }
|
||||
| TurnError::RepairRequired { .. } => {
|
||||
@@ -7417,6 +7423,22 @@ mod tests {
|
||||
assert!(!diagnostic.contains("provider.example"));
|
||||
}
|
||||
|
||||
/// typed 分类优先于文本判据:`ModelCallKind::TransportBroken` 的原文里没有
|
||||
/// `transport closed` / `连接已关闭`,也要标成 `transport-closed`。
|
||||
#[test]
|
||||
fn model_call_transport_broken_is_classified_from_the_typed_kind() {
|
||||
let parent = tempfile::tempdir().expect("temp dir");
|
||||
let root = parent.path().join("project");
|
||||
init_local_game_project_at(&root, "direct-diagnostic", "直连诊断").expect("init project");
|
||||
let error = TurnError::from_model_call(&LlmError::Transport(
|
||||
"宿主自己写的收场说明,不含分类标记".to_string(),
|
||||
));
|
||||
|
||||
let text = record_direct_codex_failure(&root, &error, None);
|
||||
|
||||
assert!(text.contains("code=transport-closed"), "{text}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn direct_failure_diagnostic_marks_project_history_shape_failure_as_not_retryable() {
|
||||
let parent = tempfile::tempdir().expect("temp dir");
|
||||
|
||||
Reference in New Issue
Block a user