test(rtchild): rt_children stop 判据改为等历史入账,不等 Rounds

判据偶发红(实测约 1/12):`stop 没有告诉模型用 rt_transcript 取回原文`。

根因是**判据自己等早了**,不是产品缺陷:

- `Rounds` 在 ChatStream 被调用时就自增(请求刚构建完)
- assistant 那条消息是**流结束后**才追加进 history 的

于是 stop 可能读到 n==0,走"本次通话没有上下文需要交接"分支 ——
而那个分支**本来就该**不提 rt_transcript(真没内容可取)。

改为等 RTTranscript 非空。

★ 这是同一类坑的第二次复发(第一次在 rtchild_r7b_test):
判据等"请求已发出"而不是"结果已落库"。
"""
This commit is contained in:
JianFeeeee
2026-10-30 17:21:51 +08:00
parent eb1deab5dd
commit dff745cde2

View File

@ -381,9 +381,16 @@ func TestRTChildrenTool_FullLifecycle(t *testing.T) {
if !strings.Contains(out, "打断") {
t.Fatalf("send 没说明打断语义:%q", out)
}
waitFor(t, "rtchild 跑了一轮", func() bool {
st, ok := host.RTChildStats("call-1")
return ok && st.Rounds >= 1
// ★ 必须等**历史入账**,不能等 Rounds。
//
// Rounds 在 ChatStream **被调用时**就自增(请求刚构建完),而 assistant
// 那条消息是**流结束后**才追加进 history 的。等 Rounds 的话,随后的
// stop 可能读到 n==0,于是走"本次通话没有上下文需要交接"分支 ——
// 判据就会怪 stop 没提示 rt_transcript,而其实是它自己等早了。
// (同 rtchild_r7b_test 的坑,实测约 1/12 概率。)
waitFor(t, "rtchild 跑了一轮并写入历史", func() bool {
tr, ok := host.RTTranscript("call-1")
return ok && len(tr) > 0
})
// ④ stop:回收并交接