Fix transport failure account locks - #24
Conversation
|
Warning Review limit reached
Next review available in: 54 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe router adds configurable retries for network transport failures. It preserves network causes in logs, avoids cooldown locks for transport errors, supports abort handling, and advances fallback routes after retry exhaustion. Tests cover recovery and fallback behavior. The package version is 0.5.11. ChangesTransport retry and fallback
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant Router
participant Provider
participant Logger
participant Fallback
Client->>Router: submit request
Router->>Provider: attempt provider request
Provider-->>Router: transport failure
Router->>Logger: log scheduled retry
Router->>Provider: retry request
Provider-->>Router: retry exhausted
Router->>Fallback: select next route member
Fallback-->>Router: provider response
Router-->>Client: return result
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 `@src/lib/router.js`:
- Around line 751-764: Update transportErrorMessage and the failed-attempt
handling around recordEvent to prevent nested transport cause messages from
reaching API clients. Keep detailed causes available only through appropriately
redacted logging, while storing and returning a generic or explicitly redacted
transport error for the attempts summary and terminal response.
🪄 Autofix
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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: c3d89fb3-fdc4-4b19-98f3-d8323cdbad26
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (4)
CHANGELOG.mdpackage.jsonsrc/lib/router.jstests/router-fallback.test.js
| function transportErrorMessage(error) { | ||
| const parts = []; | ||
| const seen = new Set(); | ||
| let current = error; | ||
| for (let depth = 0; current && depth < 4; depth += 1) { | ||
| if (seen.has(current)) break; | ||
| seen.add(current); | ||
| const code = typeof current.code === "string" ? current.code.trim() : ""; | ||
| const message = String(current.message || current).trim(); | ||
| const detail = code && !message.includes(code) ? `${code}: ${message}` : message; | ||
| if (detail && !parts.includes(detail)) parts.push(detail); | ||
| current = current.cause; | ||
| } | ||
| return parts.join("; ") || "Upstream connection failed"; |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Do not return raw nested transport causes to API clients.
Lines 759-764 copy arbitrary cause.message values without redaction. Lines 1239-1250 propagate this value into failed attempts. The terminal response includes the attempts summary.
appLogger redacts log metadata, but recordEvent and the API response do not. A nested cause can contain a provider URL, credentials, or request data. Keep the detailed cause in logs. Store and return a generic or redacted transport error instead.
🤖 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 `@src/lib/router.js` around lines 751 - 764, Update transportErrorMessage and
the failed-attempt handling around recordEvent to prevent nested transport cause
messages from reaching API clients. Keep detailed causes available only through
appropriately redacted logging, while storing and returning a generic or
explicitly redacted transport error for the attempts summary and terminal
response.
Summary
Validation
Summary by CodeRabbit
New Features
Bug Fixes
Chores