[BUG] Model reading from Task Output for background tasks like `cargo build` or `cargo test` bypasses token output limit and uses entire session context in one read

Resolved 💬 3 comments Opened Jan 7, 2026 by w0wl0lxd Closed Jan 11, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

<img width="403" height="118" alt="Image" src="https://github.com/user-attachments/assets/b775eb43-7910-42ae-ae14-3c48daa7522c" />

When Claude reads from Task Output of wordy/long tasks, it uses the entire available token budget to try and fit it, instead of limiting the amount of tokens to "BASH_MAX_OUTPUT_LENGTH" value, in this case "BASH_MAX_OUTPUT_LENGTH": "15000"

Claude correctly attempted to run tail -100 on the /tasks/bc7f68e.output file before reading this Task output, but oddly decided to read the full output after already getting that.

What Should Happen?

Claude should limit reads of background tasks to the proper configured amount, and not be able to read such large amounts of output from background files.

Error Messages/Logs

Steps to Reproduce

  1. Have Claude run a verbose command (cargo build, cargo test)
  1. Allow Claude to continue working
  1. Claude will read the Task Output eventually to check status, resulting in the entire output being piped to the models context window.

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.0.76

Platform

Other

Operating System

Windows

Terminal/Shell

WSL (Windows Subsystem for Linux)

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