From 41cc198fa1faa3a78249b89fac73ccab16395aa9 Mon Sep 17 00:00:00 2001 From: FlyBot Dev-4 Date: Sun, 1 Nov 2026 04:31:59 +0000 Subject: [PATCH] Pin what the review's Bot line keeps, not only its length MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `REVIEW_OTHER_LINE_MAX` was guarded from above alone: the #1918 case asserted the line ends with `…(cut)` and stays within 800 + the suffix, so lowering the limit to 700 cut a hundred units off what a Bot's line shows the memory reviewer and every test stayed green. The case now pins the kept head as well — `Writer: ` plus the 791 x's, and a kept width within ten units of the limit — in the shape the neighbouring user-line case uses, so 700 goes red while 800 stays green and 900 still fails on the missing suffix. Test-only: `memory.js` keeps 800. --- core/test/memory.test.js | 5 +++++ patches/ds-bot/0001-core-fixes.patch | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core/test/memory.test.js b/core/test/memory.test.js index c4da9feb9..231d67efe 100644 --- a/core/test/memory.test.js +++ b/core/test/memory.test.js @@ -560,6 +560,11 @@ test('a long Bot line cut for the review context keeps whole characters (#1918)' assert.ok(shown !== undefined, `the Bot line is in the review context:\n${prompt}`) assert.ok(shown.endsWith('…(cut)'), shown.slice(-20)) assert.ok(shown.length <= 'Writer: '.length + 800 + ' …(cut)'.length, String(shown.length)) + // #1978: pin what survives, not only how much may survive. At 800 the cut steps back off the + // emoji's pair, so the whole kept line is `Writer: ` plus 791 x's; a smaller limit keeps a + // shorter head — the direction that drops context silently — and must go red here. + assert.ok(shown.startsWith(`Writer: ${'x'.repeat(791)}`), shown.slice(0, 40)) + assert.ok(shown.replace(' …(cut)', '').length > 'Writer: '.length + 800 - 10, String(shown.length)) }) test('a long user line cut for the review keeps whole characters at both ends (#1918)', async () => { diff --git a/patches/ds-bot/0001-core-fixes.patch b/patches/ds-bot/0001-core-fixes.patch index 8c19afcb5..1afc90e53 100644 --- a/patches/ds-bot/0001-core-fixes.patch +++ b/patches/ds-bot/0001-core-fixes.patch @@ -10418,7 +10418,7 @@ diff --git a/test/memory.test.js b/test/memory.test.js const done = (await call('memory-view', { botId: 'b2' })).value assert.deepEqual([done.summary?.text, done.error], ['## Overview\nYou like tea.', null]) assert.deepEqual(routes(requests).slice(2), ['deepseek/flash@2048']) -@@ -519,12 +519,81 @@ test('a host that only reads the team shows memory but changes none of it', asyn +@@ -519,12 +519,86 @@ test('a host that only reads the team shows memory but changes none of it', asyn // Until no review waits or runs. async function reviewed(call) { for (let tries = 0; tries < 200; tries += 1) { @@ -10455,6 +10455,11 @@ diff --git a/test/memory.test.js b/test/memory.test.js + assert.ok(shown !== undefined, `the Bot line is in the review context:\n${prompt}`) + assert.ok(shown.endsWith('…(cut)'), shown.slice(-20)) + assert.ok(shown.length <= 'Writer: '.length + 800 + ' …(cut)'.length, String(shown.length)) ++ // #1978: pin what survives, not only how much may survive. At 800 the cut steps back off the ++ // emoji's pair, so the whole kept line is `Writer: ` plus 791 x's; a smaller limit keeps a ++ // shorter head — the direction that drops context silently — and must go red here. ++ assert.ok(shown.startsWith(`Writer: ${'x'.repeat(791)}`), shown.slice(0, 40)) ++ assert.ok(shown.replace(' …(cut)', '').length > 'Writer: '.length + 800 - 10, String(shown.length)) +}) + +test('a long user line cut for the review keeps whole characters at both ends (#1918)', async () => {