Repository navigation
fix(mobile-web): stamp assistant messages with the turn completion time - #3811
Merged
bobleer merged 1 commit intoNov 8, 2026
Merged
Conversation
The reducer captured `Date.now()` on `dialog-turn-started` and reused it for the assistant message, so a turn that ran tools for minutes showed the moment the user pressed send instead of when the answer landed. Record the completion time when the turn closes. Replayed turns now prefer the host's `endTime` and fall back to the turn timestamp for records written before that field existed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
mobile-web 里 AI 消息下的时间戳显示的是用户按下发送的时刻,不是回答完成的时刻。一轮跑了几分钟工具的话,时间戳会停在开头,看起来就像 agent 秒回。
根因
SessionEventReducer在agentic://dialog-turn-started时记录Date.now()(秒),然后:dialog-turn-completed/cancelled/failed构造 assistant 消息时复用了同一个this.timestampSessionRecordPresentation)用turn.timestamp(轮次开始时间)host 侧
DialogTurnData其实有end_time(毫秒,轮次结束时写入)和duration_ms,只是 mobile-web 没读。改动
endTime,缺字段时退回turn.timestamp(老记录兼容)用户消息时间戳保持不动。没有按
timestamp排序的代码,isOldResponse用的是 index,顺序不受影响。验证
pnpm --dir src/mobile-web run type-check通过(tsc + vite build)。