



















@@ -1558,40 +1558,25 @@ describe("runMemoryFlushIfNeeded", () => {
15581558updatedAt: Date.now(),
15591559totalTokensFresh: false,
15601560};
1561-const originalStat = fsCore.promises.stat.bind(fsCore.promises);
1562-const statSpy = vi
1563-.spyOn(fsCore.promises, "stat")
1564-.mockImplementation(async (target, options) => originalStat(target, options));
1565-1566-let entry: SessionEntry | undefined;
1567-let directTranscriptStats: unknown[] = [];
1568-try {
1569-entry = await runPreflightCompactionIfNeeded({
1570-cfg: { agents: { defaults: { compaction: { memoryFlush: {} } } } },
1571-followupRun: createTestFollowupRun({
1572-sessionId: "session",
1573- sessionFile,
1574-sessionKey: "main",
1575-}),
1576-defaultModel: "anthropic/claude-opus-4-6",
1577-agentCfgContextTokens: 100_000,
1578- sessionEntry,
1579-sessionStore: { main: sessionEntry },
1561+const entry = await runPreflightCompactionIfNeeded({
1562+cfg: { agents: { defaults: { compaction: { memoryFlush: {} } } } },
1563+followupRun: createTestFollowupRun({
1564+sessionId: "session",
1565+ sessionFile,
15801566sessionKey: "main",
1581- storePath: path.join(rootDir, "sessions.json"),
1582- isHeartbeat: false,
1583- replyOperation: createReplyOperation(),
1584-});
1585-directTranscriptStats = statSpy.mock.calls.filter(
1586- ([target]) => String(target) === sessionFile,
1587-);
1588-} finally {
1589-statSpy.mockRestore();
1590-}
1567+}),
1568+defaultModel: "anthropic/claude-opus-4-6",
1569+agentCfgContextTokens: 100_000,
1570+sessionEntry,
1571+sessionStore: { main: sessionEntry },
1572+sessionKey: "main",
1573+storePath: path.join(rootDir, "sessions.json"),
1574+ isHeartbeat: false,
1575+replyOperation: createReplyOperation(),
1576+});
1591157715921578expect(entry).toBe(sessionEntry);
15931579expect(compactEmbeddedAgentSessionMock).not.toHaveBeenCalled();
1594-expect(directTranscriptStats).toEqual([]);
15951580});
1596158115971582it("does not treat raw transcript metadata bytes as token pressure", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。