anomalyco / anomalyco/opencode

V2 read tool dropped line numbers that V1 returned

Open
#38,348 1 comment 0 reactions 1 assignee View on GitHub

@nexxeln is already working on this.

Since Jul 22, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

V1 read prefixed every line with its number: ${i + offset}: ${line} (packages/opencode/src/tool/read.ts), and its tool description stated "Contents are returned with each line prefixed by its line number as <line>: <content>". V2 returns plain text — TextPage.content is just lines.join("\n") (packages/core/src/tool/read-filesystem.ts), with only offset/next metadata and no per-line numbers.

Without line numbers in the returned content, the model frequently reports incorrect line numbers to the user. Most other agents (Claude Code, Kimi-CLI, etc.) return cat -n-style line numbers and document it in the tool description.

Plugins

No response

OpenCode version

V2 (latest origin/v2)

Steps to reproduce
  1. Use the V2 read tool on any text file
  2. Observe the returned TextPage.content is plain text with no line numbers
  3. Compare with V1 which returned ${i + offset}: ${line} per line
Operating System

Linux

Terminal

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.