Align tests with gm-first context projection and retry snapshot semantics.

History synthesis expects world-simulator slot; retryStuckRun compares artifact count against checkpoint baseline.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-25 01:02:23 +08:00
co-authored by Cursor
parent 6d4dfd0d89
commit 123c44ec49
2 changed files with 16 additions and 12 deletions
+11 -9
View File
@@ -88,27 +88,29 @@ describe("flat context order", () => {
const doc = synthesizeContextOrderFromWorkers(
[
{
ref: "narrator",
name: "叙事转述",
ref: "world-simulator",
name: "主世界层",
context: {
static: ["设计.叙事指南"],
dynamic: ["运行.本轮.裁决", "用户.最新输入"],
dynamic: ["用户.最新输入"],
},
},
],
{ gm: true, narrator: true, perspective: false },
)!;
expect(doc.slots[0]!.inserts.some((i) => i.ref === "对话.历史")).toBe(true);
const gmSlot = doc.slots.find((s) => s.ref === "world-simulator")!;
expect(gmSlot.inserts.some((i) => i.ref === "对话.历史")).toBe(true);
const histIdx = doc.slots[0]!.inserts.findIndex((i) => i.ref === "对话.历史");
const histIdx = gmSlot.inserts.findIndex((i) => i.ref === "对话.历史");
const moved = applyContextOrderEdit(doc, {
action: "set_anchor",
slotRef: "narrator",
index: doc.slots[0]!.inserts.length - 1,
slotRef: "world-simulator",
index: gmSlot.inserts.length - 1,
anchor: "pre_history",
});
const newHist = moved.slots[0]!.inserts.findIndex((i) => i.ref === "对话.历史");
const lastUser = moved.slots[0]!.inserts.findIndex(
const movedGm = moved.slots.find((s) => s.ref === "world-simulator")!;
const newHist = movedGm.inserts.findIndex((i) => i.ref === "对话.历史");
const lastUser = movedGm.inserts.findIndex(
(i) => i.ref === "用户.最新输入",
);
expect(lastUser).toBeLessThan(newHist);