Skip to content

read tool call rendering in TUI breaks if line numbers are strings #9887

Description

@moritzwilksch

What happened?

I was trying out openrouter:xiaomi/mimo-v2.6-flash, which seemingly likes to generate offset and limit values for the read tool as strings. The TUI then incorrectly concatenates strings instead of adding numbers when rendering the result.

Image

The model requested lines 25-37, corresponding to offset: 25 and limit: 13, but the rendered tool call shows dummy.txt:25-2512.

The issue is in packages/coding-agent/src/core/tools/read.ts:

const startLine = args.offset ?? 1;
const endLine = args.limit !== undefined ? startLine + args.limit - 1 : "";

With offset: 25 and limit: "13", this becomes 25 + "13" - 1 → "2513" - 1 → 2512.

Steps to reproduce

Use openrouter:xiaomi/mimo-v2.6-flash and ask it to read a certain line range in a file. Read tool renders string-concatenated numbers.

Expected behavior

Performs addition, i see 25:37 instead of 25:2512.

Version

v0.87.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions