-
Notifications
You must be signed in to change notification settings - Fork 76
Refactor visualizer to use modular approach with individual event classes & consistent color #171
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
Conversation
…sses - Add visualize property to ActionBase with systematic field display - Add visualize property to all event classes (SystemPromptEvent, ActionEvent, ObservationEvent, MessageEvent, UserRejectObservation, AgentErrorEvent, PauseEvent) - Refactor ConversationVisualizer to use event.visualize properties, removing complex if/else structure - Add visualize parameter to Conversation constructor with default True for optional visualization - Add comprehensive test coverage for all visualization functionality - Maintain backward compatibility and metrics formatting Fixes #167 Co-authored-by: openhands <openhands@all-hands.dev>
|
@OpenHands please fix the failing actions on PR #171 at branch |
|
I'm on it! xingyaoww can track my progress at all-hands.dev 🔴 Solvability: HARD This issue involves fixing failing CI/CD actions on a specific branch, which requires understanding complex system interactions and environment-specific configurations. The lack of detailed error information, reproduction steps, and specific failure descriptions makes this a challenging issue to resolve effectively. You can make the issue easier to resolve by addressing these concerns in the conversation: • Include the specific error messages or logs from the failing actions to understand what went wrong |
|
@OpenHands /codereview-roasted and suggest ways to improve/simplify the visualization code |
|
I'm on it! xingyaoww can track my progress at all-hands.dev 🔴 Solvability: HARD This issue is challenging to resolve due to its extremely minimal description, lacking essential details like error messages, reproduction steps, code examples, or specific technical context. The request appears to be for a code review and improvement suggestions for visualization code, but without any actual code or clear problem statement provided. You can make the issue easier to resolve by addressing these concerns in the conversation: • Include the actual visualization code that needs to be reviewed and improved |
Code Review SummaryI provided a critical engineering analysis of the visualization refactoring in PR #171. Here's my assessment: Taste Rating: 🔴 Needs improvement - Violates fundamental principlesKey Findings:Critical Issues:
The Core Problem: Recommended Solutions:
Why This Matters:
Verdict: The refactoring solves an imaginary problem (complex if/else) while creating real architectural issues. The original approach was fundamentally sound and just needed better organization, not elimination. This analysis was requested as a "/codereview-roasted" - providing brutally honest, technically rigorous feedback focused on fundamental engineering principles rather than style preferences. |
…atCompletionMessageToolCall instances - Replace Mock objects with proper ChatCompletionMessageToolCall instances in test_visualizer.py - Add helper function create_tool_call() to create valid tool call objects - Import required litellm classes (ChatCompletionMessageToolCall, Function) - Fix 3 failing tests: test_action_event_visualize, test_visualizer_event_panel_creation, test_metrics_formatting - All 494 SDK tests now pass Co-authored-by: openhands <openhands@all-hands.dev>
SummaryI have successfully fixed the failing GitHub Actions on PR #171 for the Problem IdentifiedThe failing tests were in Changes Made
Verification✅ All 494 SDK tests now pass The GitHub Actions should now pass successfully. The fix was minimal and targeted, addressing only the specific validation errors without affecting any other functionality. |
|
Looks like there are a few issues preventing this PR from being merged!
If you'd like me to help, just leave a comment, like Feel free to include any additional details that might help me get this PR into a better state. You can manage your notification settings |
- Added highlight_regex parameter to ConversationVisualizer.__init__() - Implemented _apply_highlighting method for regex-based text highlighting - Updated create_default_visualizer to accept highlight_regex parameter - Fixed test assertion for MessageEvent visualization - All tests passing with highlight_regex functionality restored Co-authored-by: openhands <openhands@all-hands.dev>
- Removed manual regex compilation and pattern matching logic - Simplified _apply_highlighting to use Rich Text.highlight_regex() method - Reduced code complexity by leveraging existing Rich functionality - Removed unnecessary imports (re, Pattern) - All tests still passing with cleaner implementation Co-authored-by: openhands <openhands@all-hands.dev>
…s/refactor-visualizer-modular

Summary
This PR refactors the conversation visualizer to use a modular approach where each event class handles its own visualization, eliminating the complex if/else structure in the visualizer.
Changes Made
Core Refactoring
visualizeproperty toActionBase: Provides systematic field display with proper formatting for multiline strings, lists, and dictionariesvisualizeproperty to all event classes: Each event type now handles its own visualization logic:SystemPromptEvent: Displays system prompt contentActionEvent: Shows thought process and action details usingaction.visualizeObservationEvent: Displays observation content from agent_observationMessageEvent: Shows message content with role informationUserRejectObservation: Displays rejection reasonAgentErrorEvent: Shows error detailsPauseEvent: Displays pause reasonVisualizer Simplification
ConversationVisualizer: Removed complex if/else structure, now usesevent.visualizefor content generationcreate_default_visualizer()helper: Creates a default visualizer with standard configurationConversation Integration
visualizeparameter toConversationconstructor: Defaults toTrue, allows optional visualizationTesting
Benefits
Example Usage
Testing
All tests pass:
Fixes #167
@xingyaoww can click here to continue refining the PR