fix(parse): coalesce split line-form entries — refs header + summary as sibling array elements (#1001 problem 3) - #330
Merged
Conversation
…as sibling array elements (#1001 problem 3) Models (glm on the chat/completions wire) routinely emit the documented line form split across content elements: ["m01588–m01712 topic", "## TASK ..."]. Each half alone is invalid (header-only lacks a summary; the summary sibling lacks refs), so the whole call failed with kind=no-valid-ranges, dropped=2 — five-plus paired failures in #1001, object form always succeeding on retry. coalesceLineEntries() now attaches refless string entries that follow a header-only string entry onto that entry as its summary body (multiple siblings concatenate; complete entries, object entries, and non-adjacent strays reset the pairing and keep today's verdicts).
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)In your adapter project: npm install acp-kernel@pr-330Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf acp-kernel-pr330.tgz
npm install ./packageThis comment is automatically updated on each push. |
Merged
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.
Fixes the third problem in billion-context #1001 (the one PR #1009 does not cover).
Root cause
parseLineEntryrequires each line-form content entry to be ONE multi-line string (line 1 =m00150–m00220 topic, lines 2+ = summary). Models on non-strict wires (glm, chat/completions) routinely emit the header and the summary as SIBLING array elements:{"content": ["m01588–m01712 走bili UI move + …", "## TASK …"]}Each half alone is invalid (header-only → "missing summary after the refs header line"; summary sibling → "no refs in header"), so the whole call dies with
kind=no-valid-ranges, dropped=2— in #1001 this paired failure happened 5+ times, with object form succeeding on every manual retry. Not a regression from a recent change: the line-form parser shipped 09-13 (1dc17de..1caa488); the model just splits the documented shape.Fix
coalesceLineEntries()runs beforevalidateEntries: a refless string entry that directly follows a header-only string entry is adopted as that entry's summary body."part 1", "part 2"→part 1\npart 2);\n+ body in one string), object entries, and refless strings after them reset the pairing — those keep today's verdicts exactly;Tests
5 new cases in
tests/parse-compress-input.test.ts: exact #1001 shape (CJK topic + en-dash range, topic preserved from the header), multi-sibling concat, stray-after-complete stays invalid, header-only still rejected, object entry resets pairing. Suite: 833 pass / 0 fail. Typecheck + build green.Release note
bili PR #1009 should bump its pin to this version once released so issue #1001 is fully covered end-to-end.