Skip to content

fix(shared): extract shared text truncation utilities - #796

Closed
github-actions[bot] wants to merge 1 commit into
mainfrom
fix/code-quality/shared-text-utils
Closed

fix(shared): extract shared text truncation utilities#796
github-actions[bot] wants to merge 1 commit into
mainfrom
fix/code-quality/shared-text-utils

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Summary

Extract duplicated text truncation logic into a shared module openhands_cli/shared/text_utils.py.

Changes

  • Add truncate_text() function with configurable max_length, from_start/end direction, and custom ellipsis
  • Add clean_for_display() function that combines stripping, newline collapse, and truncation
  • Update conversations/display.py to use clean_for_display()
  • Update tui/widgets/richlog_visualizer.py to use truncate_text()
  • Add comprehensive test coverage in tests/shared/test_text_utils.py
  • Export new functions in shared/__init__.py

Related Issue

Addresses findings from #795 (Item 6: Create shared/text_utils.py with truncation function)

Testing

  • Linting passes (make lint)
  • Tests pass (make test)
  • New test file with 12 tests covering all functionality

This PR was automatically generated by the Code Quality Report workflow.

Create shared/text_utils.py with truncate_text() and clean_for_display()
functions to consolidate duplicated text truncation logic across the codebase.

- Add truncate_text() with configurable max_length, from_start/end, and ellipsis
- Add clean_for_display() combining strip, newline collapse, and truncation
- Update conversations/display.py to use clean_for_display()
- Update tui/widgets/richlog_visualizer.py to use truncate_text()
- Add comprehensive test coverage

Addresses item from code quality report.

Closes #795
@github-actions

Copy link
Copy Markdown
Contributor Author

This PR is stale because it has been open for 40 days with no activity. Remove the stale label or leave a comment, otherwise it will be closed in 10 days.

@github-actions github-actions Bot added the Stale label Aug 30, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

This PR was closed because it had no activity for 50 days. If you feel this was closed in error, and you would like to continue the PR, please resubmit or let us know.

@github-actions github-actions Bot closed this Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants