Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(bot): persist the ledger watermark on no-op reviews
zqchris64474e69051c
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/botLearningReview.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/botLearningReview.test.tsindex 0144a29a33..8064afda39 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/botLearningReview.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/botLearningReview.test.ts@@ -259,12 +259,17 @@ it('feeds the working memory to the review and writes an evidence-filtered ledge}),4,);- // 没有 working 字段的旧格式输出:账本不动。+ // 模型省略 working(本轮没改动):条目不加不删,但水位仍要跟上这一轮,否则一句问候就让账本不新鲜。h.meta = { turnCompleted: true };h.writeWorking.mockClear();h.model.mockResolvedValueOnce({ ok: true, text: JSON.stringify({ memories: [], skills: [] }) });await reviewTeammateLearning('session', 'reply2');- expect(h.writeWorking).not.toHaveBeenCalled();+ expect(h.writeWorking).toHaveBeenCalledWith(+ '/test-owner',+ 'bot',+ expect.objectContaining({ coveredThroughRowid: 5, coveredThroughMessageId: 'reply2', commitments: [], corrections: [] }),+ 4,+ );});it('advances the ledger watermark only through the contiguous backfilled prefix while a gap is still being caught up', async () => {diff --git a/apps/desktop/src/main/maker-ipc/botLearningReview.ts b/apps/desktop/src/main/maker-ipc/botLearningReview.tsindex 778f6cf61f..11e2147d7b 100644--- a/apps/desktop/src/main/maker-ipc/botLearningReview.ts+++ b/apps/desktop/src/main/maker-ipc/botLearningReview.ts@@ -23,11 +23,21 @@ import {readBotWorkingMemory,workingMemoryForReview,writeBotWorkingMemory,+ type WorkingMemoryProposal,} from './botWorkingMemory.js';const running = new Map<string, Promise<void>>();/** 本轮取材最多取多少条消息;超出即视为截断,水位不推进到当前回复。 */const TURN_REVIEW_ROWS = 80;+/** 模型省略 working(本轮没改动)时用的空提案:不加不删,只让水位跟上。 */+const EMPTY_WORKING_PROPOSAL: WorkingMemoryProposal = {+ threads: [],+ commitments: [],+ waiting: [],+ corrections: [],+ recentlyDone: [],+ resolved: [],+};/** 缺口回补每批最多取多少条消息 / 多少字符;单条正文已截到 6000 字,所以每批至少前进一条。 */const GAP_BACKFILL_ROWS = 40;const GAP_BACKFILL_CHARS = 16000;@@ -233,12 +243,15 @@ export async function reviewTeammateLearning(sessionId: string, replyId: string));if (!result.ok || !current()) return;const plan = learningReviewSchema.parse(JSON.parse(result.text));- if (plan.working && (await readOwner())) {+ // 每次校验通过的复盘都写回水位:模型按指令在"本轮没改动"时省略 working,但这一轮同样+ // 已被复盘过,水位必须跟上,否则一句问候就让账本被判不新鲜、70% 换窗悄悄退回 90%。+ // 没有提案时按空提案合并——旧条目原样保留,只推进水位(和 client_id)。+ if (await readOwner()) {try {await writeBotWorkingMemory(root,row.botId,- applyWorkingMemoryProposal(workingBefore, plan.working, messages, {+ applyWorkingMemoryProposal(workingBefore, plan.working ?? EMPTY_WORKING_PROPOSAL, messages, {now: Date.now(),coveredThroughRowid: covered.rowid,...(covered.id ? { coveredThroughMessageId: covered.id } : {}),