Bug: Duplicate file read tool invocations when same file referenced multiple times #960

Closed
opened 2026-02-16 17:28:55 -05:00 by yindo · 0 comments
Owner

Originally created by @jhrudden on GitHub (Jul 28, 2025).

Originally assigned to: @thdxr on GitHub.

When a file is referenced multiple times within a single message, the system creates duplicate read tool invocations for each reference instead of reusing the file content. The system should deduplicate file references so that read tool calls are not redundant.

Example:

Image
{
  "messages": [
    {
      "role": "user", 
      "content": [
        {
          "type": "text",
          "text": "Summarize @tsconfig.json and @tsconfig.json"
        },
        // Duplicate read calls below:
        {
          "type": "text", 
          "text": "Called the Read tool with the following input: {\"filePath\":\"/Users/jhr/Development/opencode/tsconfig.json\"}"
        },
        {
          "type": "text",
          "text": "Called the Read tool with the following input: {\"filePath\":\"/Users/jhr/Development/opencode/tsconfig.json\"}"
        }
      ]
    }
  ]
}
Originally created by @jhrudden on GitHub (Jul 28, 2025). Originally assigned to: @thdxr on GitHub. When a file is referenced multiple times within a single message, the system creates duplicate read tool invocations for each reference instead of reusing the file content. The system should deduplicate file references so that read tool calls are not redundant. ### Example: <img width="1274" height="361" alt="Image" src="https://github.com/user-attachments/assets/1f32e47b-0828-4acb-b1ce-c55bc2d68193" /> ```json { "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Summarize @tsconfig.json and @tsconfig.json" }, // Duplicate read calls below: { "type": "text", "text": "Called the Read tool with the following input: {\"filePath\":\"/Users/jhr/Development/opencode/tsconfig.json\"}" }, { "type": "text", "text": "Called the Read tool with the following input: {\"filePath\":\"/Users/jhr/Development/opencode/tsconfig.json\"}" } ] } ] } ```
yindo closed this issue 2026-02-16 17:28:55 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#960