Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. WalkthroughText quota settlement skips estimated prompt tokens for abnormal streaming responses without upstream usage, records the skipped billing reason, and retains estimation for normally completed streams. Tests cover both outcomes. ChangesText quota billing
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The change narrowly adjusts billing for abnormal streams without upstream usage while preserving normal and usage-backed paths; no actionable merge-blocking risk remains beyond normal checks and review. Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Linked Issues checkExplanation The changes address issue
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@service/text_quota_test.go`:
- Around line 153-200: The added billing-usage tests depend on undefined DTO and
quota symbols, so they cannot compile in the current tree. Before retaining
these tests in
TestCalculateTextQuotaSummaryUsesClaudeBillingUsageBeforeTopLevelUsage and the
related Claude/Gemini/OpenAI cases, land or restore the prerequisite definitions
for Usage.BillingUsage, the dto.New*BillingUsage helpers, effectiveBillingUsage,
and dto.BillingUsageSemantic* constants; otherwise remove the dependent tests
until that stack layer is available.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2e121a73-f549-4120-a7a2-9e4a04f9bb50
📒 Files selected for processing (1)
service/text_quota_test.go
There was a problem hiding this comment.
🧹 Nitpick comments (1)
service/text_quota_abnormal_stream_test.go (1)
39-40: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse
assertfor non-fatal value checks.These assertions validate expected values and should use
assert.Zero/assert.Equal; reserverequirefor setup and fatal preconditions.As per coding guidelines, new or substantially rewritten Go backend tests must use
requirefor setup and fatal assertions andassertfor non-fatal value checks.Also applies to: 67-68
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@service/text_quota_abnormal_stream_test.go` around lines 39 - 40, Replace the non-fatal require.Zero checks for summary.TotalTokens and summary.Quota, including the corresponding assertions at the additionally affected lines, with assert.Zero. Keep require for setup and fatal preconditions only.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@service/text_quota_abnormal_stream_test.go`:
- Around line 39-40: Replace the non-fatal require.Zero checks for
summary.TotalTokens and summary.Quota, including the corresponding assertions at
the additionally affected lines, with assert.Zero. Keep require for setup and
fatal preconditions only.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 98cc2e33-14dc-40fc-915f-b4b14a7a17b3
📒 Files selected for processing (1)
service/text_quota_abnormal_stream_test.go
|
已将分支冲突处理完毕并补充异常流回归测试;GitHub 当前显示 MERGEABLE,CodeRabbit 已通过。PR 仍处于 draft,但当前作者账号没有 |
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
已 rebase 到最新 新 head 上 CI 全绿: 范围未变,仍只是 #4168:异常流(没有 usage 的流式响应)不再按预估 token 计费。 @Calcium-Ion @seefs001 麻烦 review。同上,这个 PR 还是 draft 且我的账号没有 |
Important
📝 变更描述 / Description
当流式请求异常结束(client_gone/timeout 等)且上游未返回 usage 时,不再使用估算 prompt tokens 结算扣费。正常结束或上游提供 usage 的路径保持不变,避免误伤。
This PR was AI-assisted and manually reviewed before submission.
🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。📸 运行证明 / Proof of Work
Summary by CodeRabbit
Bug Fixes
Tests