fix(sandbox): bound lifecycle queue and harden install/backup paths

Bound the OpenCode supervisor lifecycle queue to one running plus one
pending operation so repeated restarts cannot stack unbounded HTTP
requests, while exempting stop() so shutdown is never dropped.

Reject enforcement backups that carry no recoverable removed sections,
matching the existing fail-closed handling of unparseable backups.

Install OpenCode through a private mktemp staging directory instead of
the predictable /tmp/opencode path.

Use named path/os imports in the files added by this branch.
This commit is contained in:
Chris Scott committed 2026-08-22 00:14:19 -04:00
1 parent 0481160f5e
commit 0215de9d92
9 files changed
+108 -28

No files matched your search

+6 -4
View File
@@ -63,13 +63,15 @@ install_opencode() {
return 1
fi
echo "Installing OpenCode ${opencode_version}..."
local staging
staging="$(mktemp -d)"
curl -fsSL "https://github.com/anomalyco/opencode/releases/download/v${opencode_version}/opencode-linux-$(uname -m | sed 's/x86_64/x64/; s/aarch64/arm64/').tar.gz" \
-o /tmp/opencode.tar.gz
tar -xzf /tmp/opencode.tar.gz -C /tmp
-o "$staging/opencode.tar.gz"
tar -xzf "$staging/opencode.tar.gz" -C "$staging"
mkdir -p "$HOME/.opencode/bin"
mv /tmp/opencode "$HOME/.opencode/bin/opencode"
mv "$staging/opencode" "$HOME/.opencode/bin/opencode"
chmod 755 "$HOME/.opencode/bin/opencode"
rm -f /tmp/opencode.tar.gz
rm -rf "$staging"
}
echo "Checking Bun installation..."