claude-code - 💡(How to fix) Fix [Bug] Tool-layer unreliability in long/compacted sessions: duplicated results, delayed delivery, empty/garbled file reads

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

In a long, previously-compacted session, the tool-execution layer became unreliable. Results were duplicated and delivered in delayed batches, the Read tool intermittently returned empty content for non-empty files, and at least one read returned corrupted output. This caused the agent to re-issue commands, act on stale/mismatched data, and produce an incorrect edit plus an inaccurate (already-pushed) git commit.

Root Cause

Symptoms (most → least reproducible)

  1. Duplicated tool results — identical Bash/Read outputs returned 2–3× within the same turn.
  2. Delayed, batched delivery — tool calls appeared to return nothing; the results (originals + retries) then arrived together in one large batch a turn or two later. This is the root cause of the re-issue → duplication loop.
  3. Read returns "empty file" for a non-empty file — a 600+ line source file read as empty / "shorter than offset," then succeeded on retry.
  4. Garbled Read output — non-monotonic line numbers (e.g. line 166 followed by line 163) and stray fragments, i.e. corrupted rendering rather than real file content (observed at least once).

Code Example

[]
RAW_BUFFERClick to expand / collapse

Bug Description

Claude Code bug report

Subject: Tool-layer unreliability in long/compacted session — duplicated + delayed results, empty/garbled file reads

Environment

  • Claude Code CLI version: 2.1.158
  • Model: Opus 4.8 (1M context) — claude-opus-4-8[1m]
  • OS: macOS (Darwin 25.5.0), Apple Silicon, zsh
  • Session: long-running, had been /compact'd at least once; /effort max; 1M context
  • Pattern: frequent parallel tool calls (multiple Bash/Read in a single turn)

Summary

In a long, previously-compacted session, the tool-execution layer became unreliable. Results were duplicated and delivered in delayed batches, the Read tool intermittently returned empty content for non-empty files, and at least one read returned corrupted output. This caused the agent to re-issue commands, act on stale/mismatched data, and produce an incorrect edit plus an inaccurate (already-pushed) git commit.

Symptoms (most → least reproducible)

  1. Duplicated tool results — identical Bash/Read outputs returned 2–3× within the same turn.
  2. Delayed, batched delivery — tool calls appeared to return nothing; the results (originals + retries) then arrived together in one large batch a turn or two later. This is the root cause of the re-issue → duplication loop.
  3. Read returns "empty file" for a non-empty file — a 600+ line source file read as empty / "shorter than offset," then succeeded on retry.
  4. Garbled Read output — non-monotonic line numbers (e.g. line 166 followed by line 163) and stray fragments, i.e. corrupted rendering rather than real file content (observed at least once).

Impact

  • Wasted cycles re-running commands that had actually succeeded.
  • Agent briefly concluded work was complete based on file content that didn't match the real repo (caught later via git).
  • A string-match edit was built from stale content → silent no-op → an inaccurate commit message pushed before a delayed background (Codex) result arrived.

Likely triggers

  • Long session lifetime + at least one /compact; large (1M) context; bursts of parallel tool calls. Short/fresh sessions did not exhibit the empty/garbled reads.

Severity

High for long sessions — output you can't trust forces re-verification of everything and can drive wrong actions (bad edits/commits) on a live codebase.

Environment Info

  • Platform: darwin
  • Terminal: WarpTerminal
  • Version: 2.1.158
  • Feedback ID: 50a522ac-22c8-4038-b9d2-ee5a3f8214e8

Errors

[]

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [Bug] Tool-layer unreliability in long/compacted sessions: duplicated results, delayed delivery, empty/garbled file reads