Repository navigation
chore: harden highlights comment posting against API/size failures - #306
Merged
Merged
Conversation
Addresses Copilot's feedback on #305: the createComment call could fail (oversize body, transient API error, rate limit) and crash the whole workflow even though the report issue has already been created. Two hardening changes: 1. Body-size truncation. GitHub caps issue comments at 65,536 chars. Today's highlights run at ~10K chars, well below the limit, but a busy month with --llm-summary across many translation-sync PRs could grow. If highlights.md exceeds the limit, truncate to fit and append a footer linking to the workflow run's artifact so the full content is recoverable. 2. try/catch around createComment. Transient API failures now log to stderr and continue rather than failing the step. Rationale: the report issue was already created in the preceding lines, so the report is preserved regardless of what happens to the comment. highlights.md is also in the uploaded artifact bundle, so the highlights themselves are recoverable manually. Net effect: the workflow now degrades gracefully on any comment-posting failure mode rather than turning red. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Hardens the weekly report workflow’s highlights comment posting to avoid workflow failures due to GitHub comment size limits and transient API errors, while keeping the full highlights accessible via artifacts.
Changes:
- Truncates
highlights.mdto fit GitHub’s 65,536-character issue comment limit and appends a footer linking to the workflow run. - Wraps
issues.createCommentin atry/catchto prevent transient comment-posting failures from failing the workflow.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Two follow-up tweaks both flagged on the inline review:
1. Wrap fs.readFileSync('highlights.md') in its own try/catch.
existsSync doesn't guarantee the read succeeds (permission/IO
errors are theoretically possible even on a fresh CI runner), and
the asymmetry with the weekly-report.md read above was a smell.
On read failure: log + null out and skip the comment path —
behaves identically to "file not produced".
2. Log richer fields when createComment fails. Octokit errors carry
.status and .response.data with the actual diagnostic, while
.message is often terse ("Validation Failed"). The catch block
now logs the HTTP status when present, falls back to String(err)
if .message is missing, and appends response.data when available.
Future debugging won't be limited to the bare .message.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 21, 2026
This was referenced Jun 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #305 addressing Copilot's review feedback — the
createCommentcall postinghighlights.mdwasn't wrapped in error handling and didn't account for GitHub's 65,536-char comment body limit.Changes
Two hardening tweaks in the
github-scriptstep:Body-size truncation. If
highlights.mdexceeds 65,536 chars, truncate to fit and append a footer linking to the workflow run's artifact bundle so the full content remains recoverable. Today's highlights run ~10K chars; this is preventive against a busy month + LLM narratives + many translation-sync PRs growing the output.try/catcharoundcreateComment. Transient API failures (rate limits, network blips) now log to stderr and let the workflow finish green. Rationale: the report issue is already created by the time we reach the comment step, so the report itself is preserved regardless of what happens to the comment.highlights.mdis also in the uploaded artifact, so the highlights are manually recoverable.Net effect
createCommentTest plan
workflow_dispatchonce🤖 Generated with Claude Code