hermes - ✅(Solved) Fix [Bug]: Terminal tools (read_file, cat) truncate long lines with "...", causing model to misjudge file content as corrupted [1 pull requests, 5 comments, 2 participants]

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…
GitHub stats
NousResearch/hermes-agent#16520Fetched 2026-04-28 06:52:52
View on GitHub
Comments
5
Participants
2
Timeline
10
Reactions
0
Author
Participants
Timeline (top)
commented ×5labeled ×4cross-referenced ×1

Error Message

However, when I open this file to view it, the content is displayed completely and is not truncated. And it also works fine. Could it be that your reading tool has an error?

Additional Logs / Traceback (optional)

Root Cause

The issue is likely within Hermes' display/rendering layer for terminal tool outputs. The truncation happens before the output is sent to the model.

Key evidence:

  • read_file output is truncated.
  • cat output is also truncated.
  • hexdump output (raw bytes) is complete, confirming the file is intact and the truncation is purely in the rendering layer.

Fix Action

Fixed

PR fix notes

PR #16596: fix(tools): increase default max line length from 2000 to 10000

Description (problem / solution / changelog)

Fixes NousResearch/hermes-agent#16520

Problem

The per-line truncation at 2000 characters causes the model to see truncated file content, leading to incorrect judgments about file integrity. The model may report valid configuration lines as "corrupted" or "truncated" because it only sees a partial version.

Root Cause

file_operations.py truncates lines longer than MAX_LINE_LENGTH (default 2000) with ... [truncated] before passing the content to the model. While there's a total character limit (MAX_CHARS) that already protects against huge outputs, the per-line limit is too aggressive for files with long lines (minified JS, long JSON, base64 data, etc.).

Fix

Increased DEFAULT_MAX_LINE_LENGTH from 2000 to 10000 in both:

  • tools/tool_output_limits.py (centralized defaults)
  • tools/file_operations.py (module-level constant)

This is still protective (prevents truly enormous lines from flooding the context) but won't truncate most real-world code. Users can still configure tool_output.max_line_length in config.yaml for custom limits.

Files Changed

  • tools/tool_output_limits.py — 1 line changed (default constant)
  • tools/file_operations.py — 1 line changed (module constant)

Changed files

  • tools/file_operations.py (modified, +1/-1)
  • tools/tool_output_limits.py (modified, +1/-1)

Code Example

python
SECRET_KEY=os.environ.get('SECRET_KEY', 'stock-tracker-secret-key-2026')

---

text
Read the file [/my_project/config.py] and show me the content of the line with SECRET_KEY.

---

text
SECRET_KEY=os.env...EY', 'stock-tracker-secret-key-2026')

---

**User:**
However, when I open this file to view it, the content is displayed completely and is not truncated. And it also works fine. Could it be that your reading tool has an error?

**Assistant:**
Ah! Let me use `hexdump` to carefully examine the actual byte content!

*(Executes `hexdump -C /my_project/config.py | head -10`)*

You are right! I used `hexdump` to carefully inspect the raw bytes, and the file is actually complete:

`os.environ.get('SECRET_KEY', 'stock-tracker-secret-key-2026')`

All the bytes are correct! The `os.environ.get` part is fully present and not truncated.

