From b1a25404b638bfbd79ce4d08b49afc0ee1361528 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Sat, 30 May 2026 14:38:30 -0700 Subject: [PATCH] perf(read_file): make compact gutter the only format; drop HERMES_READ_GUTTER (#35532) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The compact "|content" gutter from #35368 is now the sole behavior. Removes the HERMES_READ_GUTTER=padded escape hatch and its env lookup — no legacy fixed-width path to maintain. Padding was pure token overhead (~48% more tokens than bare content, ~16% more than compact) with no measured accuracy gain in the original A/B. - file_operations.py: drop env lookup + os import; gutter always f"{i}|{line}" - tests: drop the padded env-override test; compact assertions retained --- tests/tools/test_file_operations.py | 7 ------- tools/file_operations.py | 8 ++------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/tests/tools/test_file_operations.py b/tests/tools/test_file_operations.py index 225b005cf..a66a81828 100644 --- a/tests/tools/test_file_operations.py +++ b/tests/tools/test_file_operations.py @@ -356,13 +356,6 @@ class TestShellFileOpsHelpers: assert "50|continued" in result assert "51|more" in result - def test_add_line_numbers_padded_env_override(self, file_ops, monkeypatch): - # Legacy fixed-width format available via HERMES_READ_GUTTER=padded. - monkeypatch.setenv("HERMES_READ_GUTTER", "padded") - result = file_ops._add_line_numbers("line one\nline two") - assert " 1|line one" in result - assert " 2|line two" in result - def test_add_line_numbers_truncates_long_lines(self, file_ops): long_line = "x" * (MAX_LINE_LENGTH + 100) result = file_ops._add_line_numbers(long_line) diff --git a/tools/file_operations.py b/tools/file_operations.py index 32d878de0..fd9f793ec 100644 --- a/tools/file_operations.py +++ b/tools/file_operations.py @@ -714,13 +714,9 @@ class ShellFileOperations(FileOperations): line-reference / patch / value-lookup / structure tasks (4/4 both), while dropping line numbers entirely regressed line-referencing (the model hand-counted and was off-by-one, 3/4) — so we keep the - numbers, just not the padding. ``HERMES_READ_GUTTER=padded`` - restores the legacy fixed-width format for anyone who relied on - column alignment. + numbers, just not the padding. """ - import os as _os from tools.tool_output_limits import get_max_line_length - padded = (_os.environ.get("HERMES_READ_GUTTER") or "").lower() == "padded" max_line_length = get_max_line_length() lines = content.split('\n') numbered = [] @@ -728,7 +724,7 @@ class ShellFileOperations(FileOperations): # Truncate long lines if len(line) > max_line_length: line = line[:max_line_length] + "... [truncated]" - numbered.append(f"{i:6d}|{line}" if padded else f"{i}|{line}") + numbered.append(f"{i}|{line}") return '\n'.join(numbered) def _expand_path(self, path: str) -> str: