Pin srt to a tested version; support only Pop!_OS 26.04 and later

srt is pinned to 0.0.83, the version the smoketest passed with. A computer
with another version sees the agents item as to do in configure, which
installs the pinned one. Move the pin only after smoketest/run 50 80 passes.

The installer and configure stop on Pop!_OS (or Ubuntu) older than 26.04.
The smoketest builds on Ubuntu 26.04, with checks that 24.04 is refused.
26.04's own AppArmor profile lets bubblewrap make user namespaces, so the
connector's profile for it, and the code that offered to add it, are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-28 20:49:54 -07:00
co-authored by Claude Opus 5.5
parent c84e6d3aa0
commit b609252e1c
17 changed files with 95 additions and 75 deletions
+2 -2
View File
@@ -645,8 +645,8 @@ failed() {
# <title> <provider> <identity> <setup> <fix> <enable>
# Email's password is checked with Nextcloud before it's tried on the mail
# server: each wrong password counts towards the mail server blocking this
# computer. Online Accounts 3.50, which Pop!_OS 24.04 has, marks an account
# as needing attention when the server can't be reached too, so that isn't
# computer. Online Accounts can mark an account as needing attention when the
# server can't be reached too, so that isn't
# taken to mean a wrong password.
test_account() {
local error off works=1
+5 -29
View File
@@ -13,7 +13,6 @@ BASE_CONFIG="$CONNECTOR/sandbox/config/base.json"
BASHRC="$HOME/.bashrc"
BLOCK_START="# >>> Federated Connector: agents >>>"
BLOCK_END="# <<< Federated Connector: agents <<<"
APPARMOR_PROFILE="/etc/apparmor.d/federated-connector-bwrap"
source "$CONNECTOR/configure.d/lib/json.sh"
source "$CONNECTOR/configure.d/lib/tools.sh"
@@ -61,31 +60,12 @@ put_on_path() {
# --- bubblewrap and Ubuntu's AppArmor ---------------------------------------------
# Ubuntu 24.04 lets only programs AppArmor allows make the user namespaces
# bubblewrap needs, and has no rule for bubblewrap itself
# Pop!_OS 26.04 lets bubblewrap make user namespaces: Ubuntu's AppArmor
# profile for it (bwrap-userns-restrict) allows them
bwrap_works() {
bwrap --ro-bind / / --unshare-user --unshare-net true 2> /dev/null
}
allow_bwrap() {
echo "Ubuntu's AppArmor doesn't let bubblewrap, which the sandbox is built on, make"
echo "user namespaces. A profile for /usr/bin/bwrap allows it, as Ubuntu suggests."
confirm_yes "Add it ($APPARMOR_PROFILE)?" || return 1
sudo tee "$APPARMOR_PROFILE" > /dev/null << 'EOF' || return 1
# Written by Federated Connector (configure agents): let bubblewrap, which the
# AI agent sandbox uses, make user namespaces
abi <abi/4.0>,
include <tunables/global>
profile federated-connector-bwrap /usr/bin/bwrap flags=(unconfined) {
userns,
include if exists <local/federated-connector-bwrap>
}
EOF
sudo apparmor_parser -r "$APPARMOR_PROFILE" || return 1
bwrap_works || { echo "bubblewrap still can't make user namespaces."; return 1; }
}
# --- Claude Code -------------------------------------------------------------------
# Claude Code runs every command it starts in its own sandbox, also built on
@@ -214,7 +194,7 @@ sandbox_cline() {
# --- The item -------------------------------------------------------------------------
sandbox_ready() {
srt_path > /dev/null && on_path && pkg_installed "${SANDBOX_PACKAGES[@]}" && bwrap_works \
srt_current && on_path && pkg_installed "${SANDBOX_PACKAGES[@]}" && bwrap_works \
&& { ! agent_installed claude || { claude_sandbox_on && ! old_claude_notifications; }; } \
&& gateway_ok && cline_ok
}
@@ -263,12 +243,8 @@ run_configure() {
echo
pkg_ensure "The sandbox" "${SANDBOX_PACKAGES[@]}" || return 1
if ! bwrap_works; then
if [ "$(sysctl -n kernel.apparmor_restrict_unprivileged_userns 2> /dev/null)" = 1 ]; then
allow_bwrap || { echo -e "\e[31mWithout it, the agents can't run in the sandbox.\e[0m"; return 1; }
else
echo -e "\e[31mbubblewrap can't make user namespaces on this computer, so the sandbox can't run.\e[0m"
return 1
fi
echo -e "\e[31mbubblewrap can't make user namespaces on this computer, so the sandbox can't run.\e[0m"
return 1
fi
srt_ensure || { echo -e "\e[31mWithout srt, opencode and Hermes can't run in the sandbox.\e[0m"; return 1; }
if ! on_path; then
+2 -3
View File
@@ -36,9 +36,8 @@ GNOME Settings), such as "Calendar, Files", and enable turns them back on.
attention exits 0 if Online Accounts marked the account as needing
attention. It doesn't sign in, so it doesn't add to the server's count of
failed logins. Online Accounts 3.50, which Pop!_OS 24.04 has, marks it for
any failure, including a server it couldn't reach, so it's only a hint that
the password may be wrong (see system/email-watch).
failed logins. Online Accounts can mark it for any failure, including a
server it couldn't reach, so it's only a hint that the password may be wrong (see system/email-watch).
pause empties the account's saved password, keeping its place in the keyring.
Online Accounts signs in again whenever the network changes, and Evolution
+9
View File
@@ -11,6 +11,15 @@ is_pop() {
[ "$(. /etc/os-release 2> /dev/null && echo "$ID")" = pop ]
}
# Pop!_OS (or Ubuntu) older than 26.04, which the connector no longer supports
os_too_old() {
local id version
id="$(. /etc/os-release 2> /dev/null && echo "$ID")"
version="$(. /etc/os-release 2> /dev/null && echo "$VERSION_ID")"
case "$id" in pop|ubuntu) ;; *) return 1 ;; esac
[ -n "$version" ] && [ "$(printf '%s\n' 26.04 "$version" | sort -V | head -n 1)" != 26.04 ]
}
os_name() {
(. /etc/os-release 2> /dev/null && echo "${PRETTY_NAME:-$ID}") || uname -s
}
+32 -7
View File
@@ -4,11 +4,18 @@
# sandbox. Source this file after lib/agents.sh; it uses
# confirm_yes from configure.
#
# srt needs Node.js 22.12 or later, and Pop!_OS 24.04's is 18. So unless a
# new enough one is installed already, the current long-term support release
# is downloaded from nodejs.org into FC_TOOLS/node, checked against the
# SHA-256 sums it publishes, and used only for srt: nothing in /usr or your
# shell changes.
# srt needs Node.js 22.12 or later, which Pop!_OS doesn't install. So unless
# one is installed already (Pop!_OS 26.04's nodejs package is new enough), the
# current long-term support release is downloaded from nodejs.org into
# FC_TOOLS/node, checked against the SHA-256 sums it publishes, and used only
# for srt: nothing in /usr or your shell changes.
#
# srt is pinned to a version the smoketest passed with: a new release once
# broke opencode's sandbox on Pop!_OS. To move the pin, change SRT_VERSION,
# run smoketest/run 50 80, and commit only if it passes. Computers that have
# the old version see the agents item as to do in configure, which installs
# the new one.
SRT_VERSION=0.0.83
# srt needs Node.js 22.12 or later
node_ok() {
@@ -61,12 +68,30 @@ install_srt() {
node_dir="$(dirname "$(PATH="$FC_TOOLS/node/bin:$PATH" command -v node)")"
echo "Installing the sandbox runtime (srt) from npm..."
PATH="$node_dir:$PATH" "$node_dir/npm" install --global --prefix "$FC_TOOLS/srt" \
--no-fund --no-audit --ignore-scripts @anthropic-ai/sandbox-runtime > /dev/null
--no-fund --no-audit --ignore-scripts "@anthropic-ai/sandbox-runtime@$SRT_VERSION" > /dev/null
}
# The version of Federated Connector's own srt, or nothing
srt_version() {
jq -r '.version // empty' \
"$FC_TOOLS/srt/lib/node_modules/@anthropic-ai/sandbox-runtime/package.json" 2> /dev/null
}
# Federated Connector's own srt is installed, at the version it's pinned to
srt_current() {
[ "$(srt_version)" = "$SRT_VERSION" ] && srt_path > /dev/null
}
# Updating srt is installing it again
srt_ensure() {
srt_path > /dev/null && return 0
srt_current && return 0
if [ -n "$(srt_version)" ]; then
echo "The sandbox runtime (srt) is at $(srt_version); this version of Federated Connector"
echo "was tested with $SRT_VERSION."
confirm_yes "Install $SRT_VERSION?" || return 1
install_srt
return
fi
echo "The sandbox is Anthropic's sandbox runtime (srt), which runs on Node.js."
node_ok || echo "This computer's Node.js is older than srt needs, so it gets its own, from nodejs.org."
confirm_yes "Install it (into $FC_TOOLS)?" || return 1