Repository navigation
test: keep the replay golden independent of KIMI_CODE_DEBUG - #5412
Conversation
The first-turn replay golden was refreshed with KIMI_CODE_DEBUG=1, so it recorded an extra debug-only item.ended frame and item debug fields that CI never produces. Clear KIMI_CODE_DEBUG in the scenario setup and drop the debug-only data from the golden.
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
The first-turn replay golden was refreshed with KIMI_CODE_DEBUG=1, so it recorded an extra debug-only item.ended frame and item debug fields that CI never produces. Clear KIMI_CODE_DEBUG in the scenario setup and drop the debug-only data from the golden.
The first-turn replay golden was refreshed with KIMI_CODE_DEBUG=1, so it recorded an extra debug-only item.ended frame and item debug fields that CI never produces. Clear KIMI_CODE_DEBUG in the scenario setup and drop the debug-only data from the golden.
Requirement or Bug
release/2026-11-25上ci: release packages (#5349)的 CI 里,test (1)挂在tests/scenarios/replay.test.ts的[L0:kap.replay-recording]:tests/scenarios/recordings/first-turn/trace.json与提交的 golden 有 18 处不同。这个 PR 让 replay golden 不再受运行者环境里的KIMI_CODE_DEBUG影响,并修好发版分支的 CI。Bug Reproduction Steps
release/2026-11-25上,不设KIMI_CODE_DEBUG,运行pnpm exec vitest run tests/scenarios/replay.test.ts。item.ended(带debug)缺失,最终 turns 页面里助手消息的debug字段也缺失。Root Cause
#5383 刷新 golden 时,运行环境里设置了
KIMI_CODE_DEBUG=1。kap-server 在这个变量为1时,会给每个 step 最后一个条目附加debug(finish_reason、timing、usage),并多发一帧带debug的item.ended(packages/kap-server/src/services/conversation/conversationFeed.ts直接读process.env)。这些数据进了 golden,而 CI 不设这个变量,所以每次都失败。场景测试本来就不应该受本机调试开关影响,所以这次从测试侧修复:在场景测试的 setup 里清掉这个变量,golden 也不再含调试数据。这是根本修复,与服务端行为无关。
Code Changes
tests/scenarios/support/setup.ts:场景测试启动时删掉进程环境里的KIMI_CODE_DEBUG,无论在本机跑还是刷新 golden,录到的都是不开调试的结果。tests/scenarios/recordings/first-turn/trace.json:删掉两个流(primary、late)里各一帧带debug的item.ended,以及最终 turns 页面里助手消息的debug字段。改完后与 fix(app): gate completion notifications on turn continuation #5383 之前的 golden 相比,只多了 fix(app): gate completion notifications on turn continuation #5383 本身引入的continuation: "none"。Behavior Changes and Affected Users
None。只改了场景测试的 setup 和 golden 数据,产品代码、配置、契约文件都没有改动。
验证情况:
pnpm qa:refresh replay、pnpm exec vitest run tests/scenarios/replay.test.ts、pnpm lint和pnpm run check:duplication都未验证,靠这个 PR 的 CI 确认。stableJson的格式(键排序、2 空格缩进、末尾换行)用脚本改的:脚本先确认能把原文件原样写回,再做删除。删除的内容与 CI 报告的 18 处差异一一对应。KIMI_CODE_DEBUG=1 pnpm exec vitest run tests/scenarios/replay.test.ts,确认开着调试开关 golden 也能通过。Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.