Skip to content

post-compress tail respects the kernel's own nudge eligibility (shouldInject) — sub-threshold leftovers stop nagging (#3075) - #3090

Merged
ranxianglei merged 1 commit into
masterfrom
2026-10-14_tail-shouldinject
Oct 14, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-10-14_tail-shouldinject

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Fixes the semantic half of #3075. #3084 (test pins) fixed the CI red; this closes the behavior hole underneath it.

What was wrong

postCompressTail's fallback path (internal lanes with no prepare-time offer) ran a live recompute and listed any compressibleRanges the kernel's decision struct carried — even when the kernel itself had judged those ranges below threshold/floor/cadence (shouldInject === false, reason max compressible N < threshold M; growth 0 < floor K).

After #3058 shrank the default preserveRecentMessages 5 → 3, a folded session can leave a 1-message residue outside the protection window: the receipt advertised that residue every turn at zero pressure and the stop signal never fired — the exact nag disease #1387 (pi #521) originally fixed. Demonstrated on master c800ed1b (pre-#3084): both unpinned #1387 tail tests red, receipt offering m00003–m00003 1 msgs 1.3K while the kernel's own reason string said it was below threshold.

The fix (host-side; the kernel contract was already right)

NudgeDecision.shouldInject is the kernel's own eligibility verdict. The tail recompute now lists ranges only when shouldInject === true; otherwise base = [] and the stop signal fires on clean success (never advertise what the kernel wouldn't nudge). Real-pressure recompute paths (preflight overflow-compress) always have shouldInject === true — unchanged.

Tests

Verification

  • tests/compress-success-tail.test.ts 10/10 (8 existing + 2 new)
  • nudge/preflight/compress families: 25 + 24 + 68 pass, 0 fail
  • tsc --noEmit clean

…es on sub-threshold leftovers (#3075 / #1387, pi #521)

postCompressTail's fallback live recompute (internal lanes with no
prepare-time offer) listed compressibleRanges from the kernel's decision
struct even when the kernel itself judged the ranges below
threshold/floor/cadence (shouldInject === false — reason "max
compressible N < threshold M; growth 0 < floor K"). After #3058 shrank
the default preserveRecentMessages window 5 → 3, a folded session could
leave a 1-message residue outside the protection zone: the receipt
advertised it every turn at zero pressure and the stop signal never
fired — the exact nag disease #1387 (pi #521) fixed.

The tail now lists ranges only when the kernel would actually inject;
on clean success with nothing actionable the stop signal fires instead.
Real-pressure recompute paths (preflight overflow-compress) keep
shouldInject === true and are unchanged. #3084's preserveRecentMessages
pins stay: they pin the protection premise itself; two new tests pin
the default-config semantic both ways (sub-threshold leftover → stop
signal; over-limit leftover → still advertised).
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-14_tail-shouldinject (7626070)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.3517-pr.3090.d799d50

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr3090.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei ranxianglei added the p1 label Oct 14, 2026
@ranxianglei
ranxianglei merged commit e66bd31 into master Oct 14, 2026
28 of 32 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.389-master.e66bd31 (rolling master tag).

npm install -g billion-context@0.0.389-master.e66bd31  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

ranxianglei added a commit that referenced this pull request Oct 14, 2026
ranxianglei added a commit that referenced this pull request Oct 14, 2026
test: regen storage-render goldens for the #3090 fold-turn stop signal
LoveDoLove pushed a commit to LoveDoLove-Forked-Projects/billion-context that referenced this pull request Oct 14, 2026
…op signal (ranxianglei#3090 follow-up)

ranxianglei#3090 made the post-compress tail honor the kernel's shouldInject
verdict: at the drive's fold turn the leftover sits below the kernel's
threshold, so the receipt now ends with the stop signal instead of
advertising a sub-threshold range. Wire-visible by design (the receipt
text is resent history): turn-9 body digests shrink accordingly
(-417 B on chat) and the persisted-view section digests (stats/
metadata/stateDigest) shift with the tail content they cover.
Landmarks (foldAt/editedAt/summaryFrom) and all other turns are
byte-identical. Restores the master test matrix (ranxianglei#3090's CI legs were
red on the stale goldens).
@github-actions github-actions Bot mentioned this pull request Oct 14, 2026
@ranxianglei
ranxianglei deleted the 2026-10-14_tail-shouldinject branch October 15, 2026 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant