修复智能创作鉴权提示可读性

分隔产品名称与直连运行时错误原因

同步更新直连错误投影测试
This commit is contained in:
kdletters
2026-08-17 15:35:13 +08:00
parent 7ecc9f4971
commit f30e6e9f33
2 changed files with 12 additions and 5 deletions
@@ -1783,7 +1783,10 @@ function directCodexFailureDetail(message: string) {
}
const safe = detail
.replace(/https?:\/\/[^\s]+/gi, '[已隐藏链接]')
.replace(/(?:[A-Z]:\\|\\\\|\/(?:Users|home|var|tmp|private)\/)[^\s]+/gi, '[已隐藏路径]')
.replace(
/(?:[A-Z]:\\|\\\\|\/(?:Users|home|var|tmp|private)\/)[^\s]+/gi,
'[已隐藏路径]',
)
.replace(/\s+/g, ' ')
.trim()
.slice(0, 280);
@@ -1866,7 +1869,7 @@ export function projectRuntimeVisibleError(
other: '未完成本次执行,请查看项目文件是否已修改后再重试',
}[directCodexAppServerKind];
if (detail) {
return `${subject}${detail}`;
return `${subject} ${detail}`;
}
}
if (visibleMessage.includes('codex-app-server-terminal-unknown:')) {
@@ -944,7 +944,7 @@ describe('Agent Runtime Provider 状态投影', () => {
'陶泥儿智能创作',
true,
),
).toBe('陶泥儿智能创作用量已达上限,请检查账户额度后重试');
).toBe('陶泥儿智能创作 用量已达上限,请检查账户额度后重试');
expect(
projectRuntimeVisibleError(
'codex-app-server-terminal-unknown: 等待 turn/completed 超时',
@@ -963,14 +963,18 @@ describe('Agent Runtime Provider 状态投影', () => {
'陶泥儿智能创作',
true,
),
).toBe('陶泥儿智能创作:Codex 执行失败:Codex app-server turn 失败:HTTP 400');
).toBe(
'陶泥儿智能创作:Codex 执行失败:Codex app-server turn 失败:HTTP 400',
);
expect(
projectRuntimeVisibleError(
'direct-codex-error:请求失败 https://provider.example/private C:\\Users\\private\\project',
'陶泥儿智能创作',
true,
),
).toBe('陶泥儿智能创作:Codex 执行失败:请求失败 [已隐藏链接] [已隐藏路径]');
).toBe(
'陶泥儿智能创作:Codex 执行失败:请求失败 [已隐藏链接] [已隐藏路径]',
);
expect(
projectRuntimeVisibleError(