Skip to content

Conversation

@nsrCodes
Copy link
Collaborator

@nsrCodes nsrCodes commented Nov 13, 2025

Reverts #214

was causing issues with hitting localhost. Another potential fix has been raised here (with the explanation of the issue)
#227

Summary by CodeRabbit

  • Refactor
    • Simplified internal proxy configuration logic to streamline request handling and reduce code complexity.

@linear
Copy link

linear bot commented Nov 13, 2025

@coderabbitai
Copy link

coderabbitai bot commented Nov 13, 2025

Walkthrough

The PR refactors src/main/actions/getProxiedAxios.ts by removing the enableRQProxy parameter from createAxiosInstance and consolidating the function to always configure both httpAgent and httpsAgent proxies without conditional branching. The function signature is simplified to accept only config and an optional addStoredCookies parameter. The createOrUpdateAxiosInstance function is updated to invoke the new signature twice—once without stored cookies and once with them—to maintain per-call session cookie distinction.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Verify that removing the enableRQProxy conditional logic does not break existing proxy behavior or introduce unexpected always-on proxy configuration
  • Confirm all call sites within createOrUpdateAxiosInstance have been updated correctly to match the new function signature
  • Validate that the session cookie distinction via the addStoredCookies flag functions as intended without the removed parameter

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly indicates this is a revert of a previous change, directly matching the code modifications that remove the enableRQProxy parameter and restore proxy configuration. The title is specific and accurately represents the main change.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch revert-214-stop-api-client-request-to-be-proxied

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 and usage tips.

@nsrCodes nsrCodes marked this pull request as ready for review November 13, 2025 11:31
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/main/actions/getProxiedAxios.ts (1)

65-67: Consider improving error visibility.

The try-catch block logs errors but otherwise silently continues. If proxy setup fails, the application will fall back to the default axios instance (line 80-81), which might not be obvious to operators or developers debugging proxy-related issues.

Consider adding more prominent error handling, such as throwing the error in development mode or emitting a warning that's more visible than a console.error.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c6cacd5 and f0038b2.

📒 Files selected for processing (1)
  • src/main/actions/getProxiedAxios.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/main/actions/getProxiedAxios.ts (1)
src/main/actions/makeApiClientRequest.js (1)
  • axios (70-70)
🔇 Additional comments (2)
src/main/actions/getProxiedAxios.ts (2)

63-64: LGTM!

The function calls correctly match the updated signature. The distinction between the two instances (with and without session cookies) is properly maintained via the addStoredCookies parameter.


33-36: Signature change verified — all call sites correctly updated.

The verification confirms that createAxiosInstance is only called within the same file at lines 63 and 64, and both call sites correctly use the new signature. There are no other callers in the codebase, so the removal of the enableRQProxy parameter poses no compatibility risk.

Comment on lines +37 to +45
const instance = axios.create({
proxy: false,
httpAgent: new HttpsProxyAgent(`http://${config.ip}:${config.port}`),
httpsAgent: new PatchedHttpsProxyAgent({
host: config.ip,
port: config.port,
ca: readFileSync(config.rootCertPath),
}),
});
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify HttpsProxyAgent usage for HTTP traffic.

Line 39 uses HttpsProxyAgent for the httpAgent property, which handles HTTP requests. While HttpsProxyAgent might support HTTP, this configuration seems unusual. Typically, HTTP and HTTPS agents are different types.

Verify that HttpsProxyAgent correctly handles plain HTTP requests, or consider whether a dedicated HTTP proxy agent should be used instead.


🌐 Web query:

Does HttpsProxyAgent from https-proxy-agent support HTTP requests or only HTTPS?

💡 Result:

HttpsProxyAgent is an http.Agent that issues an HTTP CONNECT to the proxy and is intended for proxying HTTPS (and other CONNECT-using protocols like WebSocket). It’s designed for use with Node's https module — for plain HTTP requests you should use HttpProxyAgent (or proxy-agent which selects the right agent). [1][2]

Sources:
[1] https-proxy-agent README (npm).
[2] proxy-agent README / mapping (Skypack).


Replace HttpsProxyAgent with HttpProxyAgent for HTTP traffic at line 39.

HttpsProxyAgent is designed for proxying HTTPS (and other CONNECT-using protocols like WebSocket). For plain HTTP requests, use HttpProxyAgent instead.

Update line 39 from:

httpAgent: new HttpsProxyAgent(`http://${config.ip}:${config.port}`),

to:

httpAgent: new HttpProxyAgent(`http://${config.ip}:${config.port}`),

Ensure HttpProxyAgent is imported from the https-proxy-agent package.

🤖 Prompt for AI Agents
In src/main/actions/getProxiedAxios.ts around lines 37 to 45, the httpAgent is
incorrectly constructed with HttpsProxyAgent for plain HTTP traffic; replace the
HttpsProxyAgent instantiation at line 39 with HttpProxyAgent (i.e., use new
HttpProxyAgent(`http://${config.ip}:${config.port}`)) and ensure HttpProxyAgent
is imported from the https-proxy-agent package instead of HttpsProxyAgent; keep
the httpsAgent using PatchedHttpsProxyAgent and other config unchanged.

@nsrCodes nsrCodes merged commit aea50aa into master Nov 13, 2025
2 checks passed
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.

3 participants