Skip to content

Bash output truncation is head-only, discarding the tail where build and test errors live #764

Closed

Description

@will-lamerton

Problem

source/tools/execute-bash.tsx:50-54 truncates bash output for the LLM by keeping the first 2000 characters and discarding everything after:

const llmContext =
    fullOutput.length > TRUNCATION_OUTPUT_LIMIT
        ? fullOutput.substring(0, TRUNCATION_OUTPUT_LIMIT) +
            '\n... [Output truncated. Use more specific commands to see full output]'
        : fullOutput;

Compiler and test-runner output puts the important part at the end:

  • tsc prints the error list, then the count
  • AVA prints passing output, then the failure summary
  • most build tools print the exit status and error digest last

So head-truncating a pnpm run test:types or pnpm run test:ava run throws away exactly the part the model needs. It then has to re-run with a narrower command to recover information we already had in hand, which costs an extra step and an extra full round-trip.

Fix

Head plus tail with an elision marker. Same byte budget, much higher information density:

<first ~800 chars>
... [N characters elided] ...
<last ~1200 chars>

Tail should get the larger share, since that is where the actionable content usually is.

Also worth revisiting whether TRUNCATION_OUTPUT_LIMIT (2000 chars, source/constants.ts:80) is the right budget for build output. That is roughly 500 tokens, which is tight for a failing typecheck.

Note the same constant is used by source/custom-tools/handler.ts:100-101 with the same head-only behaviour, and by source/components/bash-progress.tsx:88 for display (where head-only is arguably fine). A shared head-plus-tail helper would cover the first two.

Notes for a first-time contributor

Self-contained change to one function plus a small shared helper. Tests in source/tools/execute-bash.spec.tsx.

Activity

  1. added
    bug
    good first issue
    performance
    on Aug 3, 2026
  2. will-lamerton commented on Aug 3, 2026

    @will-lamerton
    MemberAuthor

    Part of #772.

  3. added 2 commits that reference this issue on Aug 8, 2026
    81a756b
    bdd20c4
  4. added a commit that references this issue on Aug 9, 2026
    c0c8418
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issueperformance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions