chore(release): point release-notes generator at protoLabs gateway - #201
Conversation
Switch the changelog rewrite step from Anthropic's Messages API to the protoLabs LiteLLM gateway via OpenAI Chat Completions: - Endpoint: https://api.proto-labs.ai/v1/chat/completions (override with OPENAI_BASE_URL if needed) - Auth: Authorization: Bearer ${OPENAI_API_KEY} - Model: protolabs/fast (override with RELEASE_NOTES_MODEL) - Renamed callClaude → callLLM and parses choices[0].message.content Updated GitHub Actions secrets: - release.yml: ANTHROPIC_API_KEY → OPENAI_API_KEY - post-discord.yml: ANTHROPIC_API_KEY → OPENAI_API_KEY Verified with `node scripts/rewrite-release-notes.mjs v0.33.0 v0.32.0 --dry-run` — commits parse and prompts render correctly. NOTE: the GitHub repository must have a `OPENAI_API_KEY` secret set (pointing at a gateway-issued token) before the next release will post notes; otherwise the generator step fails with "OPENAI_API_KEY is not set" and the release tag is still created (the rewrite-notes step has continue-on-error: true). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughThe PR replaces the Claude/Anthropic integration with an OpenAI-compatible LLM gateway for release-note rewriting. ChangesLLM Provider Migration
sequenceDiagram
participant GH as GitHub Actions
participant Script as rewrite-release-notes.mjs
participant Gateway as LLM Gateway (/chat/completions)
participant Discord as Discord Webhook
GH->>Script: run node scripts/rewrite-release-notes.mjs (env includes OPENAI_API_KEY)
Script->>Gateway: POST /chat/completions (Authorization: Bearer GATEWAY_API_KEY, model: LLM_MODEL, messages: userPrompt)
Gateway-->>Script: 200 OK with choices[0].message.content
Script->>GH: produce rewritten notes
Script->>Discord: POST to DISCORD_RELEASE_WEBHOOK with notes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 2/5 reviews remaining, refill in 35 minutes and 16 seconds. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@scripts/rewrite-release-notes.mjs`:
- Around line 129-131: The current code returns an empty string when the LLM
output is missing (data.choices?.[0]?.message?.content ?? ''), which can let CI
continue with blank release notes; modify the function that awaits res.json() so
it checks data.choices?.[0]?.message?.content into a variable (e.g., content)
and if content is null/undefined/empty, throw an Error with a clear message
(including maybe the raw response or status) instead of returning ''; otherwise
return the content. This ensures the function fails fast and surfaces the
failure in CI/Discord posting flows.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 4546255e-2a43-4e8e-846f-1eff79e4866a
📒 Files selected for processing (3)
.github/workflows/post-discord.yml.github/workflows/release.ymlscripts/rewrite-release-notes.mjs
| const data = await res.json(); | ||
| return data.content[0].text; | ||
| return data.choices?.[0]?.message?.content ?? ''; | ||
| } |
There was a problem hiding this comment.
Fail fast when LLM output is empty instead of returning ''.
The current fallback can silently produce blank release notes and still continue to Discord posting. Throw when content is missing/empty so the failure is explicit in CI logs.
Suggested fix
const data = await res.json();
- return data.choices?.[0]?.message?.content ?? '';
+ const content = data.choices?.[0]?.message?.content;
+ if (typeof content !== 'string' || content.trim().length === 0) {
+ throw new Error('LLM response did not include non-empty message content');
+ }
+ return content.trim();
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const data = await res.json(); | |
| return data.content[0].text; | |
| return data.choices?.[0]?.message?.content ?? ''; | |
| } | |
| const data = await res.json(); | |
| const content = data.choices?.[0]?.message?.content; | |
| if (typeof content !== 'string' || content.trim().length === 0) { | |
| throw new Error('LLM response did not include non-empty message content'); | |
| } | |
| return content.trim(); | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@scripts/rewrite-release-notes.mjs` around lines 129 - 131, The current code
returns an empty string when the LLM output is missing
(data.choices?.[0]?.message?.content ?? ''), which can let CI continue with
blank release notes; modify the function that awaits res.json() so it checks
data.choices?.[0]?.message?.content into a variable (e.g., content) and if
content is null/undefined/empty, throw an Error with a clear message (including
maybe the raw response or status) instead of returning ''; otherwise return the
content. This ensures the function fails fast and surfaces the failure in
CI/Discord posting flows.
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
Summary
Switches the release-notes rewrite step (run from
release.ymlafter tagging, and on-demand frompost-discord.yml) from Anthropic's Messages API to our LiteLLM gateway via OpenAI Chat Completions.https://api.anthropic.com/v1/messageshttps://api.proto-labs.ai/v1/chat/completions(override withOPENAI_BASE_URL)x-api-key: ${ANTHROPIC_API_KEY}Authorization: Bearer ${GATEWAY_API_KEY}claude-haiku-4-5-20251001protolabs/fast(override withRELEASE_NOTES_MODEL)data.content[0].textdata.choices[0].message.contentAligns with how the in-CLI
recapGeneratoralready routes through the gateway.Why
GATEWAY_API_KEYand notOPENAI_API_KEYInfisical already has both:
OPENAI_API_KEYis a direct OpenAIsk-proj-…key, andGATEWAY_API_KEYis the LiteLLM master key. ReusingOPENAI_API_KEYfor the gateway flow would have madeprotolabs/fast404 against OpenAI's actual API. Picking the explicit name avoids the convention overload.Required follow-up
Add a
GATEWAY_API_KEYrepo secret onprotoLabsAI/protoCLI(value lives in Infisical under the same name). The rewrite-notes step hascontinue-on-error: true, so the release tag will still be created without the key — but Discord notes won't post.Test plan
node --check scripts/rewrite-release-notes.mjspassesnode scripts/rewrite-release-notes.mjs v0.33.0 v0.32.0 --dry-runparses commits + renders prompts cleanlyGATEWAY_API_KEYset, verify the Discord embed lands🤖 Generated with Claude Code
Summary by CodeRabbit