Skip to content

test: check the prompt cache prefix across the test suites - #5474

Merged
RealKai42 merged 10 commits into
mainfrom
test/prompt-cache-ledger
Nov 26, 2026
Merged

RealKai42 merged 10 commits into
mainfrom
test/prompt-cache-ledger

Conversation

@RealKai42

@RealKai42 RealKai42 commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Requirement or Bug

Related #4935

最近接连出现 prompt 缓存未命中:压缩请求的工具集和普通回合不一致(2.7.2 里 39 → 29 个工具)、新建会话和恢复会话的工具集不一致、接近窗口上限时从头裁剪历史。这些都是「客户端发出的请求没有沿用上一个请求的前缀」,但测试一个都没拦住:引擎里原有的 prompt-cache-guard 只在 agent-core-v2 的 harness 里生效,按 agent 对象比较、跨重启就失去基线,还在工具名集合变化时直接跳过;而且测试只在默认配置下跑,出问题的 Tower、MCP 这类配置根本覆盖不到。

这个 PR 把「同一缓存键下,每个请求都必须延续之前的前缀,任何断点都必须显式声明」变成所有用到 testkit 假模型的测试默认都会检查的契约,并补上跨配置、跨产品面的缓存旅程测试。这个 PR 只改测试基建和测试,不改产品代码。

Bug Reproduction Steps

N/A(测试基建)

Root Cause

N/A(测试基建)。缓存问题为什么漏网见下面的「关键决策」。

Code Changes

核心思路:testkit 假模型在协议层模拟服务端的前缀缓存。它按服务端缓存的顺序,把每个请求切成参数、system、tools、messages 几段,按实际发出的 JSON 文本比较。主请求和压缩请求必须延续同一协议、同一缓存键、同一模型下的上一个主请求,否则 verify() 失败;撤销、清空上下文这类有意改写,测试要用 expectCacheBreak(reason) 写明原因。因为判断点放在线上的请求体上,引擎、node-sdk、KAP 场景和四个产品面的 E2E 都共用这一套检查。

概念

概念 回答什么问题 本 PR 之后
缓存账本 model.promptCache() 每个请求复用了多少前缀、复用自哪个请求、断在哪一段 每个假模型都记录,无需配置
基线(baseline) 这个请求应该延续哪个请求 同一协议、缓存键、模型下的上一个主请求;被服务端拒绝的请求不算,读取结果时按最终的拒绝状态计算,所以并发时后来才被拒的请求也会被排除。子 agent 的压缩请求只压缩它自己的历史,既不和主 agent 比较,也不给主 agent 发「压缩后重启历史」的许可
断点声明 expectCacheBreak(reason, { at }) 这个前缀改写是不是有意的 没声明的断点、声明了却没发生的断点都会让 verify() 失败
自动豁免 哪些断点不用声明 只有一种:压缩之后第一个主请求可以换一段新历史,但请求头不能变(依赖 kimi 类型的角色元数据)

结构图

flowchart LR
  subgraph Tests
    E[agent-core-v2 harness] --> M
    S[node-sdk / product tests] --> M
    K[KAP scenarios + cache journey] --> M
    X[E2E: TUI / Web / Desktop / ACP] --> M
  end
  M[testkit fake model] --> C[codec.promptPrefix: params / system / tools / messages]
  C --> L[PromptCacheLedger]
  L -->|verify / promptCacheProblems| R[undeclared breaks fail the test]
  L -->|reportCachedTokens| U[usage cached_tokens back to the product]
Loading

所有测试层都已经通过 testkit 假模型发请求,所以把检查放在假模型里,一处实现就覆盖每一层,而不是在每个 harness 里各写一份。

关键决策

