Files
zumacandClaude Opus 5.5 c3daadf167 fix(script): a script's read_file returns the file's text, not its display
Inside run_script, call("read_file", ...) returned the model-facing form:
every line prefixed "   N→", CRLF folded to LF, the default 2000-line page,
and — past 32 KiB — a window with a "read on from here" marker. A script
that read a file, edited the text and wrote it back put all of that into
the file. With deepseek-flash on migrate-signature-3packages and
agent.code_mode on, one bulk rewrite corrupted 36 files and cost ~15 rounds
to repair.

Two layers each rendered for the model a result whose reader is a program:

- read_file: a call another tool made (tool.IsNested) gets the decoded text
  verbatim — line endings and final newline kept, no default limit, offset
  and limit selecting whole lines. The model's own read is unchanged.
- nestedInvoker: the calling tool reads what the tool returned, not the
  bound fitted to the model's context. The nested card still shows the
  bounded form; toolOutcome.keepFull records both originals in one place.

write_file already preserves the existing file's encoding, so a BOM file
round-trips once the read stops adding to it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 10:57:36 -07:00
..