Skip to content

Pin what the review's Bot line keeps, not only its length - #1980

Merged
Birfy merged 1 commit into
ThinkFlowLab:mainfrom
HugoXK:dev/4-p284-memory-bot-line-bound
Nov 1, 2026
Merged

Birfy merged 1 commit into
ThinkFlowLab:mainfrom
HugoXK:dev/4-p284-memory-bot-line-bound

Conversation

@HugoXK

@HugoXK HugoXK commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1978

Owner: Dev-4
Written-by: Dev-4
Reviewer: Birfy
Claim-Id: dcaa85cc5e5f4953ab2cf28d0b61735e
Branch: dev/4-p284-memory-bot-line-bound
Base: 90b880e
Tip SHA: 41cc198
Verified commit: 41cc198 (same tree, verified locally at that commit)
Tree: 730ec9f2858bb77d2b62cfb7f41be968a73d4252
Diff: 2 files, +11/−1

What changed

core/test/memory.test.js:541 asserted the review's Bot line only from above — endsWith('…(cut)') at :561 and <= 800 + suffix at :562 — so REVIEW_OTHER_LINE_MAX (core/src/host/memory.js:64) could drop from 800 to 700 and take a hundred units of a Bot's line out of what the memory reviewer reads, silently. The case now pins what survives, in the shape of the neighbouring user-line case (:600):

  • it asserts the line starts with Writer: followed by the 791 x's — at 800 the cut steps back off the emoji's surrogate pair, so the whole kept head is those 791 units; at 700 only 692 survive;
  • it asserts the kept width (the line without its …(cut) suffix) stays within ten units of the limit, so a shrunken limit fails instead of passing on the upper bound alone.

#1918's properties stay asserted and unchanged: prompt.isWellFormed(), no \uFFFD, endsWith('…(cut)'), and the <= 800 + suffix upper bound. Test-only: memory.js keeps REVIEW_OTHER_LINE_MAX = 800. The generated mirror is patches/ds-bot/0001-core-fixes.patch (there is no patches/ds-bot/files/test/memory.test.js at this base), rewritten by node scripts/ds-bot-patches.mjs generate, never hand-edited, and canonical reports generate is a no-op.

Red first

The hole, measured now on 90b880e7 with the base's own case and memory.js:64 mutated to 700:

$ TZ=UTC node --import ./test/harness-resolve.mjs --test --test-name-pattern="a long Bot line" test/memory.test.js
ok 1 - a long Bot line cut for the review context keeps whole characters (#1918)
# tests 1 / # pass 1 / # fail 0

With the strengthened case, the same 700 mutation:

not ok 25 - a long Bot line cut for the review context keeps whole characters (#1918)
  ---
  duration_ms: 33.982609
  type: 'test'
  location: 'core/test/memory.test.js:541:1'
  failureType: 'testCodeFailure'
  error: 'Writer: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
  code: 'ERR_ASSERTION'
  name: 'AssertionError'
  expected: true
  actual: false
  operator: '=='
  ...
    at TestContext.<anonymous> (core/test/memory.test.js:566:10)
# tests 65 / # pass 64 / # fail 1

memory.js was restored with git checkout -- after every mutation; its sha256 before and after is the same, 689756999f0e8136e067048d0b67c44fe0a43052c552df5972c7045906bb673a, and git status --porcelain then names only the two files of this change.

The other direction, 900, is red as before — the suffix is not there, so the original assertion at :561 fires with expected: true / actual: false and # tests 65 / # pass 64 / # fail 1. At 800 the file is green: # tests 65 / # pass 65 / # fail 0.

Verification at the tip

Ran: at 41cc198fa1faa3a78249b89fac73ccab16395aa9 (tree 730ec9f2858bb77d2b62cfb7f41be968a73d4252), tree clean before and after:

$ TZ=UTC ARCH_DOCS_BASE=90b880e7 npm run verify
$ node scripts/ds-bot-patches.mjs check
$ node scripts/ds-bot-patches.mjs canonical
  • core: 2374/2374 (includes memory.test.js 65/65)
  • plugins social 541/541, tree 127/127, timeline 135/135, workflow 336/336
  • .github/scripts 563/563, interop 37/37, live-e2e 24/24
  • arch-docs: OK (2 changed file(s)) with ARCH_DOCS_BASE=90b880e7
  • check: ok ds-bot/ = Fei2411/DeepSeek-Bot@2b10c70 (tree 5834c00, v0.1.5) / ok 10 patches apply cleanly in order / ok core/ equals ds-bot/ + patches/ds-bot/
  • canonical: ok patches/ds-bot/ is what generate writes (generate is a no-op)

Not run: the smoke bench (no index.js or src/host/ change), the CI package job, and the merge-queue rebuild — those run in CI and on the queue entry.

{
  "pr": 1980,
  "claim": "Dev-4",
  "issue": 1978,
  "summary": "The review-context case for a Bot's line asserted only that the line was cut and no longer than 800 plus its suffix, so REVIEW_OTHER_LINE_MAX could fall from 800 to 700 and silently drop a hundred units of context. It now also pins what survives: the kept head is `Writer: ` plus the 791 x's, and the kept width stays within ten units of the limit, in the shape of the neighbouring user-line case. Test-only; memory.js keeps 800.",
  "files": ["core/test/memory.test.js", "patches/ds-bot/0001-core-fixes.patch"],
  "checks": { "ran": "TZ=UTC ARCH_DOCS_BASE=90b880e7 npm run verify; node scripts/ds-bot-patches.mjs check; node scripts/ds-bot-patches.mjs canonical", "result": "green", "at": "41cc198fa1faa3a78249b89fac73ccab16395aa9" },
  "next": "none — ready for review"
}

`REVIEW_OTHER_LINE_MAX` was guarded from above alone: the ThinkFlowLab#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.
@Birfy
Birfy added this pull request to the merge queue Nov 1, 2026
Merged via the queue into ThinkFlowLab:main with commit 4488ae8 Nov 1, 2026
13 of 14 checks passed
@Birfy
Birfy deleted the dev/4-p284-memory-bot-line-bound branch November 1, 2026 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: the memory-review Bot line keeps only an upper bound, so lowering REVIEW_OTHER_LINE_MAX drops context silently

2 participants