fix(captain): prevent clamp ArgumentError on inbox creation#242
fix(captain): prevent clamp ArgumentError on inbox creation#242gabrieljablonski merged 1 commit intomainfrom
Conversation
…ative When creating an inbox, `usage_limits` eagerly computes captain limits even though only the `:inboxes` value is needed. If `total_count` in `get_captain_limits` resolves to a negative number, `clamp(0, negative)` raises `ArgumentError: min argument must be less than or equal to max argument`, causing a 500 on inbox creation. Ensure `total_count` is floored at 0 so the clamp range is always valid. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA single-line modification to the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Summary
ArgumentError: min argument must be less than or equal to max argument) when captain limits resolve to a negativetotal_count.usage_limitseagerly computes captain limits (even when only:inboxesis needed). Inget_captain_limits,total_count.clamp(0, total_count)fails whentotal_count < 0becausemin (0) > max (negative).total_countat 0 with[..., 0].maxso the clamp range is always valid.Test plan
limits: { "inboxes" => 20 }and no captain-specific limits — should succeed without 500🤖 Generated with Claude Code
This change is
Summary by CodeRabbit
Bug Fixes