





















@@ -2007,11 +2007,21 @@ describe("oversized transcript line guards", () => {
20072007maxMessages: 10,
20082008});
200920092010+// The oversized line's id and parentId are extracted by regex from the
2011+// prefix bytes. parentId drives active-tree selection; id is attached
2012+// to the __openclaw metadata. Both must be correct for the record to
2013+// appear in the right position.
2014+expect(out).toHaveLength(2); // root-msg + oversized-child
2015+const oversized = out[1] as Record<string, unknown>;
2016+expect(oversized.role).toBe("assistant");
2017+// id is preserved in __openclaw transcript metadata
2018+const meta = (oversized as Record<string, Record<string, unknown>>).__openclaw;
2019+expect(meta?.id).toBe("oversized-child");
2020+// parentId extraction is proven by the record being included:
2021+// if parentId was not extracted, the tree would orphan this node.
2022+2023+// The oversized content must NOT appear in the output.
20102024const serialized = JSON.stringify(out);
2011-// The oversized line's id and parentId must be extracted correctly
2012-// from the prefix via regex-based field extraction.
2013-expect(serialized).toContain("oversized-child");
2014-expect(serialized).toContain("root-msg");
20152025expect(serialized).not.toContain(oversizedContent);
20162026});
20172027此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。