Repository navigation
change(core): condense a Bot at 45% of the usable window, not 80% (#1233) - #1243
Merged
Merged
Conversation
) DEFAULT_CHECK_RATIO 0.8 -> 0.45; the profile checkRatio still overrides it and the hard line stays at 95% of the usable window. Rebased onto 5f1517f, where #1221 had regenerated patches/ds-bot/0001-core-fixes.patch and #1240 edited docs/subsystems/core-host.md: the README hunk keeps both sides and the invariant bullet was added to the current page.
Birfy
force-pushed
the
dev/1233-check-ratio-045
branch
from
October 26, 2026 06:00
ef72651 to
35fb01f
Compare
Collaborator
Author
|
Verdict: PASS at 35fb01f 判的是 tip 代码(在
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Owner: Dev2
Reviewer: Reviewer
Written-by: Dev2
Fixes #1233
Tip SHA: 35fb01f
Base: 5f1517f
A Bot's conversation is condensed once it passes the steward's check line, a share of the model's usable window.
#796measured what a call carries: the fixed block is re-sent on every call, and on this host the history is most of each prompt. So the check line is a floor on the prompt of a long turn, and 0.8 made that floor too high. This PR moves the default share to 0.45, keeps the profile'scheckRatioas the override, and leaves the hard line at 95%.Reproduce
A 24-hour scan of this host's Session logs (
/data/dsh/sessions, window2026-10-25T05:11Z .. 2026-10-26T05:11Z): 13,634 calls, 2,038,461,443 prompt tokens, p50 152,185 per call. The 64 compactions in that window had a last pre-compaction prompt of p50 233,670 (p10 209,731, p90 249,017) — with0.8of the usable window as the check line.The arithmetic this PR changes, in
core/src/host/steward.jslinesFor():usable = max(window - replyReserve, floor(window / 2)),check = min(floor(usable * checkRatio), floor(usable * 0.95)). With the fallback share at 0.45, a model that reports no window (500,000) checks at 225,000 instead of 400,000, and the 100,000-token window in the test at 45,000 instead of 80,000.What changed
core/src/host/steward.js:DEFAULT_CHECK_RATIO0.8 → 0.45, with the reason in a comment; the hard line and the fallback rules are untouched.core/test/steward.test.js: the two cases that lean on the default (invalid or missingcheckRatio) now expect45_000at a 100,000 window; the cases that pass0.8or0.5explicitly are untouched.core/README.md: the config example and the documented default are 0.45.docs/subsystems/core-host.md: a new invariant bullet — the check line, its share, the trade, andcheckRatioas the override (core/src/host/is owned by that page).patches/ds-bot/0001-core-fixes.patch,patches/ds-bot/topics.json: the three upstream files join the 0001 topic. This machine has nogit, sogeneratecannot run; the hunks are written by hand andcheckproves the applied tree equalscore/byte for byte.changelog.d/1233-early-compaction.changed.md: the user-visible line.5f1517f9(nogiton this machine, so the branch was rebuilt through the API):#1221had regeneratedpatches/ds-bot/0001-core-fixes.patchand#1240had editeddocs/subsystems/core-host.md. The regenerated 0001 keeps its#1212i18n lines and takes this branch's README hunk; the invariant bullet was added to the current page, not to a copy of the old one.checkproves the result:core/equalsds-bot/+patches/ds-bot/.What I ran
At
ef72651c:node --test core/test/steward.test.js→# tests 9 / # pass 9 / # fail 0.node scripts/ds-bot-patches.mjs check→skipped pin (no git),ok 10 patches apply cleanly in order,ok core/ equals ds-bot/ + patches/ds-bot/.node .github/scripts/changelog.mjs check→5 fragment(s) in changelog.d/ are well formed.node .github/scripts/check-mojibake.mjs --check→0 occurrences of U+FFFD in 1,069 text file(s).core/.oxlintrc.json) onsrc/host/steward.js test/steward.test.js→0 warnings, 0 errors.node core/scripts/build-client.mjs --check→ exit 0, no output (esbuild is not installed here; it was installed for this run only, outside the tree).checkcannot compute withoutgit: the git tree hash ofds-bot/computed locally is5834c00d9c21b972e4b32ad90489443da2a10324, equal tods-bot.pin.json; upstreamFei2411/DeepSeek-Bot@2b10c70ds-botis the same tree (GitHub API). Socheck's first line isskipped pin (no git)on this host only — CI runs the git path.node --import ./test/harness-resolve.mjs --test test/steward.test.js→# tests 9 / # pass 9 / # fail 0.Red without the source change
0.8back incore/src/host/steward.js:node --test core/test/steward.test.js→not ok 2 - a model without a window counts as the default, and odd settings fall back,# tests 9 / # pass 8 / # fail 1;node scripts/ds-bot-patches.mjs check→core/src/host/steward.js: differs from ds-bot/ + patches/ds-bot/.checkgreen again.Not run
/data/dsh/profiles/web/cordis.patch.ymlalready carriescheckRatio: 0.45(done on the host, not in this PR), but DSH reads the profile at boot and nothing watches that file, so the new share takes effect at the host's next start. The same-scan numbers (Compaction trigger 0.8 → 0.45: history is 73% of every call, and the lever is ~500M tokens/day (#796) #1233: p50 110–135k, 1.40–1.55B/day, calls/day not up) need that start plus a 24-hour window; they will be reported on Compaction trigger 0.8 → 0.45: history is 73% of every call, and the lever is ~500M tokens/day (#796) #1233, not here. On 2026-10-26 the user chose not to restart the host for this change: the code ships now, and the before/after reading is taken after the next start that happens for another reason (a release, or a host restart that is already needed). Until then this PR has no live reading, and the address is Compaction trigger 0.8 → 0.45: history is 73% of every call, and the lever is ~500M tokens/day (#796) #1233, not this body.arch-docs: cannot run on this machine (nogit:cannot diff against origin/main); CI runs it. The owned pagedocs/subsystems/core-host.mdis updated.coresuite, locally. This host cannot spawn the test workers:node[178512]: pthread_create: Resource temporarily unavailable, and the run had to be stopped. The one file I could attribute —test/session-identity.test.js— fails the same way on a pristine5f1517f9as on this branch:Cannot find package '@deepseek-ai/dsh-llm' imported from deepseek-harness/package.json. CI has those peers and ran the suite green onef72651c; the rebase touched no test besidessteward.test.js.Risk
checkRatiocondenses at 45% from its next release; a profile that sets it keeps its own share.checkcompares the applied tree withcore/byte for byte (and CI runs the git path), so a mis-placed hunk fails loudly rather than silently drifting.Checkpoint
{"pr":1243,"claim":"Dev2","issue":1233,"summary":"The steward's check line drops from 80% to 45% of the model's usable window: the fixed block is re-sent on every call and the history is most of a prompt, so a later line costs a long turn more than the detail it keeps. The profile's checkRatio still overrides it and the hard line stays at 95%. The patch series carries the three upstream files in 0001, hand-written because this machine has no git, and check proves the applied tree equals core/.","files":["changelog.d/1233-early-compaction.changed.md","core/README.md","core/src/host/steward.js","core/test/steward.test.js","docs/subsystems/core-host.md","patches/ds-bot/0001-core-fixes.patch","patches/ds-bot/topics.json"],"checks":{"ran":"node --test core/test/steward.test.js; node scripts/ds-bot-patches.mjs check; node .github/scripts/changelog.mjs check; node .github/scripts/check-mojibake.mjs --check","result":"green","at":"35fb01fddad471167ba15382293a0d169ee77ee2"},"next":"Reviewer judges this tip. The user chose on 2026-10-26 not to restart the host for this change, so there is no live reading yet: the 24h before/after numbers and the live knife land on #1233 after the next start that happens for another reason."}