Skip to content

fix: glm 4.7 finish reason - #2545

Merged
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
seefs001:fix/glm-4.7-finish-reason
Dec 29, 2025
Merged

Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
seefs001:fix/glm-4.7-finish-reason

Conversation

@seefs001

@seefs001 seefs001 commented Dec 29, 2025 •

Copy link
Copy Markdown
Collaborator

修复GLM系列,提前结束流程的问题

Summary by CodeRabbit

Release Notes

  • Chores
    • Internal optimization to improve system reliability and performance.

Note: This release contains internal improvements with no user-facing changes.

✏️ Tip: You can customize this high-level summary in your review settings.

Co-Authored-By: Warp <agent@warp.dev>
@coderabbitai

coderabbitai Bot commented Dec 29, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The change relocates the assignment of info.ClaudeConvertInfo.Done = true in the HandleFinalResponse function from before Claude stream processing to after Claude response processing. No functional logic or error handling modifications occur; the control flow structure remains unchanged.

Changes

Cohort / File(s) Summary
Claude Completion Flag Timing
relay/channel/openai/helper.go
Moved info.ClaudeConvertInfo.Done = true assignment from before to after Claude stream response processing in HandleFinalResponse

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Suggested reviewers

  • Calcium-Ion

Poem

🐰 A flag moves through the stream so fine,
From before to after, a careful design,
The rabbit hops through logic clear,
Claude's conversion flags now right appear! ✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title references 'glm 4.7 finish reason' but the actual change involves moving a flag assignment in HandleFinalResponse for Claude stream processing, not GLM-related fixes. Update the title to accurately reflect the actual change, such as 'fix: move Claude conversion done flag to after stream processing' to match the code modification.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 923dfbe and 9b82344.

📒 Files selected for processing (1)
  • relay/channel/openai/helper.go
🧰 Additional context used
🧬 Code graph analysis (1)
relay/channel/openai/helper.go (2)
relay/common/relay_info.go (1)
  • ClaudeConvertInfo (34-40)
relay/helper/common.go (1)
  • Done (120-122)
🔇 Additional comments (1)
relay/channel/openai/helper.go (1)

217-223: Fix correctly addresses premature stream termination by setting Done flag after response processing.

The placement of info.ClaudeConvertInfo.Done = true at line 223 (after the Claude response conversion loop) prevents the stream from terminating before responses are sent. The function StreamResponseOpenAI2Claude at line 220 has a guard that checks if info.ClaudeConvertInfo.Done { return nil }, so setting Done = true before this call would have caused the conversion to fail and no responses to be delivered.

The current placement ensures responses are converted and sent via ClaudeData before marking the conversion as complete, resolving the GLM series premature termination issue.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Calcium-Ion
Calcium-Ion merged commit 8063897 into QuantumNous:main Dec 29, 2025
ennnnny pushed a commit to ennnnny/new-api that referenced this pull request Mar 17, 2026
salem-2007 added a commit to salem-2007/new-api that referenced this pull request Sep 10, 2026
junjundesk pushed a commit to junjundesk/new-api that referenced this pull request Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants