Skip to content

fix(cli): folded paste content was invisible to the model#5347

Open
liugh-dev wants to merge 1 commit into
esengine:main-v2from
liugh-dev:fix/cli-paste-memory-compiler-source-event
Open

fix(cli): folded paste content was invisible to the model#5347
liugh-dev wants to merge 1 commit into
esengine:main-v2from
liugh-dev:fix/cli-paste-memory-compiler-source-event

Conversation

@liugh-dev

Copy link
Copy Markdown

Summary

A folded multi-line paste ([Pasted text #N · M lines]) was never seen by the model — only the placeholder label was. The CLI passed the folded label (the un-expanded line) as the controller's raw value. The Memory v5 compiler (enabled by default) takes raw as the source_event of its execution contract, and that contract replaces the whole user turn — so the model's only view of the paste became the label, with the actual content lost.

Verification

Copy multi-line text and paste into the input erea, then ask the agent how many lines it can see. If it can't see any pasted text, the bug exists.

Cache impact

Cache-impact: TODO
Cache-guard: TODO
System-prompt-review: N/A

For cache-sensitive changes, fill these lines before requesting review:

  • Cache-impact: none, low, medium, or high, plus the reason.
  • Cache-guard: the focused guard test/command added or run, or why an existing guard covers the change.
  • System-prompt-review: required reviewer/approval note when provider-visible system prompt, memory prefix, output style, or skill index behavior changes.

A folded multi-line paste ([Pasted text #N · M lines]) was never seen by
the model — only the placeholder label was. The CLI passed the folded
label (the un-expanded `line`) as the controller's `raw` value. The Memory
v5 compiler (enabled by default) takes `raw` as the source_event of its
execution contract, and that contract replaces the whole user turn — so
the model's only view of the paste became the label, with the actual
content lost.

The Desktop path already passes the expanded text as `raw`; only the CLI
passed the label. Pass the expanded content (sentLine / msg.display) as
`raw` in both the non-refs and @-refs submit paths, matching Desktop.
`raw` still excludes resolved @-reference payloads (per the existing
TestRunCompilesMemorySourceFromUnexpandedContext intent) — it now carries
the expanded paste block but not inline file contents.

Add TestPasteFoldExpandOnSubmit, which asserts the memory-compiler
source_event holds the expanded paste (it fails before the fix:
source_event is only "[Pasted text esengine#1 · 11 lines]").

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development tui Terminal UI / CLI (internal/cli, internal/control) labels Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tui Terminal UI / CLI (internal/cli, internal/control) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant