Skip to content

studio: tell users when a canvas is blocked by the network access setting - #9894

Merged
mahiatlinux merged 21 commits into
unslothai:mainfrom
NilayYadav:studio-canvas-network-alert
Aug 28, 2026
Merged

mahiatlinux merged 21 commits into
unslothai:mainfrom
NilayYadav:studio-canvas-network-alert

Conversation

@NilayYadav

Copy link
Copy Markdown
Collaborator

When "Allow canvas network access" is off (the default), a canvas that loads anything from the internet, like a script from a CDN, shows up blank. The only hint was a small line at the bottom of the canvas, and it never mentioned that there is a setting for this. So it looked like the canvas was broken.

This change replaces that line with a clear message at the top of the canvas. It says network access is off, names the sites that were blocked, and offers three options: open the setting in Settings > Chat, allow it just for this canvas, or close the message.

Nothing about how canvases are blocked or allowed has changed. The setting, its default, and the backend are the same. Tests cover the new buttons, and the message was checked in Chrome, Firefox, and Safari engines, in light and dark mode, on narrow layouts, and in all supported languages.

@NilayYadav
NilayYadav force-pushed the studio-canvas-network-alert branch from 3b57510 to 64c56dd Compare August 27, 2026 21:48
@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: 64c56dd606

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

@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: 569c2242f6

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

@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: a0bffce81a

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

@NilayYadav

NilayYadav commented Aug 27, 2026 •

Copy link
Copy Markdown
Collaborator Author

UI evidence: what the canvas says when the setting blocks it

Canvas blocked notice, merge base vs head

