Repository navigation
fix(loop): strip model-emitted render tags to break #206 echo feedback loop - #228
Merged
Merged
Conversation
…k loop Models sometimes imitate the render tags injected into compressed history and emit them in visible output. The client stores the echoed tags, replays them next turn, and the imitation amplifies into unbounded repetition (#206). Strip render tags from outgoing text in all three wire adapters (streaming and non-streaming) with a streaming-safe filter; underscore-namespaced text-protocol triggers and ordinary prose pass through untouched.
Contributor
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-228Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr228.tgz
npm install -g packageThis comment is automatically updated on each push. |
- fix filter false-swallow after paired tags (wasPaired check) - containsRenderTagText: detect JSON-escaped open tag with attrs - non-stream gates use containsRenderTagText (catch bare lone tags) - openai rewriteContentChunk preserves sibling choices - add e2e tests (real server, compress round-trip) and non-stream tests
6 tasks
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 (#206)
Models sometimes imitate the `mNNNNN` render tags that compressed history is rendered into, emitting them in visible output ("tag echo"). The client stores the echoed tags in its local history and replays them next turn; the model then sees its own echoes and repeats further — feedback amplification, occasionally unbounded repetition.
The proxy already logged tag echoes (3 warn sites) but never mitigated them.
Fix
Strip render tags from outgoing model text at the wire adapters, breaking the loop at the source:
Safety
Tests
`tests/tag-echo.test.ts` — 11 tests: unit stripping semantics, exhaustive streaming-vs-batch equivalence (every split position + pseudo-random chunkings, incl. the 21×-repeated-tag shape from the #206 report), and end-to-end adapter tests for all three protocols across split deltas. Full suite: 576/576 pass; typecheck + build clean.