Repository navigation
test: drive the acp-server turn tests with the testkit fake model - #5393
Conversation
The e2e-turn, skills and lifecycle tests scripted the model through test/_helpers/scriptedProvider.ts, which imported the agent-core-v2 test harness, skipped protocol encoding and never failed on a script that did not match the requests. - Start a testkit fake model per test, point the fake model config at it, and verify the script after each test. Delete scriptedProvider.ts. - Raise the fake model context window from 8192 to 262144. With real usage estimates the engine compacted after the first tool step and sent a request no script covered; the old helper reported near-zero usage and answered that request with a silent error. - Check the streamed tool-call cards against the ACP contract (empty pending card, cumulative arguments, started, completed) instead of the old helper's split point. - Let an unscripted request hang in the cancel-during-launch test, and drop the decoy reply from the unknown slash command test. - Lower the test-doubles baseline for acp-server.
|
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: |
…#5385) * test: route new tests to tests/e2e and freeze the paused E2E directories tests/AGENTS.md and the testkit docs still sent new cases to the Desktop and TUI E2E directories that stopped running automatically, and tests could call the engine harness provider helpers without the test-doubles check noticing. - Point tests/AGENTS.md, the testkit docs and the root AGENTS.md at tests/e2e and tests/scenarios, and state that fake models come from the testkit. - Add legacy-e2e.mjs to pnpm lint: it freezes the test cases in the three paused directories per file. - Add the engine-mock-provider rule to test-doubles.mjs; requester-level loop-core unit tests may keep createMockProviderRequester. - Share the file listing, baseline handling and report split of both count checks through ratchet.mjs. * test: drive the acp-server turn tests with the testkit fake model (#5393) The e2e-turn, skills and lifecycle tests scripted the model through test/_helpers/scriptedProvider.ts, which imported the agent-core-v2 test harness, skipped protocol encoding and never failed on a script that did not match the requests. - Start a testkit fake model per test, point the fake model config at it, and verify the script after each test. Delete scriptedProvider.ts. - Raise the fake model context window from 8192 to 262144. With real usage estimates the engine compacted after the first tool step and sent a request no script covered; the old helper reported near-zero usage and answered that request with a silent error. - Check the streamed tool-call cards against the ACP contract (empty pending card, cumulative arguments, started, completed) instead of the old helper's split point. - Let an unscripted request hang in the cancel-during-launch test, and drop the decoy reply from the unknown slash command test. - Lower the test-doubles baseline for acp-server.
Requirement or Bug
acp-server 的三组测试(
e2e-turn、skills、lifecycle)用test/_helpers/scriptedProvider.ts驱动模型。这个 helper 直接 import 了 agent-core-v2 的测试 harness,绕过协议编码,往引擎里塞一个替身;剧本用完时只回一个错误,剩下没用的剧本也不检查。这个 PR 把这三组测试改成用 testkit 的假模型,删掉这个 helper,是「各包自己写的假模型收束到 testkit」的第 1 步。这个 PR 叠在 #5385 上:它会降低 #5385 新加的冻结检查基线。#5385 合入后,这里的目标分支改回
main。Bug Reproduction Steps
N/A
Root Cause
N/A
Code Changes
核心思路:每组测试起一个 testkit 假模型,监听本机随机端口,把 acp-server 测试配置里假模型的
baseUrl指过去。引擎的请求照常经过 OpenAI 协议编码和 HTTP,到达 testkit。每条用例结束时调用verify():剧本没用完、请求比剧本多、消息结构不对,都会让用例失败。test/_helpers/scriptedProvider.tstest/_helpers/fakeModelConfig.tsbaseUrl(默认值不变);两个假模型的上下文窗口从 8192 改成 262144,原因见下test/e2e-turn.test.ts、test/skills.test.ts、test/lifecycle.test.tsmockNextText改成model.script(say(...)),工具调用改成call(...);callCount()改成model.requests().length,callHistory()[i]改成model.requests()[i]?.rawBody;afterEach里先verify()再关闭假模型scripts/checks/baselines/test-doubles.json换成 testkit 之后,有几处改动不是机械替换,逐条说明:
usage_update的size和/status里的窗口){"command":"ec改成空,后面检查「部分参数是完整参数的前缀 → 完整参数 → 升级为已开始 → 完成」model.lane('main').unscripted('hang')echoedverify()失败Behavior Changes and Affected Users
None。只改了 acp-server 的测试和测试 helper,产品代码没动。
测试覆盖:这三组用例原来覆盖的 ACP 行为都还在,现在多了 testkit 的严格检查,请求也经过真实的协议编码。
验证
pnpm exec vitest run packages/acp-server:169 条里 168 条通过。失败的是lifecycle.test.ts的session/delete removes the session and a second delete reports invalid_params,它在改动前的代码上同样失败:本机 macOS 上一直失败,CI 的 Linux 上通过,和这次改动无关。改动涉及的三个文件连跑两次,结果相同。pnpm exec tsc -p packages/acp-server/tsconfig.json --noEmit:通过。pnpm lint:通过。pnpm run check:duplication <main>:没有新增重复。Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.