Repository navigation
Description
Part of #292.
Problem
Two model-facing renderers interpolate row-derived text without flattenMemoryText, so a control character stored earlier survives into tool output as a real line break:
- The refusal hint embeds the tombstone reason unflattened:
src/gate/gate.ts:822buildswhyfromredactSecrets(rejection.tombstone.reason)and splices it intoreason: ${why}(src/gate/gate.ts:835-836).ForgetArgs.reasonis a plainz.string()(src/tools/schema.ts:112) and flows throughpruneMemory→tombstoneMany(src/store/files/prune.ts:129-135) untouched, so a forget reason containing\nre-enters a later matching write's hint with a real newline. renderProposalsslices row content as stored:src/consolidate/render.ts:16-17interpolatesp.survivor.content.slice(0, 160)and loser content directly, whilememory_recallflattens the same rows throughflattenMemoryText(src/inject/format.ts:27-30).
The repo's own rule is stated in src/tools/schema.ts:26-29: content stays multiline in the store and "is flattened only when rendered" — these two render sites miss the flatten. Impact is formatting hygiene only: the tool result is already free-form text, the store file stays one record per line, and nothing reaches the system prompt. #35 deliberately put the reason in the hint, so only the unflattened splice is in question.
Fix direction
Flatten at the render seam in both places: flattenMemoryText(redactSecrets(rejection.tombstone.reason)) at src/gate/gate.ts:822, and flattenMemoryText(...) around the two content slices in src/consolidate/render.ts:16-17. Add pins: a tombstoned reason with an embedded newline yields a single-line hint; a multi-line survivor/loser row renders one output line per row.
Acceptance
RED: on main 7405dc61d919e7eee7033dea6e4324eda58ee669, (a) tombstone content with reason "a\nb" (direct tombstone() call, bypassing the schema) then trigger a matching write — the returned hint contains a real line break; (b) renderProposals over a plan whose survivor content contains \n emits more than one line for that row — both tests fail.
GREEN: bun run test passes; both outputs are single-line per record; credential redaction in the hint is unchanged.
Activity
chore(release): 0.22.1 [skip ci]
abogartz-opencode-self-improvement commentedon Nov 9, 2026
🎉 This issue has been resolved in version 0.22.1 🎉
The release is available on:
Your semantic-release bot 📦🚀