Skip to content

Comments

Custom endpoint hotfix#1364

Merged
duckduckhero merged 3 commits intomainfrom
custom-endpoint-hotfix
Aug 19, 2025
Merged

Custom endpoint hotfix#1364
duckduckhero merged 3 commits intomainfrom
custom-endpoint-hotfix

Conversation

@duckduckhero
Copy link
Contributor

@duckduckhero duckduckhero commented Aug 19, 2025

Summary by cubic

Fixes unintended switching between HyprCloud and Custom endpoints and makes custom setup explicit and user-driven. Also prevents the HyprCloud URL from being saved as a Custom endpoint and clarifies when the Autonomy Selector is usable.

  • Bug Fixes

    • Only auto-configure a provider when the user opens its accordion (or Custom is already enabled); disable HyprCloud only after a valid config is entered.
    • Allow opening/switching provider accordions while HyprCloud is active without auto-enabling Custom; reset user intent when closing/switching.
    • Block saving https://pro.hyprnote.com under “Others” and clear it if already stored.
    • Removed legacy provider migration logic to avoid unexpected state changes.
  • UI Improvements

    • Autonomy Selector is disabled unless a Custom endpoint is active, with a short helper message.
    • Copy tweaks and locale updates (en, ko).

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 19, 2025

📝 Walkthrough

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch custom-endpoint-hotfix

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limits.

🔭 Outside diff range comments (3)
apps/desktop/src/components/settings/components/ai/llm-custom-view.tsx (2)

201-208: Avoid watch-in-deps; switch to useWatch to prevent subscription thrash and re-render loops

Calling customForm.watch("...") in a dependency array creates implicit subscriptions on every render and can cascade into excessive effect executions. Replace with useWatch, which provides stable values and predictable updates.

Apply this diff:

-  // Watch for form changes
-  useEffect(() => {
-    const apiBase = customForm.watch("api_base");
-    const apiKey = customForm.watch("api_key");
-
-    updateDebouncedValues(apiBase || "", apiKey || "");
-  }, [customForm.watch("api_base"), customForm.watch("api_key"), updateDebouncedValues]);
+  // Watch for form changes (debounced)
+  const apiBase = useWatch({ control: customForm.control, name: "api_base" });
+  const apiKey = useWatch({ control: customForm.control, name: "api_key" });
+  useEffect(() => {
+    updateDebouncedValues(apiBase || "", apiKey || "");
+  }, [apiBase, apiKey, updateDebouncedValues]);

Add this import at the top of the file:

import { useWatch } from "react-hook-form";

476-486: React SVG prop name typo: use fillRule (camelCase), not fill-rule

In TSX, SVG attributes use camelCase. fill-rule will trigger a type error and may not behave as expected.

Apply this diff:

-                    fill-rule="evenodd"
+                    fillRule="evenodd"
apps/desktop/src/components/settings/views/ai-llm.tsx (1)

363-387: Effect reads customLLMEnabled.data but doesn’t subscribe to it

The guard “Don’t open accordion if custom LLM is disabled” won’t re-run when customLLMEnabled.data changes, potentially leaving an accordion open while disabled. Add it to the deps array.

Apply this diff:

-  }, [providerSourceQuery.data, hyprCloudEnabled.data, setOpenAccordion]);
+  }, [providerSourceQuery.data, hyprCloudEnabled.data, customLLMEnabled.data, setOpenAccordion]);
🧹 Nitpick comments (2)
apps/desktop/src/components/settings/components/ai/llm-custom-view.tsx (2)

137-143: Strengthen HyprCloud exclusion for “others”

Equality check misses variants like trailing paths or /v1. Prefer startsWith to reliably guard against persisting HyprCloud as “others”.

Apply this diff:

-        (userOpenedAccordion === "others" || customLLMEnabled.data)
-        && values.api_base && values.api_base !== "https://pro.hyprnote.com" && values.model
+        (userOpenedAccordion === "others" || customLLMEnabled.data)
+        && values.api_base && !values.api_base.startsWith("https://pro.hyprnote.com") && values.model

142-143: Silence debug logs in production

Keep noisy logs out of production builds. Gate them to dev.

Apply these diffs:

-          console.log("we are now setting the 'others' endpoint");
+          if (import.meta.env.DEV) console.log("Setting 'others' endpoint");
-      console.log("onquery");
-      console.log(url.toString());
+      if (import.meta.env.DEV) {
+        console.log("[others-direct-models] onQuery", url.toString());
+      }

Also applies to: 218-220

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f0a84f7 and 02f5996.

📒 Files selected for processing (4)
  • apps/desktop/src/components/settings/components/ai/llm-custom-view.tsx (14 hunks)
  • apps/desktop/src/components/settings/views/ai-llm.tsx (6 hunks)
  • apps/desktop/src/locales/en/messages.po (19 hunks)
  • apps/desktop/src/locales/ko/messages.po (19 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,ts,tsx,rs}

⚙️ CodeRabbit Configuration File

**/*.{js,ts,tsx,rs}: 1. No error handling.
2. No unused imports, variables, or functions.
3. For comments, keep it minimal. It should be about "Why", not "What".

Files:

  • apps/desktop/src/components/settings/components/ai/llm-custom-view.tsx
  • apps/desktop/src/components/settings/views/ai-llm.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: ci (windows, windows-latest)
  • GitHub Check: ci (macos, macos-latest)
🔇 Additional comments (7)
apps/desktop/src/locales/en/messages.po (2)

1170-1173: New gating copy reads well and aligns with UI behavior

The added string for autonomy gating matches the new disabled state behavior in ai-llm.tsx. No issues.


774-777: Helpful instruction for API Base URL

The additional description for the custom endpoint base URL improves clarity. Consistent with validation rules in ai-llm.tsx.

apps/desktop/src/components/settings/components/ai/llm-custom-view.tsx (1)

65-67: User-intent gating for auto-config is a solid UX improvement

Tracking which accordion the user opened prevents unintended provider switches. This fixes accidental auto-configuration reported earlier.

apps/desktop/src/locales/ko/messages.po (1)

1170-1173: Missing translations for newly introduced/relocated keys

Several new keys have empty msgstr (e.g., autonomy gating, provider labels, OpenRouter copy). If shipping now, Lingui will fall back to English. Confirm this is acceptable for this hotfix; otherwise, add Korean strings before merge.

Would you like me to supply Korean translations for the new keys to avoid fallback?

Also applies to: 259-262, 327-330, 851-854, 1213-1216, 1360-1362, 992-995

apps/desktop/src/components/settings/views/ai-llm.tsx (3)

391-409: Default-to-“others” fallback is consistent and avoids persisting HyprCloud URL

Opening “others” when custom is enabled and nothing is set, plus clearing the HyprCloud URL from others, matches the new gating and avoids misconfiguration. Looks good.


528-537: Prevent leaking HyprCloud URL into “others” form

Skipping setting api_base when it equals the HyprCloud URL is correct and aligns with the custom-view logic.


681-776: Autonomy UI gating and disabled styling are coherent

The selector now always renders but is clearly disabled until a Custom Endpoint is configured, with precise helper text. Behavior and analytics calls are gated correctly by the disabled state.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 4 files

React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.

@duckduckhero duckduckhero merged commit 375368e into main Aug 19, 2025
16 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Sep 3, 2025
@coderabbitai coderabbitai bot mentioned this pull request Oct 21, 2025
@ComputelessComputer ComputelessComputer deleted the custom-endpoint-hotfix branch December 14, 2025 15:21
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