Repository navigation
fix(surface): accept string overrides on prompt-section rule slots - #427
Conversation
Rule slots (philosophy/howToCompress/tier2/tier3) now take the same tri-state as the structural sections: string replaces, null removes. Kernel master (post acp-kernel#269) ships leanPack's condensed howToCompress as a string under adapters.pi.promptSections, which the old null-only sanitizer silently dropped. Verified green against both pinned acp-kernel 0.0.66 and a local kernel-master build.
📦 Built Extension ArtifactBranch: Option A — Install from npm PR tag (recommended)pi install npm:billion-context-pi@pr-427Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pi-pr427.tgz
pi install ./packageThis comment is automatically updated on each push. |
[bot] 🏷 Reviewed — LGTM, ready to merge. Duplicate screening: no overlapping open issue/PR found for this change; #427 is the linked fix for #423 (the originating contract-drift report), so no duplicate action needed. Diff cleanliness: 5 files / +29 −15, every line on-topic. No lockfile changes, no Contract verification (independent of the author's claims):
Reproduced verification (both boundaries):
Test-quality notes (all good):
No issues to fix directly — nothing found. Merge is yours per house rules: #427 中文摘要:独立复核了 kernel 侧 |
…lot-string-overrides fix(surface): accept string overrides on prompt-section rule slots
…state over SECTIONS-derived keys (#429) RULE_SLOT_KEYS/PROMPT_SECTION_KEYS duplicated the kernel's section contract, so kernel 0.0.68's null→string slot flip silently dropped lean's condensed rules (#423, symptomatic fix #427). The key set now derives from SECTIONS (pi's own builder list — host policy) and every key takes the same kernel tri-state validity (string replaces, null removes, junk dropped): no per-slot type opinions left for the kernel to outgrow.
…state over SECTIONS-derived keys (#429) RULE_SLOT_KEYS/PROMPT_SECTION_KEYS duplicated the kernel's section contract, so kernel 0.0.68's null→string slot flip silently dropped lean's condensed rules (#423, symptomatic fix #427). The key set now derives from SECTIONS (pi's own builder list — host policy) and every key takes the same kernel tri-state validity (string replaces, null removes, junk dropped): no per-slot type opinions left for the kernel to outgrow.
…state over SECTIONS-derived keys (#429) RULE_SLOT_KEYS/PROMPT_SECTION_KEYS duplicated the kernel's section contract, so kernel 0.0.68's null→string slot flip silently dropped lean's condensed rules (#423, symptomatic fix #427). The key set now derives from SECTIONS (pi's own builder list — host policy) and every key takes the same kernel tri-state validity (string replaces, null removes, junk dropped): no per-slot type opinions left for the kernel to outgrow.
What
promptSectionsrule slots (philosophy/howToCompress/tier2/tier3) now take the same tri-state as the nine structural sections: astringreplaces the section,nullremoves it. Previously they were null-only and a string override was silently dropped bysanitizePromptSections.Why
Kernel master (acp-kernel#269, c843f48) changed
leanPack.surface.adapters.pi.promptSections.howToCompressfromnullto the condensedHOW TO COMPRESS (condensed)string (kernel src/packs.ts:197). Under pi's old null-only contract, that release would (a) silently discard lean's condensed how-to-compress rules on pi and (b) breaktests/prompt-pack.test.ts'showToCompress === nullassertion. Theadapters.pi.*contract is owned by pi (the kernel treats host adapters as opaque), so pi adapts.Contract decision (discussed in #423): accept strings on rule slots rather than rework the already-merged kernel work to ship via
surface.prompts— the latter would route lean's builtin rules through theacknowledgePromptsRiskgate, dropping them for users who didn't set the flag while keeping every other lean trim.Changes
src/system-prompt.ts: widenPiPromptSectionsrule-slot fields toSectionOverride; unify the sanitize condition across all 13 keys. Application path untouched —applySectionOverridesalready implements string=replace / null=remove, and sections apply afterprompts, so a string section override wins over apromptsoverride.tests/surface-config.test.ts: new test — string replaces a rule slot in the built prompt, null removes it, junk types and unknown keys still dropped.tests/prompt-pack.test.ts: lean assertions are version-tolerant (sanitized value must equal whatever the kernel ships — null on 0.0.66, string on master); end-to-end assertion that the condensed text reaches the built prompt when the kernel ships it.CONFIGURATION.md/CONFIGURATION.zh-CN.md: document all 13 keys including the four rule blocks.Verification
npm run typecheck && npm test && npm run build→ 803 tests, 0 failures, build OK.versionbump, no lockfile changes.Fixes #423