Repository navigation
[PR] feat: sticky 10% lean prompt-pack canary for unset compress.promptPack (#1408) - #1433
ranxianglei wants to merge 6 commits into
Conversation
[bot] 🏷 Reviewing PR #1433 (sticky 10% lean prompt-pack canary, Closes #1408). Initial state check done:
Per §7.2 I'm rebasing onto current master, resolving any conflicts (hot files: |
8493af1 to
e7961e0
Compare
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.1745-pr.1433.72515c7This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr1433.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review complete — branch rebased onto current master ( Conflicts resolved (union of intent, verified per-file):
Regression audit (existing behaviors on the touched paths):
Behavior change (intended, per owner decision in #1408): unset Pre-flight on the rebased head: typecheck ✓ (clean after the import fix), full test suite ✓ (2850 pass / 0 fail / 12 skipped of 2862 — the 3 Not merging — that stays with you. Once CI is green, this is ready to merge. 已将分支 rebase 到最新 master(解决 server.ts 与两份配置文档的冲突,并修掉 rebase 引入的重复类型导入),本地 typecheck、测试(2850 通过 0 失败)、构建全部通过,PR 现已可合并、CI 正在运行,CI 绿后即可人工合并。 |
[bot] 🏷 CI update: all 9 workflows are now green on head Nothing further outstanding on my side: code reviewed against current master, regression audit clean, behavior change disclosed above, pre-flight + full CI green, PR mergeable. Ready for you to merge whenever. CI 已全部通过(含真实 codex e2e),无遗留验证项,PR 已就绪,等你人工合并。 |
#1408) When compress.promptPack is unset at every level, each session is assigned a builtin pack once by deterministic session-id hash against BILI_PROMPT_PACK_CANARY_PCT (default 10, validated 0-100, non-numeric -> 10) and keeps it for its whole life: the choice is stamped onto session.meta.packCanary (persisted with the session) and never re-evaluated, so knob moves never re-roll an existing session - raising pct admits not-yet-assigned sessions, 0 stops new lean assignments without flipping assigned ones. Any explicit promptPack (including an explicit "default") always wins and is never canaried. One info log at first assignment; the canaried value flows into the existing activePack audit stamp so the /acp panel shows it.
…amp)
buildRecord persisted meta.activePack to disk (meta: {...session.meta}) but buildSession never restored it, so after a restart the /acp panel showed pack=default for every reloaded session until its next request re-stamped it - contradicting the server.ts comment that the stamp is 'persisted with the session'. Restore it on load so post-restart forensics and the canary's observability (constraint 4 of #1408) hold across restarts. Found while adding meta.packCanary persistence for the canary.
CONFIGURATION.md (+ zh-CN mirror): promptPack Default line now points at the canary, a 'Sticky lean canary' paragraph documents the assign-once semantics (explicit settings never canaried, knob moves never re-roll, 0 stops new assignments, 100 admits all unassigned), and BILI_PROMPT_PACK_CANARY_PCT joins the env-var table. Also corrects the builtin-lean description: on the pi host the pack additionally ships condensed system-prompt sections via its pi adapter (compact acp-tags/summary-context guidance + shorter how-to-compress) - previously documented as 'keeping the compression rules default' everywhere.
… name (#1408 review F1/F2/F3) - F1/F2: assignment previously keyed on 'first request whose pack is unset', so ~10% of EXISTING long-running sessions (no stamp, created before the rollout) and sessions whose explicit promptPack was later REMOVED flipped default->lean mid-conversation on their next request — contradicting the no-flip claim. New assignments are now birth-gated: only a session whose stats.requests is still 0 (the very first request; all ++ sites live later in the pipeline) may be assigned. The stamp READ stays on every request, so assigned sessions keep their pack regardless. Unstamped already-ran sessions resolve 'default' without writing a stamp. - resolveStickyPackAssignment gains allowNewAssignment (default true). - F3: document that 'lean' refers to the builtin pack — a user-authored packs/lean.json shadows it through the normal resolution chain; treat the name as reserved (CONFIGURATION.md + zh-CN). - New e2e: explicit-pack turn 1, setting removed, pct=100 — session stays default, no stamp ever written.
e7961e0 to
0f0e38d
Compare
|
Deep-review complete — Approve with F1/F2/F3 fixed on-branch (rebased onto current master: the PR branch contained master-landed pricing commits, so the canary commits were cherry-picked clean onto master + one review commit). Verified
Fixed on-branchF1/F2 (low, design — deploy/config-removal flip): assignment keyed on first request whose pack is unset, so ~10% of EXISTING sessions (created pre-rollout, no stamp) — and sessions whose explicit F3 (low): documented that New e2e: explicit-pack turn 1 → setting removed → pct=100 → session stays default, Info (no action)
Ready to merge once CI is green. Fixes #1408. |
[bot] 🏷 Verified the rebased branch end-to-end — all green, ready for you to merge. State
Independent check of the review commit (
|
…activePack comment; keep master's proxy env wording
|
(ai: zhipuai-lb/glm-5.3) 陈旧票清理(第三批动作①):目标 issue #1408 已关。为避免重复劳动关闭本 PR;如判断有误请直接 reopen 并留言。 |
Closes #1408
Behavior change (intended — owner decision in #1408)
Old: unset
compress.promptPack→ identity surface (defaultpack) for every session, always.New: unset
compress.promptPack→ each session is assigned a builtin pack once and keeps it for its whole life: ~10% of sessions (deterministic session-id hash) get the builtinleanpack, the restdefault. Rollout knob:BILI_PROMPT_PACK_CANARY_PCT(integer 0–100, default10; non-numeric/out-of-range →10;0= off,100= full lean).Why: owner decision — "default becomes lean — via a 10% canary first", with an observation window afterwards before deciding 100 vs rollback to 0.
Assignment semantics: persisted assignment, not per-request hash
The constraint set includes both "once lean always lean" AND "once default stays default". A pure per-request
hash(sessionId) % 100 < pctviolates the second half whenever pct moves in either direction (raising it flips existing default-sessions to lean mid-experiment; rolling back to 0 yanks lean out of already-assigned sessions mid-observation). So the assignment is computed ONCE — on the first request wherepromptPackis unset at every level — against the CURRENT pct, stamped ontosession.meta.packCanary, persisted with the session, and never re-evaluated:promptPack— including an explicit"default"— always wins and is never canaried (canary engages only when the merged value isundefined);sha256(sessionId)bucket% 100 < pct): stateless at decision time, reproducible across instances.Observability
prompt-pack canary: lean (pct=10, session=<id>)(also logged fordefaultassignments, so the split is auditable);activePackaudit stamp, so the/acppanel active-pack line showspack=leanfor canaried sessions exactly like an explicit setting (verified by test).Drive-by fix (own labeled commit)
fix: restore session.meta.activePack on session reload—buildRecordwrotemeta.activePackto disk (meta: {...session.meta}) butbuildSessionnever restored it, so after a restart the/acppanel showedpack=defaultfor every reloaded session until its next request re-stamped it — contradicting the server.ts comment "Persisted with the session". Restored on load. Minor behavior change of its own: post-restart panel now shows the last known pack instead ofdefaultuntil the next request. Found while addingmeta.packCanarypersistence in the same code path; pinned by extending the disk-round-trip test.Docs (own commit)
CONFIGURATION.md + zh-CN mirror: promptPack Default line, new "Sticky lean canary" paragraph,
BILI_PROMPT_PACK_CANARY_PCTenv-var table row. Also corrects the builtin-lean description: on the pi host the pack additionally ships condensed system-prompt sections via its pi adapter (compact acp-tags/summary-context guidance + shorter how-to-compress) — previously documented as "keeping the compression rules default" everywhere.Tests
New
tests/prompt-pack-canary.test.ts(11 tests) pins everything requested in the issue:promptPack: "default"→ never canaried even at pct=100Pre-flight on this head: typecheck ✓, full suite ✓ (2458 pass; the 3
claude-native.test.tsfailures are pre-existing on clean master in this sandbox — process-spawn env issues, verified by stashing the branch), build ✓. Note: this touches thesrc/server.tsrequest pipeline; the codex e2e suite (ACP_TEST_E2E=1) needs a local upstream that this sandbox cannot reach — worth a manual-dispatch CI e2e run pre-merge.