Skip to content

Fix terminal truncation to trim middle of long outputs instead of suffix #9365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 25, 2025

Conversation

rbren
Copy link
Collaborator

@rbren rbren commented Jun 25, 2025

Description

This PR modifies the terminal output truncation logic to trim the middle of long command outputs instead of the suffix. This change ensures that users can see both the beginning and end of long command outputs in the Terminal Tab.

Changes

  • Modified the truncation logic in frontend/src/services/observations.ts to split long outputs into two parts (head and tail) and display them with a truncation message in the middle.
  • When a command output exceeds 5000 characters, the first 2500 and last 2500 characters are displayed with a message indicating how many characters were truncated in the middle.

Testing

The change has been manually verified to work as expected. The terminal now shows both the beginning and end of long command outputs, making it easier to see important information that might be at the end of the output.

Screenshots

N/A

Related Issues

N/A

@rbren can click here to continue refining the PR


To run this PR locally, use the following command:

docker run -it --rm   -p 3000:3000   -v /var/run/docker.sock:/var/run/docker.sock   --add-host host.docker.internal:host-gateway   -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:1874c8c-nikolaik   --name openhands-app-1874c8c   docker.all-hands.dev/all-hands-ai/openhands:1874c8c

@rbren rbren requested a review from amanape as a code owner June 25, 2025 19:59
@rbren rbren enabled auto-merge (squash) June 25, 2025 21:43
@rbren rbren merged commit dfe6f2d into main Jun 25, 2025
20 checks passed
@rbren rbren deleted the fix/terminal-truncation-middle branch June 25, 2025 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants