Skip to content

Read tool does not attribute content to file path #11204

@drybalka

Description

@drybalka

Description

When attaching multiple files with @ command their content is returned to model without attribution to which file it belongs.

For example, in an empty folder create two files:

// a.txt
28

// b.txt
42

Then ask the model to give you their contents with What numbers are written in files @a.txt and @b.txt ?. In my case with Claude Sonnet 4.5 it returns their contents switched:

The files contain:
- a.txt: 42
- b.txt: 28

Here is the relevant part of this request intercepted with mitmproxy:

        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "What numbers are written in files @a.txt and @b.txt ?"
                },
                {
                    "type": "text",
                    "text": "Called the Read tool with the following input:
{\"filePath\":\".../test/a.txt\"}"
                },
                {
                    "type": "text",
                    "text": "Called the Read tool with the following input:
{\"filePath\":\".../test/b.txt\"}"
                },
                {
                    "type": "text",
                    "text": "<file>\n00001| 42\n00002| \n\n(End of file - total 2 lines)\n</file>"
                },
                {
                    "type": "text",
                    "text": "<file>\n00001| 28\n00002| \n\n(End of file - total 2 lines)\n</file>"
                }
            ]
        }

As you can see it is impossible to say which content is which.

Plugins

None

OpenCode version

1.1.40

Steps to reproduce

See above.

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

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