It's a display issue with my `read_file` tool! When it outputs to the terminal, it truncates the middle part of `os.environ.get` and displays it as `os.env...EY'`, but the actual file on disk is completely normal.

The user is right, the file is no problem and the fact that it works fine proves this. It's an issue with the assistant's reading tool creating a misunderstanding due to terminal rendering truncation.

Sorry, the assistant almost made a big mistake! Thank you for the correction.

---
RAW_BUFFERClick to expand / collapse

Bug Description

Problem Summary

When using read_file or cat (via terminal tool) to read a file containing a long line (e.g., a config entry), the output is truncated with ... before being passed to the model. This causes the model to mistakenly believe the file content is corrupted or incomplete.

Impact

This is not merely a display issue. Because the truncated output is passed directly to the model for analysis, it causes the model to make incorrect judgments about file integrity. In my case, the model repeatedly reported a valid configuration line as "corrupted" or "truncated," blocking further progress until the issue was manually verified via hexdump.

This breaks the core feedback loop of the agent: the user expects the tool to provide accurate evidence, but here the tool itself becomes a source of misinformation. Therefore, this is a functional bug, not a cosmetic one.

Steps to Reproduce

  1. Have a file containing a long line of code, for example, config.py with:
python
SECRET_KEY=os.environ.get('SECRET_KEY', 'stock-tracker-secret-key-2026')
  1. In Hermes chat, ask the agent to read this file using the read_file tool.
text
Read the file [/my_project/config.py] and show me the content of the line with SECRET_KEY.
  1. Observe the agent's response. The long line will be truncated, like:
text
SECRET_KEY=os.env...EY', 'stock-tracker-secret-key-2026')
  1. Verify the actual file content on disk (e.g., using hexdump). The content is complete and not corrupted.

Expected Behavior

Expected Behavior

The model should receive the complete, un-truncated output from terminal tools like read_file and cat to make accurate judgments. Automatic truncation that alters the content passed to the model is a functional bug, not just a display issue. If truncation is necessary for UI length limits, the full content should still be passed to the model for analysis.

Actual Behavior

Observed Behavior

The output from both read_file and cat (via the terminal tool), when presented in the chat response, truncates long lines with ..., leading to a belief that the file itself is corrupted. However, the underlying file is intact, as verified by hexdump, which bypasses the display layer and shows the complete raw bytes.

Affected Component

CLI (interactive chat)

Messaging Platform (if gateway-related)

No response

Debug Report

**User:**
However, when I open this file to view it, the content is displayed completely and is not truncated. And it also works fine. Could it be that your reading tool has an error?

**Assistant:**
Ah! Let me use `hexdump` to carefully examine the actual byte content!

*(Executes `hexdump -C /my_project/config.py | head -10`)*

You are right! I used `hexdump` to carefully inspect the raw bytes, and the file is actually complete:

`os.environ.get('SECRET_KEY', 'stock-tracker-secret-key-2026')`

All the bytes are correct! The `os.environ.get` part is fully present and not truncated.

It's a display issue with my `read_file` tool! When it outputs to the terminal, it truncates the middle part of `os.environ.get` and displays it as `os.env...EY'`, but the actual file on disk is completely normal.

The user is right, the file is no problem and the fact that it works fine proves this. It's an issue with the assistant's reading tool creating a misunderstanding due to terminal rendering truncation.

Sorry, the assistant almost made a big mistake! Thank you for the correction.

Operating System

macOS 26.4.1

Python Version

No response

Hermes Version

v0.11.0 (2026.4.23)

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

Root Cause Analysis

The issue is likely within Hermes' display/rendering layer for terminal tool outputs. The truncation happens before the output is sent to the model.

Key evidence:

  • read_file output is truncated.
  • cat output is also truncated.
  • hexdump output (raw bytes) is complete, confirming the file is intact and the truncation is purely in the rendering layer.

Proposed Fix (optional)

No response

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

extent analysis

TL;DR

The issue can be resolved by modifying the display/rendering layer of Hermes to pass the full output from terminal tools like read_file and cat to the model, without truncation.

Guidance

  • Identify the specific function or module in Hermes responsible for rendering the output from read_file and cat tools.
  • Modify this function to pass the complete output to the model, potentially by distinguishing between display rendering and model input.
  • Consider adding an option to control the display of long lines, such as wrapping or scrolling, to improve user experience without affecting model input.
  • Verify the fix by testing with files containing long lines and checking that the model receives the complete content.

Example

# Hypothetical example of how the rendering function might be modified
def render_terminal_output(output):
    # ... existing rendering code ...
    # Instead of truncating, pass the full output to the model
    model_input = output  # Ensure model_input is not truncated
    # ... existing rendering code to display output to user ...
    return model_input

Notes

The exact implementation details will depend on the internal structure of Hermes and how the rendering layer is currently implemented. This guidance assumes that the issue is indeed with the display/rendering layer and that modifying this layer can resolve the problem.

Recommendation

Apply a workaround by modifying the rendering layer to pass the full output to the model, as this directly addresses the identified root cause of the issue.

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

hermes - ✅(Solved) Fix [Bug]: Terminal tools (read_file, cat) truncate long lines with "...", causing model to misjudge file content as corrupted [1 pull requests, 5 comments, 2 participants]