前端:Direct 回合失败分支去掉嵌套三元

- `runTurn` 的 catch 先把非结构化错误折成文本,再让结构化拒单文案覆盖,替掉原先"拒单 / Error / 其它"三层嵌套的三元表达式
This commit is contained in:
2026-09-24 14:48:21 +08:00
parent 2ce96a73f0
commit 6cee61b973
@@ -696,11 +696,9 @@ export function useDirectProjectChatController({
if (projectPathRef.current !== nextProjectPath) return false;
// 认不出的拒单(宿主 / 环境事实)与其它非结构化错误走同一条通道:上报 + 横幅。
void captureAgentRuntimeError(error, DIRECT_CODEX_AGENT_ID);
const message = rejection
? rejection.message
: error instanceof Error
? error.message
: String(error);
// 拒单文案优先:它是宿主 `Display` 生成的唯一一份,比 `Error` 的形状更可信。
let message = error instanceof Error ? error.message : String(error);
if (rejection) message = rejection.message;
// 不再展开诊断详情:文案里没有引用,前端也不去读那份文件。线索留在
// `.agent/runtime/errors`、应用日志与错误上报池里,界面只显示这一句话。
const visibleMessage = projectRuntimeVisibleError(