From e0062975a34b53f66cc49678062099c3636b99e6 Mon Sep 17 00:00:00 2001 From: Sidharth Menon <115056754+sidkmenon@users.noreply.github.com> Date: Wed, 18 Nov 2026 23:40:11 +0000 Subject: [PATCH 1/2] Add Niteshift environment configuration Setup installs the pinned Node 24, Code OSS native build headers, monorepo dependencies, a dev-fast Desktop build and Playwright Chromium. The desktop service launches Whiteboard Desktop on the sandbox display. run.sh gains DEV_FAST_REVIEW_NO_SANDBOX=1, which passes --no-sandbox so the dev Desktop can start as root in containers. Run-on: Niteshift Co-Authored-By: Claude Opus 5.5 --- .niteshift/services.yaml | 22 ++++++++++++ .niteshift/settings.yaml | 1 + .niteshift/setup | 57 ++++++++++++++++++++++++++++++ apps/review-desktop/scripts/run.sh | 5 +++ 4 files changed, 85 insertions(+) create mode 100644 .niteshift/services.yaml create mode 100644 .niteshift/settings.yaml create mode 100755 .niteshift/setup diff --git a/.niteshift/services.yaml b/.niteshift/services.yaml new file mode 100644 index 0000000000..8cc4201b6f --- /dev/null +++ b/.niteshift/services.yaml @@ -0,0 +1,22 @@ +services: + # Whiteboard Desktop (Electron). It has no web UI, so there is no port or preview: + # the window opens on the sandbox display (:99), which the user watches in the + # Agent preview. Drive its renderer with + # agent-browser --session app --cdp 9333 snapshot -i + # Restart it after changing Code OSS sources (rerun setup first to rebuild them); + # the Review server and canvas rebuild on launch when stale. + - name: desktop + command: | + export PATH=/opt/whiteboard-node/bin:$PATH + exec pnpm desktop:run + environment: + - name: DISPLAY + value: ":99" + - name: DEV_FAST_REVIEW_REMOTE_DEBUGGING_PORT + value: "9333" + - name: DEV_FAST_REVIEW_DISABLE_GPU + value: "1" + # The sandbox runs as root, which Electron only allows without its sandbox. + - name: DEV_FAST_REVIEW_NO_SANDBOX + value: "1" + restart: on-failure diff --git a/.niteshift/settings.yaml b/.niteshift/settings.yaml new file mode 100644 index 0000000000..b82551848c --- /dev/null +++ b/.niteshift/settings.yaml @@ -0,0 +1 @@ +version: 1 diff --git a/.niteshift/setup b/.niteshift/setup new file mode 100755 index 0000000000..50dfe3ea8b --- /dev/null +++ b/.niteshift/setup @@ -0,0 +1,57 @@ +#!/usr/bin/env bash +# Prepares a Whiteboard dev environment: the monorepo, the Code OSS fork, a dev-fast +# Desktop build, and Chromium for the canvas browser tests. Safe to rerun; every step +# skips work that is already current. +set -euo pipefail + +REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$REPO" + +# The monorepo wants Node 24 and the Code OSS fork pins an exact 24.x +# (apps/review-desktop/code-oss/.nvmrc); one install beside the sandbox's Node covers +# both. Niteshift's own tools keep using /usr/local/bin/node. +NODE_VERSION="$(tr -d '[:space:]' < apps/review-desktop/code-oss/.nvmrc)" +NODE_DIR="/opt/node-v$NODE_VERSION-linux-x64" +if [[ ! -x "$NODE_DIR/bin/node" ]]; then + echo "Installing Node $NODE_VERSION into $NODE_DIR" + tmp="$(mktemp -d)" + curl -fsSL --retry 3 "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" -o "$tmp/node.tar.xz" + sudo mkdir -p /opt + sudo tar -xJf "$tmp/node.tar.xz" -C /opt + rm -rf "$tmp" +fi +export PATH="$NODE_DIR/bin:$PATH" +# A stable path for services.yaml, so it does not repeat the version. +sudo ln -sfn "$NODE_DIR" /opt/whiteboard-node + +# pnpm comes from packageManager in package.json. +if [[ "$(pnpm -v 2>/dev/null || true)" != "$(node -p "require('./package.json').packageManager.split('@')[1]")" ]]; then + corepack enable pnpm +fi + +# Headers for the Code OSS native modules (same list as Whiteboard CI). +missing=() +for pkg in libx11-dev libxkbfile-dev libkrb5-dev libsecret-1-dev python3; do + dpkg -s "$pkg" >/dev/null 2>&1 || missing+=("$pkg") +done +if (( ${#missing[@]} )); then + sudo apt-get update + sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends "${missing[@]}" +fi + +# Fast when node_modules already matches the lockfile. +pnpm install --frozen-lockfile + +# Builds Code OSS (npm ci only when its lockfiles change, transpile without the +# typecheck, extensions, Electron) using freshness stamps under code-oss/.build. +REVIEW_DESKTOP_DEV_FAST=1 pnpm desktop:build + +# desktop:run rebuilds the Review server and canvas when stale; do it here so the +# desktop service launches quickly. +# shellcheck source=/dev/null +source apps/review-desktop/scripts/freshness.sh +rebuild_review_desktop_outputs "$REPO" "$REPO/packages/review" +node apps/review-desktop/scripts/copy-canvas.mjs + +# Chromium for `pnpm --filter @dev.fast/review-canvas test:browser` (Vitest Browser Mode). +pnpm --filter @dev.fast/review-canvas exec playwright install chromium diff --git a/apps/review-desktop/scripts/run.sh b/apps/review-desktop/scripts/run.sh index b1bbbc2dbd..8b513bff5a 100755 --- a/apps/review-desktop/scripts/run.sh +++ b/apps/review-desktop/scripts/run.sh @@ -98,6 +98,11 @@ fi if [[ "${DEV_FAST_REVIEW_DISABLE_GPU:-0}" == "1" ]]; then CODE_ARGS+=(--disable-gpu) fi +if [[ "${DEV_FAST_REVIEW_NO_SANDBOX:-0}" == "1" ]]; then + # Electron refuses to start as root with the Chromium sandbox, as in + # containers and cloud sandboxes. + CODE_ARGS+=(--no-sandbox) +fi if [[ "${DEV_FAST_REVIEW_FORCE_ACCESSIBILITY:-0}" == "1" ]]; then # Keeps Chromium's renderer accessibility tree alive for the generic Linux # AT-SPI Computer Use backend. It is deliberately opt-in outside DevBoxes. From 38a593c7e4ced59a1384b354f26b5290a64e6a24 Mon Sep 17 00:00:00 2001 From: Sidharth Menon <115056754+sidkmenon@users.noreply.github.com> Date: Thu, 19 Nov 2026 02:20:16 +0000 Subject: [PATCH 2/2] Keep the GPU process on for the sandbox Desktop The sandbox has no GPU, but Chromium falls back to software rendering on its own, and --disable-gpu can leave the canvas's WebGL views without a context. Run-on: Niteshift Co-Authored-By: Claude Opus 5.5 --- .niteshift/services.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.niteshift/services.yaml b/.niteshift/services.yaml index 8cc4201b6f..6c279b8cc9 100644 --- a/.niteshift/services.yaml +++ b/.niteshift/services.yaml @@ -14,8 +14,6 @@ services: value: ":99" - name: DEV_FAST_REVIEW_REMOTE_DEBUGGING_PORT value: "9333" - - name: DEV_FAST_REVIEW_DISABLE_GPU - value: "1" # The sandbox runs as root, which Electron only allows without its sandbox. - name: DEV_FAST_REVIEW_NO_SANDBOX value: "1"