Skip to content

fix: reduce exec output size#38

Closed
dexhunter wants to merge 1 commit intodevfrom
fix/reduce_exec_output_size
Closed

fix: reduce exec output size#38
dexhunter wants to merge 1 commit intodevfrom
fix/reduce_exec_output_size

Conversation

@dexhunter
Copy link
Copy Markdown
Member

Seeing the error from some of the runs (dev branch)

 Error: Unable to add new solution to solution history. Please restart the run.

I think it was caused by json payload too large and weco fails to send via evaluate_feedback_then_suggest_next_solutio weco/api.py

@dexhunter dexhunter self-assigned this Jul 21, 2025
@dexhunter
Copy link
Copy Markdown
Member Author

the previous issue is the output too large for single step while for multiple steps it might accumulated and become too large to send

@DhruvSrikanth DhruvSrikanth requested a review from Copilot July 21, 2025 15:14
@DhruvSrikanth DhruvSrikanth added the bug Something isn't working label Jul 21, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR aims to reduce the size of execution output to prevent JSON payload size errors that were causing failures in the dev branch. The changes focus on improving output truncation logic and reducing default character limits.

  • Moved truncation constants to a centralized constants file for better organization
  • Reduced the default character limit from 5000 to 2500 to prevent payload size issues
  • Enhanced truncation logic to choose the more restrictive limit when both line and character limits apply

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
weco/constants.py Added centralized constants for output truncation limits with reduced character limit
weco/utils.py Refactored truncation logic to use centralized constants and improved algorithm to select smaller output

# Use whichever produces smaller result
if len(lines_output) <= len(chars_output):
output = lines_output
chars_truncated = False # Only show line truncation message
Copy link

Copilot AI Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting flags to False to control message display creates confusing logic. Consider using a separate variable to track which truncation method was applied instead of modifying the original detection flags.

Copilot uses AI. Check for mistakes.
chars_truncated = False # Only show line truncation message
else:
output = chars_output
lines_truncated = False # Only show char truncation message
Copy link

Copilot AI Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting flags to False to control message display creates confusing logic. Consider using a separate variable to track which truncation method was applied instead of modifying the original detection flags.

Copilot uses AI. Check for mistakes.
@dexhunter
Copy link
Copy Markdown
Member Author

close since it is not the root cause

@dexhunter dexhunter closed this Jul 22, 2025
@dexhunter dexhunter deleted the fix/reduce_exec_output_size branch July 22, 2025 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants