Repository navigation
Command-aware output compression for dev-tool commands - #439
Merged
Merged
Conversation
Applies a conservative, structure-aware filter to recognized shell/git output before the generic size-threshold offload: collapses passing test lines from cargo/pytest/go test/jest/npm-yarn-pnpm test runs while keeping every failure and its context verbatim, and strips git diff's redundant diff/index bookkeeping headers. Both filters are no-ops when nothing matches, so short or already-compact output is never touched. Claude-Session: https://claude.ai/code/session_01Tb5bxZgFovoKct29q9VEgs
mohitranka
added a commit
that referenced
this pull request
Sep 11, 2026
…439) Applies a conservative, structure-aware filter to recognized shell/git output before the generic size-threshold offload: collapses passing test lines from cargo/pytest/go test/jest/npm-yarn-pnpm test runs while keeping every failure and its context verbatim, and strips git diff's redundant diff/index bookkeeping headers. Both filters are no-ops when nothing matches, so short or already-compact output is never touched. Claude-Session: https://claude.ai/code/session_01Tb5bxZgFovoKct29q9VEgs
mohitranka
added a commit
that referenced
this pull request
Sep 11, 2026
…439) Applies a conservative, structure-aware filter to recognized shell/git output before the generic size-threshold offload: collapses passing test lines from cargo/pytest/go test/jest/npm-yarn-pnpm test runs while keeping every failure and its context verbatim, and strips git diff's redundant diff/index bookkeeping headers. Both filters are no-ops when nothing matches, so short or already-compact output is never touched. Claude-Session: https://claude.ai/code/session_01Tb5bxZgFovoKct29q9VEgs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
forge_tools::compress_tool_output— recognizes the command behindbash,exec_command,background_run, and the structuredgittool, and applies a conservative, structure-aware filter before the existing size-threshold offload.cargo test/nextest,pytest,go test,npm/yarn/pnpm test,jest, drops only lines that unambiguously report a passing test, keeping every failure, its surrounding output, and the summary footer verbatim.git diffheader stripping: drops the redundantdiff --git a/x b/x/index <hash>lines (already duplicated by the--- a/x/+++ b/xlines immediately below), leaves every hunk untouched. Skipped for--stat/--numstat/--name-only, which are already minimal.Inspired by rtk's approach to CLI output compression, adapted to forge's existing tool-output pipeline rather than as an external proxy — forge already owns every tool implementation, so this applies uniformly across all of them instead of only to shell-hook boundaries.
Test plan
cargo fmt --allcleancargo clippy --workspace --all-targetscleancargo test --workspacegreen (full suite, exit 0)forge-toolsunit tests (command-text extraction across all 4 tool shapes, collapse logic across cargo/pytest/go/jest marker formats, diff filter, no-op cases)forge-coreend-to-end test driving a fakebashtool call through the realbegin_model_response_application→finish_tool_applicationpipeline, asserting the transcript holds the compressed resulthttps://claude.ai/code/session_01Tb5bxZgFovoKct29q9VEgs