Two isolated Studio installs, merge base vs head, driven through the same seeded thread. The canvas' only external resource is a Chart.js script from cdn.jsdelivr.net, and "Allow canvas network access" is left off (its default) on both sides, so the preview frame's CSP refuses that script and the frame reports exactly one block. No network is needed: the policy refuses the load before a request goes out.

  • BEFORE e745043b3 (the PR's merge base), AFTER acd820d4e (head)
  • Chromium, 1280x900, headless; each side has its own home, cache, port and SHA stamp
fact BEFORE AFTER
uses_alert_component false true
banner_title "" Canvas network access is off
banner_at_top false true
banner_centre_fraction 0.95 0.182
banner_button_count 1 3
banner_buttons Allow for this canvas Dismiss, Allow for this canvas, Open Settings
mentions_the_setting_by_name false true
banner_char_count 72 247

Controls that held identical on both sides, so the pair is comparable and the canvas did not simply break: blocked_host cdn.jsdelivr.net, banner_present true, banner_names_host true, has_allow_for_canvas_button true, network_setting_enabled false.

BEFORE the canvas answers with a thin strip along the bottom, "Blocked 1 external resource from cdn.jsdelivr.net." and a single "Allow for this canvas" button, with nothing to say that a setting is what turned this off. AFTER the notice moves to the top as a titled alert that names the setting and where to change it, alongside its two actions and a dismiss control.

The two actions follow the same pairing as the tool Allow / Always allow controls: the per-canvas grant leads as the primary button, and the setting that widens every canvas is the quieter outline beside it, so the emphasis never lands on the action that grants the most.

Full text captured on the head side:

Canvas network access is off
Blocked 1 external resource from cdn.jsdelivr.net. Turn on "Allow canvas network access" in Settings → Chat to let canvases load external resources, or allow it just for this canvas.

Full per-side facts and the pre-declared expectation: evidence/pr-9894/

CI note

Every check currently red on this PR is red on main at the same time, so none of it comes from this branch: workflow-trigger lint (tests/studio/playwright_tool_activity.py is not named by any workflow, added by #9803 and reproducible on a clean main checkout), Frontend build + bundle sanity (the ANSI smoke fails on Cannot access 'CHAT_GPU_MEMORY_MODE_KEY' before initialization, identical error and identical locator on main), plus Repo tests (CPU), (Python 3.13) and the three Core (HF=...) jobs.

@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

@mahiatlinux

Copy link
Copy Markdown
Contributor

repair report

before

The merge-base UI showed a 72-character strip at the bottom of the canvas with one action. It named the blocked host but did not explain the disabled setting.

after

The pushed head 79dcf2f6f keeps the titled alert at the top, names the setting, and provides Dismiss, Allow for this canvas, and Open Settings. The repair also makes the alert directional, avoids repeated assertive announcements, and restores focus to a visible named iframe.

verdict

The reported feature is valid. The review found seven defects in the PR behavior and four independent repository CI defects. All confirmed defects that can be fixed in this repository are fixed in 12 focused commits. GitHub Actions and the external unsloth_zoo matrix remain the final gates.

confirmed fixes

  • 000e9b2fa, 3df71c534: move focus to the iframe before Dismiss or Allow unmounts the active button.
  • 77dc881a9: preserve the real Settings opener and use the iframe only as a stable fallback; add a visible iframe focus outline.
  • ac34f159b: preserve the external opener across repeated Settings and archive opens.
  • 2d442eea2: stop new-chat and workspace shortcuts while the modal Settings dialog is open.
  • 615f275be: keep the changing blocked-resource count outside the assertive live region.
  • 9caafad3e: set document.documentElement.dir for Arabic and use logical alert alignment, spacing, and action positioning.
  • 82cd87073, d4ca5d3a9: remove startup feature-barrel cycles through the Hub token store, preset load config, model picker, and ToolGroup. This fixes the blank dev page errors for CHAT_GPU_MEMORY_MODE_KEY and ToolGroup.
  • 1b92743ae: update CPU fallback replay tests for the production three-value launch tuple.
  • ecf501e67: read the memory contract source explicitly as UTF-8.
  • 79dcf2f6f: run playwright_tool_activity.py in Frontend CI and add it to the workflow path filter.

verification

  • studio/backend/tests/test_gpu_init_crash_message.py: 144 passed.
  • studio/backend/tests/test_memory_contract.py: 18 passed.
  • Focused frontend tests for artifact policy, Settings deep opens, shortcuts, locale loading, and cycle safety passed.
  • Frontend typecheck passed after the final source changes.
  • Chromium Playwright 1.62 ran all 13 tool-activity scenes with problems: []. This reproduced the blank startup page before the cycle fixes and passed after them.
  • Workflow coverage guard: 7 passed.
  • No merge conflict was present against the current default branch when the review began.

regression risk

The focus work touches modal restoration and route shortcuts. Tests cover every open path and every route-changing root shortcut. The cycle repair replaces feature barrels with existing source modules and has a browser negative control. The added Chromium smoke costs about 45 seconds locally and reuses the browser already installed by Frontend CI.

compatibility

Local checks used macOS arm64, Node 24, Python 3.12, and Playwright Chromium. CI supplies Node 22 and Linux coverage. No NVIDIA GPU is present locally, so CUDA, Triton, quantization, and training checks were not run.

UI evidence

The isolated merge-base and original-head comparison remains available here: canvas network alert before and after. It uses Chromium at 1280x900 and the same seeded blocked Chart.js resource on both sides.

The accessibility fixes follow WAI-ARIA alert semantics, the ARIA alert example guidance, and W3C document direction guidance.

remaining gaps

GitHub Actions are still running. Firefox, WebKit, branded Chrome, branded Edge, and native Safari were not run locally. The Core failures observed on the old head came from the separately cloned unsloth_zoo@main; they will be rechecked on this head rather than hidden or weakened.

@mahiatlinux mahiatlinux changed the title Studio: tell users when a canvas is blocked by the network access setting studio: tell users when a canvas is blocked by the network access setting Aug 28, 2026
@mahiatlinux

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 79dcf2f6fa

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

@mahiatlinux

Copy link
Copy Markdown
Contributor

convergence follow-up

Fresh post-push review found one modal focus regression and one CI assertion mismatch on 79dcf2f6f.

  • Fullscreen Dismiss, Allow, and Settings fallback could focus the sandboxed iframe. The overlay focus trap intentionally excludes that iframe, so the next Tab inside its document could escape the dialog. Commit 2b9d2b35e now returns overlay actions to the existing Close canvas button, which stays inside the trap and has a visible focus border. Panel mode keeps the iframe fallback.
  • Frontend unit tests on Windows still expected the old inline route guard in three AST assertions. Production correctly uses routeShortcutEnabled to combine the auth-flow and Settings-dialog gates. Commit 591065339 updates the assertions while retaining the Train and Video capability checks.

Focused verification: 108 frontend tests passed, including the new fullscreen containment regression; application and test TypeScript checks passed. Head is 591065339de28479dbaaf80f468c3de830285304. GitHub Actions restarted on this head.

@mahiatlinux

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 591065339d

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

@mahiatlinux

Copy link
Copy Markdown
Contributor

ci follow-up

Two additional CI failures on 591065339 were confirmed and fixed on 73308f0fc.

  • Repo tests rejected setting document.documentElement.dir. Commit a78d50b0c keeps document language synchronization unchanged and scopes dir to the canvas alert. Arabic logical alignment works without changing Sonner or other third-party layout. The three root-direction contract tests and 58 focused locale/artifact tests pass.
  • The Chromium dismissal probe predated Studio: restore menu focus after outside dismissal #9772, which intentionally restores focus to the menu trigger. Four Space follow-ups correctly dismissed the menu, focused the trigger, reopened the menu, and never activated Delete, but the probe treated the safe reopen as failure. Commit 73308f0fc now asserts all four facts explicitly. The four previously failing browser cases pass locally.

The Core matrix failure remains in the separately cloned unsloth_zoo@main: its MLX shim lacks RMSNorm, _set_training_mode, and train. This branch does not modify or hide those external failures; the restarted matrix will test the latest zoo head.

@mahiatlinux

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 73308f0fcb

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

@mahiatlinux

Copy link
Copy Markdown
Contributor

@mahiatlinux
mahiatlinux merged commit da25d06 into unslothai:main Aug 28, 2026
35 of 38 checks passed
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.

3 participants