-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Studio: clarify tool permission controls #7181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| #!/usr/bin/env bash | ||
| # SPDX-License-Identifier: AGPL-3.0-only | ||
| # Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| port="${1:?usage: $0 PORT BROWSER [CHANNEL]}" | ||
| browser="${2:?usage: $0 PORT BROWSER [CHANNEL]}" | ||
| channel="${3:-}" | ||
| slug="$browser${channel:+-$channel}" | ||
| artifact_dir="logs/playwright-permissions-$slug" | ||
| server_log="logs/studio-permissions-$slug.log" | ||
| studio_home="${UNSLOTH_STUDIO_HOME:-$HOME/.unsloth/studio}" | ||
| frontend_args=() | ||
| if [ -n "${STUDIO_PERMISSION_FRONTEND:-}" ]; then | ||
| frontend_args=(-f "$STUDIO_PERMISSION_FRONTEND") | ||
| fi | ||
|
|
||
| mkdir -p "$artifact_dir" | ||
| unsloth studio reset-password | ||
| UNSLOTH_API_ONLY=1 unsloth studio -H 127.0.0.1 -p "$port" "${frontend_args[@]}" \ | ||
| >"$server_log" 2>&1 & | ||
| studio_pid=$! | ||
|
|
||
| cleanup() { | ||
| kill "$studio_pid" 2>/dev/null || true | ||
| wait "$studio_pid" 2>/dev/null || true | ||
| } | ||
| trap cleanup EXIT | ||
|
|
||
| healthy=0 | ||
| for _ in $(seq 1 180); do | ||
| if curl -fs "http://127.0.0.1:$port/api/health" >/dev/null; then | ||
| healthy=1 | ||
| break | ||
| fi | ||
| if ! kill -0 "$studio_pid" 2>/dev/null; then | ||
| tail -100 "$server_log" || true | ||
| exit 1 | ||
| fi | ||
| sleep 1 | ||
| done | ||
| if [ "$healthy" -ne 1 ]; then | ||
| tail -100 "$server_log" || true | ||
| exit 1 | ||
| fi | ||
|
|
||
| old_password=$(cat "$studio_home/auth/.bootstrap_password") | ||
| new_password="CIPerm-$(python -c 'import secrets; print(secrets.token_urlsafe(16))')" | ||
| if [ "${GITHUB_ACTIONS:-}" = "true" ]; then | ||
| echo "::add-mask::$old_password" | ||
| echo "::add-mask::$new_password" | ||
| fi | ||
|
|
||
| export BASE_URL="http://127.0.0.1:$port" | ||
| export STUDIO_OLD_PW="$old_password" | ||
| export STUDIO_NEW_PW="$new_password" | ||
| export STUDIO_UI_STRICT=1 | ||
| export STUDIO_UI_PERMISSION_ONLY=1 | ||
| export STUDIO_UI_WALL_TIMEOUT_S=240 | ||
| export STUDIO_PLAYWRIGHT_BROWSER="$browser" | ||
| export PW_ART_DIR="$artifact_dir" | ||
| if [ -n "$channel" ]; then | ||
| export STUDIO_PLAYWRIGHT_CHANNEL="$channel" | ||
| else | ||
| unset STUDIO_PLAYWRIGHT_CHANNEL || true | ||
| fi | ||
|
|
||
| python tests/studio/playwright_chat_ui.py |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -107,13 +107,10 @@ jobs: | |
| set -o pipefail | ||
| bash install.sh --local --no-torch 2>&1 | tee logs/install.log | ||
|
|
||
| - name: Install Playwright + Chromium | ||
| - name: Install Playwright browsers | ||
| run: | | ||
| pip install 'playwright>=1.45' | ||
| # --with-deps installs the OS-level runtime libs Chromium | ||
| # needs (libnss3, libxkbcommon, etc.). About 30 s on a | ||
| # warm runner. | ||
| python -m playwright install --with-deps chromium | ||
| python -m playwright install --with-deps chromium firefox webkit | ||
|
|
||
| - name: Reset auth + boot Studio | ||
| run: | | ||
|
|
@@ -182,6 +179,12 @@ jobs: | |
| kill "${STUDIO_PID}" 2>/dev/null || true | ||
| sleep 2 | ||
|
|
||
| - name: Cross-browser permission controls | ||
| run: | | ||
| bash .github/scripts/run-studio-permission-browser.sh 18893 firefox | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This new step depends on Useful? React with 👍 / 👎. |
||
| bash .github/scripts/run-studio-permission-browser.sh 18893 webkit | ||
| bash .github/scripts/run-studio-permission-browser.sh 18893 chromium chrome | ||
|
|
||
| # The chat UI test ends by clicking the Shutdown menuitem, which | ||
| # leaves the server dead. The extra UI test (Compare / Recipes / | ||
| # Export / Studio / Settings) needs a fresh Studio, so we boot a | ||
|
|
@@ -297,6 +300,8 @@ jobs: | |
| logs/install.log | ||
| logs/server-logs/ | ||
| logs/playwright | ||
| logs/playwright-permissions-* | ||
| logs/playwright_extra | ||
| logs/playwright_ime | ||
| logs/studio-permissions-*.log | ||
| retention-days: 7 | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1435,12 +1435,10 @@ const Composer: FC<{ | |||||||||||||||||||||||||||
| const mcpEnabledForChat = useChatRuntimeStore((s) => s.mcpEnabledForChat); | ||||||||||||||||||||||||||||
| const ragEnabled = useChatRuntimeStore((s) => s.ragEnabled); | ||||||||||||||||||||||||||||
| const permissionMode = useChatRuntimeStore((s) => s.permissionMode); | ||||||||||||||||||||||||||||
| // More than 4 pills: collapse to icons only. Search and Code always show; the | ||||||||||||||||||||||||||||
| // permission pill shows in every mode except "off" (it renders null there); | ||||||||||||||||||||||||||||
| // Images, RAG, Canvas and MCP are conditional. | ||||||||||||||||||||||||||||
| // More than 4 pills: collapse to icons only. Search, Code, and permissions | ||||||||||||||||||||||||||||
| // always show; Images, RAG, Canvas and MCP are conditional. | ||||||||||||||||||||||||||||
| const pillsCompact = | ||||||||||||||||||||||||||||
| 2 + | ||||||||||||||||||||||||||||
| (permissionMode !== "off" ? 1 : 0) + | ||||||||||||||||||||||||||||
| 3 + | ||||||||||||||||||||||||||||
| (ragEnabled ? 1 : 0) + | ||||||||||||||||||||||||||||
|
Comment on lines
+1438
to
1442
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||||||||||||||||||||||||
| (supportsBuiltinImageGeneration ? 1 : 0) + | ||||||||||||||||||||||||||||
| (artifactsEnabled ? 1 : 0) + | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this macos-14 job, the install step pins Playwright to
>=1.55,<1.58, but this new run launches the runner's branded Chrome viachannel='chrome'. Playwright 1.57's release notes list Google Chrome 139 as the tested stable channel, while the current GitHub macos-14 runner image lists Chrome 149, so this check can fail or become flaky from a browser/protocol mismatch; use the bundled Chromium here or update/unpin Playwright before adding a Chrome-channel run.Useful? React with 👍 / 👎.