Skip to content

Fix/studio colab button message: Add fallback message for Colab Studio button when proxy URL fails#4866

Merged
shimmyshimmer merged 3 commits into
unslothai:mainfrom
LeoBorcherding:fix/studio-colab-button-message
Apr 6, 2026
Merged

Fix/studio colab button message: Add fallback message for Colab Studio button when proxy URL fails#4866
shimmyshimmer merged 3 commits into
unslothai:mainfrom
LeoBorcherding:fix/studio-colab-button-message

Conversation

@LeoBorcherding
Copy link
Copy Markdown
Contributor

Problem

In some cases, the "Open Unsloth Studio" button in the Colab displays localhost:8888 instead of the proper proxy URL (https://8000-gpu-...). This appears to be a timing issue where the Colab kernel isn't ready when the URL is requested, causing it to fall back to localhost, which doesn't work in the browser.

Solution

Added a clear fallback message below the button informing users:

"If the link doesn't work, you can scroll down to view the UI generated directly in Colab."

This helps users understand what to do if they encounter the localhost issue, since the iframe-based UI below the button always works correctly.

Changes

  • Added fallback message in studio/backend/colab.py
  • Styled with dark grey color (#333333) and bold text for visibility
  • Positioned between the button and the proxy URL

Testing

Tested in Colab by changing the setup cell to use my fork, verified that the fallback message appears and is easy to read.

image

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Colab link display by adding a fallback message and adjusting text styling for better visibility. Feedback was provided regarding trailing whitespace and the use of standard font weights to ensure cross-platform consistency.

Comment thread studio/backend/colab.py Outdated
Comment on lines 69 to 74
<p style="color: #333333; margin: 12px 0 0 0; font-size: 14px; font-weight: 600;">
If the link doesn't work, you can scroll down to view the UI generated directly in Colab.
</p>
<p style="color: #333333; margin: 16px 0 0 0; font-size: 13px; font-family: monospace; font-weight: 600;">
{short_url}
</p>
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.

medium

There is trailing whitespace on line 69. Additionally, while the PR description mentions "bold text", the code uses font-weight: 600 (Semi-Bold). Using bold or 700 is more standard and ensures better cross-platform consistency, especially for monospace fonts which often lack intermediate weights. Consider also making this fallback message conditional (e.g., only showing it if "localhost" in url) to keep the UI clean when the proxy URL is correctly resolved.

Suggested change
<p style="color: #333333; margin: 12px 0 0 0; font-size: 14px; font-weight: 600;">
If the link doesn't work, you can scroll down to view the UI generated directly in Colab.
</p>
<p style="color: #333333; margin: 16px 0 0 0; font-size: 13px; font-family: monospace; font-weight: 600;">
{short_url}
</p>
<p style="color: #333333; margin: 12px 0 0 0; font-size: 14px; font-weight: bold;">
If the link doesn't work, you can scroll down to view the UI generated directly in Colab.
</p>
<p style="color: #333333; margin: 16px 0 0 0; font-size: 13px; font-family: monospace; font-weight: bold;">
{short_url}
</p>
References
  1. PEP 8: Avoid trailing whitespace anywhere. (link)

Copy link
Copy Markdown
Contributor Author

@LeoBorcherding LeoBorcherding Apr 6, 2026

Choose a reason for hiding this comment

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

added fix for:

  1. Trailing whitespace: Line 69 does have trailing spaces after 600;">
  2. Font weight: font-weight: bold (or 700) is more standard than 600, especially for monospace fonts

decided against adding:

  1. Conditional display: Only show the message when the URL is actually localhost (when the problem exists), keeps the UI cleaner when everything works

@LeoBorcherding LeoBorcherding force-pushed the fix/studio-colab-button-message branch from 89f0447 to be7e8ee Compare April 6, 2026 04:30
@LeoBorcherding
Copy link
Copy Markdown
Contributor Author

Tested with latest fix from gemini

image

@LeoBorcherding LeoBorcherding marked this pull request as ready for review April 6, 2026 04:56
@shimmyshimmer shimmyshimmer merged commit 6896598 into unslothai:main Apr 6, 2026
1 check passed
@LeoBorcherding LeoBorcherding deleted the fix/studio-colab-button-message branch April 6, 2026 05:01
shibizhao pushed a commit to shibizhao/unsloth-npu that referenced this pull request Apr 7, 2026
…o button when proxy URL fails (unslothai#4866)

* Add fallback message for Colab Studio button when localhost link doesn't work

* Make fallback message darker grey for better readability

* Make fallback message bold for better visibility

---------

Co-authored-by: LeoBorcherding <LeoBorcherding@users.noreply.github.com>
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.

2 participants