Repository navigation
Keep stored line breaks out of model-facing output - #369
Merged
Merged
Conversation
…dation output (#299) Row prose is multiline in the store and flattened only at the render seam. Two render sites missed it: the refusal hint spliced the tombstone reason raw, and renderProposals sliced survivor/loser content raw, so a stored control character reached tool output as a real line break. RED first: a forget reason of "a\nb" produced a multi-line hint, and a multi-line survivor produced two output lines for one row. GREEN: both render one line per record; credential redaction in the hint is unchanged.
Owner
Author
Adversarial self-review (author-side, not independent)Tried to break the "only these two seams needed fixing" claim and the redaction order. Both hold. Verified clean:
Findings:
Verdict: approve. Branch is 23 commits behind |
|
🎉 This PR is included in version 0.22.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Owner
Author
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.
What this does
Memories can hold several lines of text, and the repo's rule is that they stay multiline in the store and get flattened to one line only when something shows them to a model. Two places showed row text without flattening it, so a control character stored earlier reappeared in a tool reply as a real line break:
Both now flatten at the render seam, the same way
memory_recallalready does. Nothing else changes: the store keeps multiline prose, the rejection hash and the credential scrubbing in the hint behave exactly as before, and the proposal output is still one line per row.Impact is formatting hygiene, not a security boundary — the store file was always one record per line and nothing here reaches the system prompt. It is worth fixing because both strings are model-facing, and a renderer that silently changes line structure is the kind of thing that makes a tool reply ambiguous.
Tests
RED first, on current main:
a\nbproduced a hint containing a real line break;\nproduced two output lines for that one row.GREEN: both render one line per record, and the hint still names the when/why/hash and the way to lift a rejection.
bun run gategreen: 1104 unit tests + 30 terminal/BDD tests against a real host, 0 fail.bunx tsc --noEmitclean; lint and format identical to main's baseline.Closes #299.