Skip to content

Fix SDK Explorer sandbox execution hangs #1007

Fix SDK Explorer sandbox execution hangs

Fix SDK Explorer sandbox execution hangs #1007

name: Windows WSL CLI Test
on:
push:
branches:
- main
- v2
paths:
- 'packages/cli/**'
- 'packages/core/**'
- 'packages/server/**'
- 'templates/**'
- 'install.sh'
- '.github/workflows/test-windows-wsl.yaml'
pull_request:
paths:
- 'packages/cli/**'
- 'packages/core/**'
- 'packages/server/**'
- 'templates/**'
- 'install.sh'
- '.github/workflows/test-windows-wsl.yaml'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CI: true
GITHUB_TOKEN: ''
jobs:
windows-wsl-cli-test:
runs-on: windows-latest
timeout-minutes: 30
name: Windows WSL CLI Smoke Test
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
persist-credentials: false
- name: Setup WSL
uses: Vampire/setup-wsl@3b46b44374d5d0ae94654c45d114a3ed7a0e07a8
with:
distribution: Ubuntu-24.04
additional-packages: curl unzip jq
- name: Setup WSL environment
shell: wsl-bash {0}
run: |
# Write shared env file that all subsequent steps will source.
# GitHub expression substitution happens before the script runs,
# so secrets/vars are injected at workflow parse time, not by bash.
cat > ~/test-env.sh << 'ENDOFENV'
export CI=true
export AGENTUITY_API_URL="https://api.agentuity.com"
export AGENTUITY_USER_ID="${{ vars.AGENTUITY_USER_ID }}"
export AGENTUITY_CLOUD_ORG_ID="${{ vars.AGENTUITY_CLOUD_ORG_ID }}"
export AGENTUITY_REGION="usw"
export PATH="$HOME/.bun/bin:$PATH"
ENDOFENV
- name: Install Bun + Node and build CLI
shell: wsl-bash {0}
run: |
set -e
# Install Bun
curl -fsSL https://bun.sh/install | bash -s -- "bun-v1.3.11"
export PATH="$HOME/.bun/bin:$PATH"
echo "Bun version: $(bun --version)"
# Install Node 24 via fnm. The CLI is dual-runtime; we
# smoke-test the built artifact under both bun and node
# below. The fnm setup mirrors what end users get when
# they `npm install -g @agentuity/cli` and run `agentuity`,
# which invokes node via the bin/cli.js shebang.
curl -fsSL https://fnm.vercel.app/install | bash -s -- --skip-shell
export PATH="$HOME/.local/share/fnm:$PATH"
eval "$(fnm env --shell bash)"
fnm install 24
fnm use 24
echo "Node version: $(node --version)"
# Persist Node setup so subsequent steps see node on PATH.
{
echo "export PATH=\"\$HOME/.local/share/fnm:\$PATH\""
echo "eval \"\$(fnm env --shell bash)\""
echo "fnm use 24 > /dev/null"
} >> ~/test-env.sh
# Copy repo to WSL native filesystem for performance
# (Windows mounted filesystem is slow for node_modules operations)
cp -r "$(pwd)" ~/sdk
cd ~/sdk
# Install dependencies and build
bun install --frozen-lockfile
bun run build
# Smoke-test the BUILT artifact under both runtimes.
echo "--- bun bin/cli.js --version ---"
bun packages/cli/bin/cli.js --version
echo "--- node bin/cli.js --version ---"
node packages/cli/bin/cli.js --version
- name: Setup test credentials
shell: wsl-bash {0}
run: |
set -e
source ~/test-env.sh
# Generate CLI API key for authentication
APIKEY=$(curl -sf "$AGENTUITY_API_URL/cli/auth/short-token" \
-H 'Content-Type: application/json' \
--data "{\"secret\":\"${{ secrets.AGENTUITY_APITOKEN_SHARED_SECRET }}\",\"userId\":\"$AGENTUITY_USER_ID\"}" | jq -r '.data.apiKey')
if [ -z "$APIKEY" ] || [ "$APIKEY" = "null" ]; then
echo "❌ Failed to generate API key"
exit 1
fi
echo "::add-mask::${APIKEY}"
# Persist API key into the shared env file for subsequent steps
echo "export AGENTUITY_CLI_API_KEY='${APIKEY}'" >> ~/test-env.sh
- name: Create test project
shell: wsl-bash {0}
run: |
set -e
source ~/test-env.sh
cd ~/sdk
# Exercise the BUILT CLI under node (same flow as a real
# user after `npm install -g @agentuity/cli`).
CLI="node packages/cli/bin/cli.js"
# Use GitHub expressions directly — env vars like GITHUB_RUN_ID
# and GITHUB_BASE_REF are NOT available inside WSL, but
# expressions are resolved at workflow parse time.
PROJECT_NAME="test-wsl-${{ github.run_id }}-${{ github.run_attempt }}"
# Verify authentication
$CLI auth whoami
# Create test project in usw region. Use hono as a
# minimal real-build framework: it's in the framework
# registry, scaffolds quickly, and produces a real `build`
# script (which the deploy pipeline requires for framework
# detection). The exact framework doesn't matter for this
# test — we're verifying scaffolding + deploy + cleanup
# work end-to-end under WSL.
echo "Creating project: $PROJECT_NAME"
$CLI project create \
--name "$PROJECT_NAME" \
--framework hono \
--database skip \
--storage skip \
--confirm
# Extract project ID from agentuity.json
PROJECT_ID=$(jq -r '.projectId' "$PROJECT_NAME/agentuity.json")
if [ -z "$PROJECT_ID" ] || [ "$PROJECT_ID" = "null" ]; then
echo "❌ Failed to extract project ID from agentuity.json"
cat "$PROJECT_NAME/agentuity.json" 2>/dev/null || echo "File not found"
exit 1
fi
# Persist project details for deploy and cleanup steps
echo "export PROJECT_ID='$PROJECT_ID'" >> ~/test-env.sh
echo "export PROJECT_NAME='$PROJECT_NAME'" >> ~/test-env.sh
echo "✅ Project created: $PROJECT_ID"
- name: Deploy test project
shell: wsl-bash {0}
run: |
set -e
source ~/test-env.sh
cd ~/sdk/$PROJECT_NAME
CLI="node $HOME/sdk/packages/cli/bin/cli.js"
echo "Deploying project $PROJECT_ID..."
$CLI cloud deploy
echo "✅ Deploy succeeded"
- name: Cleanup - Delete test project
if: always()
shell: wsl-bash {0}
run: |
source ~/test-env.sh 2>/dev/null || true
cd ~/sdk 2>/dev/null || exit 0
CLI="node packages/cli/bin/cli.js"
if [ -n "${PROJECT_ID:-}" ]; then
echo "Deleting project: $PROJECT_ID"
$CLI project delete "$PROJECT_ID" --confirm \
|| echo "⚠️ Warning: Failed to delete project $PROJECT_ID (manual cleanup may be needed)"
else
echo "No project to clean up"
fi