修历史回合工具卡片与回合流被整批过滤掉
Project CI / AI game creator shell Rust shard 1/4 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust shard 2/4 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust shard 3/4 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust shard 4/4 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust smoke (pull_request) Has been cancelled
Project CI / AI game creator shell Rust crates (pull_request) Has been cancelled
Project CI / Backend tests (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / AI game creator shell web tests (pull_request) Has been cancelled

- 根因:App 侧 visibleTurnIds 用 directCodexTurnIdFromAssistantMessageId 解析消息 id,该函数要求 direct-codex: 前缀且 :assistant 结尾;实际数据里用户消息是 :user 结尾、assistant 消息是 Codex 原始 id(08ca3ef7-…),一个都解不出来 → visibleToolCalls / visibleTurnStreamItems 双双被过滤为空 → 视图拿不到工具与流(实机:groups=0,重进会话后工具消失)
- 修法一:新增 directCodexTurnIdFromConversationMessageId,:user / :assistant 两种后缀都认
- 修法二:一个回合都解不出来时(老历史)不过滤,交给视图的位置配对与兜底渲染决定位置
- 已删除诊断用的 window.__AGC_DEBUG 临时钩子
- tsc 0 错误
This commit is contained in:
2026-09-16 01:07:50 +08:00
parent f4890d02b5
commit 3f558bc1c1
+26 -1
View File
@@ -489,6 +489,26 @@ function directCodexConversationMessageId(
}
/** 从 `direct-codex:<turnId>:assistant` 反解回合 id;不是这个形状就返回 `null`。 */
/**
* direct-codex id id`direct-codex:<turnId>:user` / `:assistant`
*
* assistant Codex id null
* "全部解不出来"
*/
function directCodexTurnIdFromConversationMessageId(messageId: string) {
if (!messageId.startsWith(DIRECT_CODEX_CONVERSATION_MESSAGE_ID_PREFIX)) {
return null;
}
const rest = messageId.slice(DIRECT_CODEX_CONVERSATION_MESSAGE_ID_PREFIX.length);
for (const suffix of [':user', ':assistant']) {
if (rest.endsWith(suffix)) {
const turnId = rest.slice(0, -suffix.length).trim();
return turnId || null;
}
}
return rest.trim() || null;
}
function directCodexTurnIdFromAssistantMessageId(messageId: string) {
const suffix = ':assistant';
if (
@@ -12250,11 +12270,15 @@ export function App({
messages
.map((message) => message.messageId)
.filter((messageId): messageId is string => Boolean(messageId))
.map(directCodexTurnIdFromAssistantMessageId)
.map(directCodexTurnIdFromConversationMessageId)
.filter((turnId): turnId is string => Boolean(turnId)),
);
// 老历史里 assistant 消息是 Codex 原始 id,一个回合都解不出来:此时**不过滤**,
// 否则工具卡片与回合流会被整批丢掉(实机表现:重进会话后工具与流全部消失)。
const keepAllDirectCodexTurns = visibleTurnIds.size === 0;
const visibleToolCalls = directToolCalls.filter(
(call) =>
keepAllDirectCodexTurns ||
visibleTurnIds.has(call.turnId) ||
call.turnId === activeDirectCodexTurnRef.current?.turnId,
);
@@ -12262,6 +12286,7 @@ export function App({
// 没有流条目的回合由视图自己回退到原来的渲染。
const visibleTurnStreamItems = directTurnStream.filter(
(item) =>
keepAllDirectCodexTurns ||
visibleTurnIds.has(item.turnId) ||
item.turnId === activeDirectCodexTurnRef.current?.turnId,
);