Skip to content

Fix transport failure account locks - #24

Merged
gitcommit90 merged 2 commits into
mainfrom
fix/transport-failure-account-lock
Aug 12, 2026
Merged

Fix transport failure account locks#24
gitcommit90 merged 2 commits into
mainfrom
fix/transport-failure-account-lock

Conversation

@gitcommit90

@gitcommit90 gitcommit90 commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • retry thrown connection failures twice at ten-second intervals
  • preserve nested network error causes in retry and terminal logs
  • never persist OAuth account/model locks for local transport failures
  • advance route fallback after retries are exhausted

Validation

  • npm test (321 passing)
  • focused router fallback suite (41 passing)
  • git diff --check

Summary by CodeRabbit

  • New Features

    • Added automatic retries for temporary network failures.
    • Added fallback to alternate routes when retries are exhausted.
    • Added logging for scheduled retries and network-related failures.
    • Aborted requests now stop retrying and report client disconnection.
  • Bug Fixes

    • Prevented temporary network failures from incorrectly locking provider accounts.
    • Preserved retry information during route fallback.
  • Chores

    • Updated the release version to 0.5.11 and refreshed changelog links.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@gitcommit90, you've reached your PR review limit, so we couldn't start this review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 640a50f5-1b42-4e9d-afc5-707e74550dbf

📥 Commits

Reviewing files that changed from the base of the PR and between 6469f07 and 067ab29.

📒 Files selected for processing (2)
  • src/lib/router.js
  • tests/router-fallback.test.js
📝 Walkthrough

Walkthrough

The 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.

Changes

Transport retry and fallback

Layer / File(s) Summary
Retry configuration and transport classification
src/lib/router.js
The router adds retry defaults, accepts retry options, classifies nested network errors, and supports abort-aware retry delays.
Retry execution and route fallback
src/lib/router.js, tests/router-fallback.test.js
Provider attempts retry transport failures and log scheduled retries. Transport failures do not create cooldown locks. Exhausted retries advance to the next route member. Tests cover recovery and fallback.
Release metadata
package.json, CHANGELOG.md
The package version changes to 0.5.11. The changelog records the retry, logging, fallback, and OAuth lock-handling changes and updates comparison links.

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
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes the summary and validation results but omits required type, release notes, version, verification, and post-merge sections. Complete the repository template, including change type, release notes, version details, verification checkboxes, and post-merge items.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main fix: preventing account locks caused by transport failures.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/transport-failure-account-lock

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 78c300a and 6469f07.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • CHANGELOG.md
  • package.json
  • src/lib/router.js
  • tests/router-fallback.test.js

Comment thread src/lib/router.js
Comment on lines +751 to +764
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";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 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.

@gitcommit90
gitcommit90 merged commit 1428e3e into main Aug 12, 2026
2 checks passed
@gitcommit90
gitcommit90 deleted the fix/transport-failure-account-lock branch August 12, 2026 03:48
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.

1 participant