Repository navigation
fix: position-preserve mid-history system/developer items on the plugin responses lane (#1638) - #1671
Merged
Conversation
…in responses lane (#1638) OMP-style plugin clients append custom_message-derived developer notifications mid-history and re-send them every turn. The kernel's responsesToCore hoists system/developer content from ANY position into projection.systemParts, and prepareResponses re-injects the merged block at input[0] — so every notification append rewrote the outbound FIRST item and the upstream prefix cache missed the whole input (production sawtooth: cached pinned to the instructions-only residual, #1638). In plugin mode, mark the non-head system/developer items with an unknown type just for the duration of responsesToCore: they land in the projection layout as coreId-less slots and patchResponsesInput re-emits them verbatim in their original position — the position-preserved semantics the openai-chat wire already has (head-only hoist). The head run keeps the hoist (stable system prompt), so the front developer block stays byte-identical across turns. Proxy mode (native codex) keeps the hoist-and-anchor behavior (#1085) untouched. Transition cost: one-time cache miss per active plugin session at upgrade (front block no longer carries accumulated notification text). Tests (tests/responses-plugin-dev-position.test.ts): front block byte-stability + in-place notification re-emission + append-only bodies + no sentinel leak; fold interaction (in-place carrier counts keep the #1567 pins); leading additional_tools head-neutrality; proxy-mode negative pin (hoist semantics unchanged). Fills the developer-item gap neptune62 flagged in #1650/#1663.
Contributor
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.1618-pr.1671.afddb51This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr1671.tgz
npm install -g packageInstall instructions are refreshed on each push. |
This was referenced Sep 29, 2026
This was referenced Oct 15, 2026
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.
Problem (#1638)
Plugin-mode clients on the responses wire that append mid-history
role:"developer"items — OMP convertscustom_messagenotifications (todo nudges, launch completions) to developer items and re-sends them every turn — break the upstream prefix cache every time a new notification lands:responsesToCorehoists system/developer content from any position intoprojection.systemParts;prepareResponsesmerges them with the compress prompt and injects the block atinput[0];4992= 39×128), the exact [Bug] bili 启动 OMP 后缓存命中率 82.7%,连续请求多次骤降至 4992 cached tokens #1638 sawtooth.Root-cause archaeology: hoist-and-inject landed 97190f5 (2026-08-09);
stableSystemAnchor && !pluginModescoped the anchor away from plugin mode deliberately in df499d1 (#1085). Not a regression of the recent detection work (49a2c1c / a08deb2 / fb32b4a / #1663 are probes only).Fix
Plugin mode only, responses lane only: mark the non-head system/developer items with an unknown type for the duration of
responsesToCore— they become coreId-less layout slots, whichpatchResponsesInputre-emits verbatim in their original position. The head run keeps the hoist (stable system prompt), so the front developer block is byte-identical across turns. This gives the responses wire the position-preserved semantics the openai-chat wire already has (kernel head-only hoist,src/wire/openai.ts).{role:"developer", content}, OMP shorthand) re-emitted as-isadditional_tools/mcp_list_toolsare head-neutralTests (
tests/responses-plugin-dev-position.test.ts)additional_toolsdoes not break the head runFills the developer-item probe gap neptune62 flagged in #1638/#1650 (the #1663 probe suite covers user/reasoning/function_call but zero developer items).
Verification
Closes #1638 (plugin-mode half; the relay-side patterns from #1613 §4 are out of scope here).