eval: 完成任务书15路线对照与先想后读核查
This commit is contained in:
@@ -338,7 +338,7 @@ test("第二次预测关闭:选批", () => {
|
||||
});
|
||||
|
||||
test("选批做完:停下,原因\"实现还没写\"", () => {
|
||||
assert.deepEqual(nextStep(roundOne("selectBatch").records), { do: "halt", reason: "实现还没写(任务书 15)", objects: [] });
|
||||
assert.deepEqual(nextStep(roundOne("selectBatch").records), { do: "halt", reason: "实现还没写(任务书 16)", objects: [] });
|
||||
});
|
||||
|
||||
test("关掉第一次预测:第 1 轮写一条按配置跳过(对象 r1-firstPrediction),接着开挑刺", () => {
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { mkdtempSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { test } from "node:test";
|
||||
|
||||
test("思考核查:列目录不截断,首次读源码才截断,并保留原始行号", () => {
|
||||
const root = mkdtempSync(join(tmpdir(), "inforsi-route-thinking-"));
|
||||
try {
|
||||
const call = join(root, "calls/r0-entryDraft.researcher-1.entry.none.1");
|
||||
const sessions = join(call, "sessions");
|
||||
const code = join(call, "code");
|
||||
mkdirSync(sessions, { recursive: true });
|
||||
mkdirSync(code);
|
||||
writeFileSync(join(code, "initial.py"), "print('baseline')\n");
|
||||
writeFileSync(join(code, "SOURCES.md"), "reference\n");
|
||||
const messages = [
|
||||
{ type: "session" },
|
||||
{ type: "message", message: { role: "assistant", content: [
|
||||
{ type: "thinking", thinking: "列目录前" },
|
||||
{ type: "toolCall", name: "read_source", arguments: { path: code } },
|
||||
] } },
|
||||
{ type: "message", message: { role: "assistant", content: [
|
||||
{ type: "thinking", thinking: "目录之后先想两种解法" },
|
||||
{ type: "toolCall", name: "read_source", arguments: { path: join(code, "SOURCES.md") } },
|
||||
] } },
|
||||
{ type: "message", message: { role: "assistant", content: [
|
||||
{ type: "thinking", thinking: "看过来源说明,还未读源码" },
|
||||
{ type: "toolCall", name: "read_source", arguments: { path: join(code, "initial.py") } },
|
||||
] } },
|
||||
{ type: "message", message: { role: "assistant", content: [
|
||||
{ type: "thinking", thinking: "读源码后的内容不能算先想" },
|
||||
] } },
|
||||
];
|
||||
writeFileSync(join(sessions, "session.jsonl"), messages.map((m) => JSON.stringify(m)).join("\n"));
|
||||
const output = join(root, "thinking.txt");
|
||||
const result = spawnSync(process.execPath, ["eval/route/thinking.ts", root, output], { encoding: "utf8" });
|
||||
assert.equal(result.status, 0, result.stderr);
|
||||
const text = readFileSync(output, "utf8");
|
||||
assert.match(text, /目录之后先想两种解法/);
|
||||
assert.match(text, /看过来源说明,还未读源码/);
|
||||
assert.match(text, /原始 JSONL:4/);
|
||||
assert.match(text, /仅列目录/);
|
||||
assert.match(text, /首次读取基线源码文件/);
|
||||
assert.doesNotMatch(text, /读源码后的内容不能算先想/);
|
||||
} finally {
|
||||
rmSync(root, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user