-
Notifications
You must be signed in to change notification settings - Fork 5.3k
fix: handle GitHub issue body character limit in code quality workflow #5541
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
- Add truncation logic to prevent exceeding GitHub's 65536 character limit - Truncate report at 50k characters to leave room for rest of issue body - Cut at line boundary to maintain valid markdown - Add note when report is truncated directing to workflow artifacts
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Claude finished @wtfsayo's task —— View job PR Review: GitHub Issue Body Character Limit FixTodo List:
Review SummaryOVERALL ASSESSMENT: ✅ APPROVED - This is a well-implemented fix that addresses the critical workflow failure. Code Quality Review✅ SECURITY ANALYSIS: PASSED
✅ IMPLEMENTATION ANALYSIS: EXCELLENTTruncation Logic (lines 504-512): // GitHub has a 65536 character limit for issue bodies
const maxReportLength = 50000; // Leave room for the rest of the issue body
let reportTruncated = false;
if (reportContent.length > maxReportLength) {
// Truncate at a line boundary to keep markdown valid
const truncateAt = reportContent.lastIndexOf('\n', maxReportLength);
reportContent = reportContent.substring(0, truncateAt > 0 ? truncateAt : maxReportLength);
reportTruncated = true;
} Strengths:
User Experience Enhancement (lines 559-560): ${reportTruncated ? '\n\n**Note:** The full report was truncated due to GitHub\'s character limit. View the complete report in the workflow artifacts.' : ''}
✅ TESTING REQUIREMENTS: ACCEPTABLEWhy testing is not required for this change:
✅ ELIZAOS STANDARDS COMPLIANCE: PASSED
✅ DOCUMENTATION: ADEQUATE
Critical Issues FoundNone - This is a clean, well-implemented fix. Suggestions for Improvement💡 MINOR SUGGESTION: Enhanced Error HandlingConsider adding validation for edge cases: if (reportContent.length > maxReportLength) {
const truncateAt = reportContent.lastIndexOf('\n', maxReportLength);
// Ensure we don't truncate to zero length
const finalTruncateAt = truncateAt > 1000 ? truncateAt : maxReportLength;
reportContent = reportContent.substring(0, finalTruncateAt);
reportTruncated = true;
} 💡 MINOR SUGGESTION: Truncation StatisticsCould add truncation details to the user message: **Note:** The full report was truncated from ${originalLength} to ${reportContent.length} characters due to GitHub's character limit. View the complete report in the workflow artifacts. Final AssessmentThis PR successfully addresses the critical workflow failure with a pragmatic, well-implemented solution. The truncation logic is smart, safe, and user-friendly. The fix ensures the daily code quality analysis can continue functioning while preserving all data through workflow artifacts. Recommendation: ✅ MERGE - This fix should be merged to restore workflow functionality. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Report Truncation and Summary Mismatch
The code quality analysis workflow has two issues:
- Incorrect Report Truncation: The logic to truncate the
reportContent
usestruncateAt > 0
instead oftruncateAt >= 0
. This incorrectly treats a newline at position 0 as if no line boundary was found, causing the report to be truncated atmaxReportLength
instead of at the intended line boundary, potentially leading to improperly formatted or still-too-long content. - Inaccurate Summary Statistics: The
summaryStats
(e.g.,deadCode
,security
) are calculated after thereportContent
is truncated. This means that if the report exceeds themaxReportLength
, the displayed summary counts will be based on the truncated content, leading to inaccurate (lower) statistics compared to the full analysis results.
.github/workflows/daily-code-quality-analysis.yml#L503-L523
eliza/.github/workflows/daily-code-quality-analysis.yml
Lines 503 to 523 in 2cf7ffe
// GitHub has a 65536 character limit for issue bodies | |
const maxReportLength = 50000; // Leave room for the rest of the issue body | |
let reportTruncated = false; | |
if (reportContent.length > maxReportLength) { | |
// Truncate at a line boundary to keep markdown valid | |
const truncateAt = reportContent.lastIndexOf('\n', maxReportLength); | |
reportContent = reportContent.substring(0, truncateAt > 0 ? truncateAt : maxReportLength); | |
reportTruncated = true; | |
} | |
// Count issues for summary | |
let summaryStats = { | |
deadCode: 0, | |
security: 0, | |
typeSafety: 0, | |
testCoverage: 0, | |
codeQuality: 0, | |
documentation: 0, | |
repoStandards: 0 | |
}; |
Was this report helpful? Give feedback by reacting with 👍 or 👎
Description
This PR fixes a critical issue that was discovered after the previous PR was merged. The daily code quality analysis workflow was failing because the generated issue body exceeded GitHub's 65,536 character limit.
Problem
The workflow failed with error:
This happened because the full analysis report can be very large, especially for large codebases.
Solution
Added truncation logic to the issue creation step:
Changes
Testing
Fixes the workflow failure seen in: https://github.com/elizaOS/eliza/actions/runs/16222104255/job/45804965964