Skip to content

🪶 fix: Time Out Client Refresh and Trim Lodash Imports - #17467

Open
berry-13 wants to merge 5 commits into
devfrom
berry-13/devin-perf-client
Open

berry-13 wants to merge 5 commits into
devfrom
berry-13/devin-perf-client

Conversation

@berry-13

Copy link
Copy Markdown
Collaborator

Summary

Fixes the client hygiene findings from the 2026-10-19 Devin performance scan. The token refresh request had no timeout, and every API call waits on that shared promise, so one hung refresh froze the app until reload; it now times out after 30 seconds and falls into the existing redirect-to-login path. The TTS stream fetch, SharePoint downloads and the CloudFront cookie refresh get abort timeouts for the same reason.

Smaller fixes: lodash is imported per function in AuthContext, utils/conversation, useChatFunctions, ask/turn and openidRoleSync instead of pulling the whole library into the entry chunk; the Lia mascot reads the caret position at most once per animation frame; useWakeLock releases a lock that resolves after the effect was cleaned up; the SharePoint picker removes its window and port listeners on unmount; title-generation module state is cleared on logout; and multi-file project uploads run three at a time instead of one by one, keeping per-file error reporting.

Type of change

  • Bug fix
  • Performance improvement

Testing

Tested environments/configuration: jsdom unit tests.

Automated tests:

  • client jest over src/data-provider, src/hooks, src/components/Projects, src/components/Lia, src/components/Chat/Input, src/utils: pass. Added tests for clearTitleGenerationState and its logout call; the Projects spec now expects overlapping uploads.
  • packages/client cloudfront (8/8) and packages/data-provider request (39/39): pass.
  • eslint, prettier, sort-imports clean; tsc --noEmit in client, packages/data-provider and packages/client clean.

Screenshots / recordings

No user-facing change.

Risk / compatibility

A refresh slower than 30 seconds now sends the user to login instead of hanging. Project uploads can finish in a different order than selected. The timeouts (30 s refresh, 60 s TTS headers, 5 min SharePoint download, 15 s CloudFront refresh) are fixed client constants.

Checklist

  • I reviewed my own changes
  • Relevant tests have been added or updated
  • Existing relevant tests pass
  • The change does not introduce new warnings or errors

Copilot AI balanced review requested due to automatic review settings October 26, 2026 17:01
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T18:30:48.722946Z f6ad195 New commits
🔒 Security Review ✅ Completed 2026-10-26T17:04:02.193476Z 9fbec6d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9fbec6d34a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/data-provider/src/request.ts Outdated
Comment on lines +89 to +92
const REFRESH_TOKEN_TIMEOUT_MS = 30_000;

const refreshToken = (retry?: boolean): Promise<t.TRefreshTokenResponse | undefined> =>
_post(endpoints.refreshToken(retry));
_post(endpoints.refreshToken(retry), undefined, { timeout: REFRESH_TOKEN_TIMEOUT_MS });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Expose the new client deadlines through configuration

For deployments where token refresh legitimately takes more than 30 seconds, this unconditional deadline now triggers auth recovery failure and redirects users to login, with no operator override. The new TTS, SharePoint, and CloudFront deadlines likewise impose fixed limits without configuration fields. AGENTS.md explicitly requires newly introduced timeouts and limits to be configurable through configSchema and librechat.yaml; explaining why a timeout is needed does not explain why its duration must be fixed. Add configuration fields and pass the resolved budgets to these clients so operators can accommodate their infrastructure without rebuilding.

AGENTS.md reference: AGENTS.md:L91-L93

Useful? React with 👍 / 👎.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants