From afe08df004a83ba532697c2a209c32261d5553cd Mon Sep 17 00:00:00 2001 From: ranxianglei Date: Wed, 14 Oct 2026 00:28:39 +0800 Subject: [PATCH] test: pin #1387 stop-signal geometry to preserveRecentMessages 5 (#3061 follow-up) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The two #1387 tail tests were written against the then-default preserveRecentMessages 5 (7 messages, fold m00001–m00002, the remaining 5 sit in the protected recent zone) and took that default implicitly via makeCtx(). #3058 tuned the kernel default 5 → 3, so after the fold the recent window only covers m00005–m00007 and a live range (m00003–…) stays actionable — the drained-state stop signal never fires and both tests fail on every CI lane (all 4 OS/node test lanes on #3061 and #3067 runs). The contract under test is the stop-signal semantics (#1387, pi #521), not the default tuning — the default is pinned by the wire-contract golden (kernel.json preserveRecentMessages: 3). Pin the geometry explicitly and spell out in the comments that 5 is the legacy tuning the geometry was designed under, not the owner-tuned default. --- tests/compress-success-tail.test.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/compress-success-tail.test.ts b/tests/compress-success-tail.test.ts index 14bbd01e15..31294ed9f0 100644 --- a/tests/compress-success-tail.test.ts +++ b/tests/compress-success-tail.test.ts @@ -135,8 +135,11 @@ test("#2404: a rejected range keeps advertising the still-offered remainder (rec }); test("#1387: clean success that drains every compressible range emits the stop signal (pi #521)", () => { - // Default preserveRecentMessages: 5 → after folding m00001–m00002 the rest - // (m00003–m00007) sits in the protected recent zone: nothing actionable left. + // Pinned preserveRecentMessages: 5 (not the kernel default — owner-tuned 3 + // as of #3058): after folding m00001–m00002 the rest (m00003–m00007) sits + // in the protected recent zone: nothing actionable left. The contract under + // test is the stop signal, not the default tuning (that is pinned by the + // wire-contract golden). const msgs = [ textMsg("raw_1", "user", "x".repeat(20000)), textMsg("raw_2", "assistant", "x".repeat(20000)), @@ -146,7 +149,7 @@ test("#1387: clean success that drains every compressible range emits the stop s textMsg("raw_6", "assistant", "x".repeat(5000)), textMsg("raw_7", "user", "x".repeat(5000)), ]; - const ctx = withRefs(makeCtx(msgs)); + const ctx = withRefs(makeCtx(msgs, { preserveRecentMessages: 5, preserveRecentTokens: 0 })); ctx.session.stats.lastInputTokens = 80000; const out = runApply(ctx, { content: [{ startId: "m00001", endId: "m00002", summary: "TAIL-TEST-SUMMARY-PAYLOAD-LONG-ENOUGH-FOR-THE-KERNEL-MIN-LENGTH-CHECK" }] }); assert.ok(out.startsWith("[Compressed"), `expected success, got: ${out.slice(0, 120)}`); @@ -213,9 +216,11 @@ test("#2029: estimate-grade baseline must not suppress the stop signal via phant }); test("#1387: partial failure (some ranges rejected) keeps the old silent tail", () => { - // m00003–m00007 sit entirely in the protected recent zone under the default - // config; pairing that range with a valid one exercises the partial-failure - // gate: no stop verdict while errors are still owed an answer (pi #521). + // m00003–m00007 sit entirely in the protected recent zone when + // preserveRecentMessages is pinned to 5 (the legacy tuning this geometry + // was designed under, NOT the owner-tuned default 3 of #3058); pairing + // that range with a valid one exercises the partial-failure gate: no stop + // verdict while errors are still owed an answer (pi #521). const msgs = [ textMsg("raw_1", "user", "x".repeat(20000)), textMsg("raw_2", "assistant", "x".repeat(20000)), @@ -225,7 +230,7 @@ test("#1387: partial failure (some ranges rejected) keeps the old silent tail", textMsg("raw_6", "assistant", "x".repeat(5000)), textMsg("raw_7", "user", "x".repeat(5000)), ]; - const ctx = withRefs(makeCtx(msgs)); + const ctx = withRefs(makeCtx(msgs, { preserveRecentMessages: 5, preserveRecentTokens: 0 })); ctx.session.stats.lastInputTokens = 80000; const out = runApply(ctx, { content: [ { startId: "m00001", endId: "m00002", summary: "TAIL-TEST-SUMMARY-PAYLOAD-LONG-ENOUGH-FOR-THE-KERNEL-MIN-LENGTH-CHECK" },