决策 选择 没选 理由
比较哪一层 线上请求体,按实际发出的 JSON 文本 引擎内部的 LlmRequest(旧 guard 的做法) 服务端缓存认的是发出去的字节;协议编码、键序、prompt_cache_key 的变化在引擎层看不到
默认开还是按需开 默认开启,checkPromptCache: false 关闭 按需开启 2.7.2 的 bug 要两个条件同时满足才会漏网:guard 豁免了工具名变化,而且没有测试跑到 Tower 配置。只有默认开启,新加的测试才会自动被检查
断点怎么处理 一律显式声明,写明原因 在检查器里按 contextRevision、媒体降级等场景自动豁免 自动豁免正是旧 guard 漏网的原因;显式声明让每一次缓存代价都能在评审时看到
对话线怎么划分 协议 + 缓存键 + 模型;角色取自 kimi 元数据 按 agent 对象 每个模型、每个协议各有一份缓存;按 agent 对象划分会在重启后失去基线
node-sdk 测试的 provider 类型 改成 kimi 检查器按 system prompt 猜对话线 只有 kimi 类型会带角色元数据;猜测的办法分不清 fork 型子 agent,也会让 SDK 路径上 system prompt 的漂移变得看不见
MCP 测试服务 在 testkit 里新增可配置的 fakeMcpServer,作为全仓库 MCP 假服务的唯一来源 复用 packages/agent-core-v2/test/mcpCore/fixtures/*.mjs 那些服务的行为写死在脚本里,旅程需要由测试指定工具、schema 和回复;而且它们属于 agent-core-v2 的测试代码,却被 acp-server、kap-server、node-sdk 和 CLI 的测试按相对路径直接引用。现有的 MCP 假服务(8 个 stdio 脚本、进程内的 HTTP / SSE 服务)会在紧接着的 PR 里迁到 testkit 并删掉,这个 PR 先不动它们,避免把搬家和新功能混在一起
配置矩阵 每组配置先断言自己确实改变了请求 只跑配置 实际跑下来发现,Tower 写在 config.toml 里、渐进加载少了 tool_use、MCP 默认不走延迟加载,这三组最初都是空转,测试照样通过

旧 guard 的功能清单(替换旧路径时要求列出)

prompt-cache-guard 做的事 在新检查里
每个回合请求和 droppedCount = 0 的压缩请求,都要延续上一个回合请求 每个主请求和压缩请求都要延续上一个主请求;从头裁剪的压缩也要检查,有意的就声明
thinking、模型一致 参数段(模型和思考设置);换模型时另起一条对话线
system、tools 一致(工具名集合变化时豁免) 一致,不再豁免
历史是前缀扩展 同样检查
换模型、contextRevision 变化、换分支时跳过 换模型另起一条线;撤销、压缩这类改写要显式声明
媒体降级时允许同位置替换成占位符;修正消息用完就丢 被拒请求不当基线;其余情况显式声明
cacheKey、extraParams、responseFormat 一致 缓存键不同就分到不同的池,换键不会报错,所以旅程测试显式断言整个会话只用一个缓存键。responseFormat 并入参数段,按各协议的写法比较:OpenAI 的 response_format、Responses 的 text、Anthropic 的 output_config、Google 的 responseMimeType 和响应 schema。OpenAI 和 Anthropic 的文档都写明结构化输出的 schema 属于缓存前缀。extraParams 是各 provider 自定义的透传字段,不检查
promptCacheComparisons() 计数 ctx.promptCache() 账本条目
prepareOperation 前先 restorePersisted() 保留成一个不做检查的普通包装器

阅读指南

  1. packages/testkit/src/model/prompt-cache.ts:账本、基线、断点和声明的全部规则。
  2. packages/testkit/src/model/protocols/*.ts 里的 promptPrefix:各协议按服务端缓存的顺序切段。Anthropic 是 tools → system → messages,并忽略 cache_control。Anthropic 和 Google 的每条消息按「角色 + 每个内容块」切段,因为这两家会把连续的用户消息合并成一条,只在后面追加块。
  3. packages/testkit/src/model/fake-model.ts:接线,包括默认开启、被拒请求、reportCachedTokens。
  4. packages/agent-core-v2/test/harness/{agent,scripted-generate}.ts:harness 转发声明,旧剧本路径也报告缓存问题;prompt-cache-guard.ts 被删除。
  5. tests/scenarios/prompt-cache.test.ts:缓存旅程,8 组配置,每组都经过重试、MCP 调用、手动压缩、重启、自动压缩和子 agent;另有 5 种会话中途的变化和插话。自动压缩把触发比例设成 0.5,让回合最后一条回复报出约 0.6 倍窗口的用量:压缩在后台启动,下一回合的第一步等它完成,这正是 fix(agent-core-v2): wait for in-flight auto compaction before the next step #5454 修的路径,也低于 0.875 倍窗口的预裁剪线。
  6. tests/e2e/scenarios/conversation/keeps-one-prompt-cache-prefix-across-a-restart.spec.ts:四个产品面上的旅程。

可以略读的部分:各测试文件里新增的 25 处 expectCacheBreak 声明、packages/testkit/src/fixtures/mcp*.ts(基于官方 SDK 的假 stdio MCP 服务,供旅程挂载 MCP 用)、文档。

25 处断点声明的原因分布
原因 处数
撤销改写历史 15
测试自己经 requester / operation 构造的请求 3
工具参数修正消息用完即弃 2
媒体恢复把图片换成占位符 2
清空上下文 1
摘要被截断后重试时丢掉最老的消息(现有设计) 1
E2E 里没有声明,全部延续前缀 —

Behavior Changes and Affected Users

产品行为:无。diff 只涉及 packages/testkit(私有测试包)、各包的 test/ 目录、tests/ 和测试文档,没有改动任何产品源码、配置项、协议或提示词文本。

测试侧的行为变化:

Behavior Before After Who relies on the old behavior Escape hatch
testkit 假模型的 verify() 不检查缓存前缀 默认检查,未声明的断点会失败 所有用 testkit 假模型的测试:引擎 harness、node-sdk、kap-server、acp-server、klient、product、app-core、KAP 场景、E2E checkPromptCache: false;harness 里是 scriptedModelChecks.checkPromptCache: false
agent-core-v2 harness 的缓存检查 prompt-cache-guard,按 agent 对象、在引擎请求层比较 由假模型在线上请求体层检查 agent-core-v2 测试,以及 llmRequester.test.ts 里对 promptCacheComparisons() 的断言 同上;那条断言改成查 ctx.promptCache()
node-sdk session-prompt-events.test.ts 的假 provider openai 类型 kimi 类型 这个文件的 26 个用例 无需退路:其他 provider 类型由 tests/scenarios/providers.test.ts 和 klient 的矩阵覆盖
冷恢复用例「崩溃后保留在固定目录」 模型收到请求就立刻杀进程 先等用户消息和 step.begin 写进 wire.jsonl 再杀,并断言被打断的回合和提示词都被保留 只有这个用例 无;原测试存在竞态,KAP 只保证在停止点落盘
新增的可选能力 — reportCachedTokens、promptCacheProblems()、fakeMcpServer、startKap({ mcpServers })、scenarioFixtures({ env, mcpServers }) 无(新增) 不传就是原来的行为
testkit 依赖 — 新增 @modelcontextprotocol/sdk ^1.29.0(agent-core-v2 和 desktop 已在用同一版本) 无 —

测试覆盖:规则单测 packages/testkit/test/prompt-cache.test.ts,用官方 OpenAI、OpenAI Responses、Anthropic、Google SDK 驱动;四种 provider 类型经真实引擎的验证在 tests/scenarios/providers.test.ts;MCP 夹具用官方 MCP 客户端在 packages/testkit/test/fixtures.test.ts 里验证;缓存旅程在 tests/scenarios/prompt-cache.test.ts 和上面的 E2E 场景里。

验证结论:本机(macOS)上跑过 pnpm lint、7 个项目的类型检查、agent-core-v2 全量、其余所有用到 testkit 的包和 KAP 场景,以及 E2E 的 TUI 和 ACP 全量(构建产物)。新 E2E 场景在 Web 和 Desktop 上也单独跑过。全量测试中,缓存检查报出的问题为 0。全量运行时,机器上同时跑着别的测试,负载在 60 到 130 之间,有一批计时和超时类用例失败:它们要么不经过这个 PR 改动的代码(搜索服务的主线程响应、mergeWorkspaces 的耗时、滚动控制器的随机不变量),要么是在等待模型或启动时超时,没有一条是缓存检查报错。合入前以 CI 在干净机器上的结果为准。

为了确认这些检查真的会抓到问题,我临时向引擎注入了几种故障,验证完已全部还原:

  • 恢复会话时少带一个工具:KAP 旅程的 6 组配置和 E2E 的 TUI(走 SDK 组装路径)都失败,报在重启后的第一个请求上:tools[23] Write is missing;
  • 压缩请求按当前策略过滤工具(照搬 2.7.2 的逻辑):被 dynamicActiveTools.verify.test.ts 拦下;
  • 恢复会话时不等 MCP 服务发现完成:两组 MCP 配置都失败;
  • 请求中工具顺序被颠倒:providers.test.ts 的 4 种 provider 都失败。

这个 PR 没有修、但跑测试时暴露出来的产品问题(已分别跟进):

验证命令与结果
检查 命令 结果
lint pnpm lint 通过
类型检查 pnpm exec tsc --noEmit -p <dir>/tsconfig.json:testkit、agent-core-v2、node-sdk、kap-server、product、tests/scenarios、tests/e2e 全部通过
锁文件 pnpm install --frozen-lockfile --offline 通过;相对 main 只多 testkit 的 3 行
重复代码 pnpm run check:duplication <main> 无新增重复
agent-core-v2 pnpm exec vitest run --project agent-core-v2 8,331 / 8,346 通过;10 个失败都是负载下的超时(remote process/session、tool 的 subagent deadline、fullCompaction 的假定时器、Tower store 的锁等待),缓存检查问题 0
其余用到 testkit 的包和场景 pnpm exec vitest run packages/{testkit,node-sdk,kap-server,acp-server,klient,product,app-core} tests/scenarios … 4,742 / 4,777 通过;失败同上属于负载下的计时类用例,缓存检查问题 0
第二次 rebase 后的针对性验证 testkit 全量、#5445 迁移的标题和反馈测试、node-sdk、kap-server feedback/sessions、oauth 契约测试、本 PR 改动的测试文件、tests/scenarios 1,314 / 1,316 通过;2 个失败是 fullCompaction 的两个假定时器用例在负载下超时(低负载下单独重跑通过),缓存检查问题 0;suggestFiles 在 main 合入 #5452 后已通过
E2E TUI TESTKIT_CLI_BUILD=dist pnpm --filter @moonshot-ai/e2e exec playwright test --project=tui 188 通过,8 个按设计跳过
E2E ACP 同上,--project=acp 153 通过,43 个按设计跳过
E2E Web / Desktop 只跑新场景 各 1 个通过
故障注入 见上文 全部被抓到,代码已还原

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: issue must have a maintainer's /approve).
  • I have added tests that prove my feature works.
  • The behavior-change table above is complete, and every removed behavior or flipped default is named in the changeset and either has an escape hatch or was explicitly approved by a maintainer in this PR.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 616815a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T05:13:48.656760Z 616815a New commits
🔒 Security Review ✅ Completed 2026-11-26T02:30:27.907086Z fc0ad8b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@616815a
npx https://pkg.pr.new/@moonshot-ai/kimi-code@616815a

commit: 616815a

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fc0ad8bd2b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

The fake model now records every request in a prompt cache ledger that
splits it into segments in the order a provider caches them (model and
thinking settings, system, tools, messages; tools before system for
Anthropic) and compares them as the JSON text that was sent.
model.promptCache() reports each request's estimated reuse, the earlier
request it reuses and, for main and compaction requests, the first
difference from the latest main request under the same cache key.

checkPromptCache makes verify() fail on a break nobody declared;
model.expectCacheBreak(reason, { at }) declares an intended one, and the
first main request after a compaction may start a new history as long as
its header stays the same. reportCachedTokens reports the reused tokens
as cache reads in usage. Both options are off by default.

The provider scenarios run two turns with a tool call through the real
engine for every provider type with both options on.
The pinned mid-turn cold-recovery test killed the KAP server the moment
the fake model received the request. Wire records are flushed
asynchronously, so the kill usually landed before the prompt's
context.append_message reached disk, and the restarted server had no
trace of the interrupted turn.

KAP only promises durability at stopping points, so the test now waits
until the prompt's user message and its step.begin are in wire.jsonl
before crashing. After the restart it checks that the turn is kept as
interrupted with its user message, and that the next request starts
with the messages of the interrupted request.
…guard

The fake model now checks the prompt cache prefix unless a test passes
checkPromptCache: false. A main or compaction request must extend the
latest main request under the same protocol, cache key and model; a
request the provider rejected with an HTTP or network error is neither
checked, a baseline nor a source of reuse, because nothing was cached.
model.promptCacheProblems() reports the problems for harnesses that do
not call verify().

The agent-core-v2 harness forwards ctx.expectCacheBreak() and
ctx.promptCache() to the model that answers the agent, reports cache
problems from the legacy scripted path at the end of each test, and
accepts scriptedModelChecks.checkPromptCache: false. It replaces
prompt-cache-guard, which compared engine-level requests per agent
object and skipped any change to the tool-name set: system, tools and
history are now compared as sent on the wire for every test, model
changes start their own baseline, history rewrites need a declaration,
and the prepareOperation hook that restored persisted state first is
kept as a plain wrapper.

Every intended break in the existing suites is declared with its
reason: undo, clearing the context, the dropped argument-correction
message, media recovery, a truncated summary retried without the
oldest message, and tests that send their own messages through the
requester. The node-sdk prompt-event tests use the kimi provider type,
so the role metadata keeps subagent requests out of the main thread.
fakeMcpServer(name, { tools, callLog }) returns an mcp.json server entry
that starts a real stdio MCP process built on the official SDK. Each
tool has a name, a description, a JSON Schema and a fixed reply, and
every call is appended to the call log, which readMcpCalls() reads
back. writeMcpConfig() writes mcp.json, and startKap accepts
mcpServers so a KAP test can mount servers before the server starts.
A server entry with deferred: true puts its tools behind progressive
tool loading.

The server registers tools/list and tools/call on McpServer's
underlying server so the schema a test passes reaches the client
unchanged. The fixtures tests drive it with the official MCP client.
A KAP scenario runs one session through tool calls, a retried 503,
manual compaction, a restart, a subagent, MCP tool calls and a second
compaction, and requires every main request to extend the cached
prefix under one cache key. It runs under eight configurations: the
default, every experimental feature, progressive tool loading,
thinking, a mounted MCP server, a deferred MCP server behind
progressive loading, and the anthropic and google-genai provider
types. Each configuration asserts that it changed the requests, so a
setting that stops taking effect fails instead of passing silently.

Separate KAP cases turn on plan mode, swarm mode and tower mode,
switch to manual approvals, write AGENTS.md between two turns, and
steer a running reply; each keeps the next request on the same prefix.

An E2E scenario reads a file, runs an approved shell command, restarts
the product and reads again on TUI, Web, Desktop and ACP, and checks
the cache ledger and the single cache key across the restart.

scenarioFixtures forwards env and mcpServers to startKap.
Address the review of the prompt cache ledger:

- A subagent's compaction compacts the subagent's own history, so its
  role is subagent: it is neither checked against the main agent nor
  lets the next main request restart the history. It is still scripted
  on the compaction lane.
- Baselines, breaks and allowances are worked out when entries or
  problems are read, from the final rejection state, so a request that
  arrived while an earlier one was waiting for its step is not compared
  with that earlier request once the provider rejects it.
- Anthropic and Google merge consecutive user messages by appending
  content blocks, so their messages are split into a role segment and
  one segment per block or part: an appended block extends the prefix,
  a changed block or one put in front still breaks it.
- The structured output schema is part of the cached prefix, so the
  header now holds response_format, the Responses text settings,
  Anthropic output_config and Google's response MIME type and schema.
…n case

The case added with the auto compaction fix pushes the context close to
the window, so both compaction requests drop the oldest exchange to fit.
That is the same head drop the truncated summary retry makes, so the
case declares both breaks until the trimming contract is settled.
@RealKai42
RealKai42 force-pushed the test/prompt-cache-ledger branch from fc0ad8b to 43884da Compare November 26, 2026 04:35

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 43884dafe3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

With the auto compaction race fixed, each journey lowers the trigger
ratio to 0.5 and lets a turn's last reply report about 0.6 of the
window. The compaction starts in the background, the next turn's first
step waits for it, and the request after it carries the summary. The
usage stays below the 0.875 window line where the compaction input is
trimmed from the head, so the journey checks the cache across the
compaction itself rather than the known head drop.

The trigger sits on the last reply of a turn instead of after a tool
call: compacting there makes the Google request merge the instruction
in front of the filled-in tool result, which the fake model's message
check rejects, and that ordering needs its own decision.
…ed cache_control

- A request now counts as rejected from how its playback ended: a hold
  that failed before the headers, or reset the connection, answers it
  with an error as surely as an error step does.
- Anthropic cache markers are stripped only where the protocol puts
  them: on tools, system blocks, message content blocks and the blocks
  inside a tool result. A tool schema or tool input property that
  happens to be called cache_control is compared like any other.
- A break on a thread without a prompt cache key now says why: Google
  requests carry nothing that tells conversations apart, so a test that
  runs several of them gives each its own model.
@RealKai42
RealKai42 added this pull request to stack #5496 November 26, 2026 05:35
@RealKai42
RealKai42 merged commit 51a0ea4 into main Nov 26, 2026
30 checks passed
@RealKai42
RealKai42 deleted the test/prompt-cache-ledger branch November 26, 2026 05:35
RealKai42 added a commit that referenced this pull request Nov 26, 2026
#5474 landed on main as one squashed commit, so its files conflicted
with the earlier branch commits this branch was cut from. The merge keeps
main's version of every #5474 file and reapplies only this branch's
change: the Google view rule, its tests and docs, and the mid-turn
compaction trigger in the cache journeys.
RealKai42 added a commit that referenced this pull request Nov 26, 2026
#5474 landed on main as one squashed commit, so the prompt cache files
this branch carried from it now come from main as merged, including the
review fixes made after this branch forked.

Two main changes met the MCP migration:

- #5486 made the crash-after-connect fixture exit when the test creates
  a signal file instead of after a fixed delay. The fixture is gone, so
  the testkit's exitAfterConnect now takes whenFile in place of afterMs,
  crashAfterConnectServer passes it on, and both crash cases keep the
  signal they create once they have seen the connected state.
- #5488 added hostPathClass to the MCP stubs for Windows path classes.
  The stubs keep it beside the testkit-based servers.
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Dec 2, 2026
…flags port

M34 (merge f643d40) ported the server-driven two-tier experimental flag system, so MoonshotAI#5333's not-applicable probe absent:experimentalFeatures started failing on main: --verify reported 316 pass / 2 skipped / 1 fail.

The row is partial, not ported: the per-PR file-completeness gate counts 3 of 115 files never carried by this fork - two tests/e2e specs (the upstream Playwright suite this fork does not carry; MoonshotAI#5380 records the same) and tests/scenarios/prompt-cache.test.ts (added upstream by MoonshotAI#5474 and never carried here). 107 files are carried and 5 changesets are exempt. The landed half is the whole feature: app-core ServerMeta types and daemon mapping, the kap-server /meta wire, the app-client store writing profile buckets, and the desktop Lab UI. The flat-flag deviation PLAYBOOK:111 recorded is retired by that port.

The probe is the kap-server meta case asserting /meta reports experimental_beta and experimental_features with stage, effect_timing and source; approved_by is "M45 file-level audit". No changeset: ledger bookkeeping is not user-perceivable.

Verified: bun scripts/upstream-ledger.mjs --verify -> 317 probes pass, 2 skipped, 0 probe fail, 0 completeness fail; a second run leaves the ledger byte-identical (sha256 d0f17e07...). bun test --timeout 30000 scripts/test/upstream-ledger-probes.test.ts -> 29 pass / 0 fail. bun run lint and node scripts/checks/ratchet.mjs green. The branch is based on main 7e56303 and carries no spawn-snapshot WIP.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant