fix(server): stop OpenCode daemon crash on session close, fix #2014 #1559
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Nix | |
| on: | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - "nix/**" | |
| - "flake.nix" | |
| - "flake.lock" | |
| - "package.json" | |
| - "package-lock.json" | |
| - "packages/highlight/**" | |
| - "packages/protocol/**" | |
| - "packages/client/**" | |
| - "packages/server/**" | |
| - "packages/relay/**" | |
| - "packages/cli/**" | |
| - "scripts/update-nix.sh" | |
| - "scripts/fix-lockfile.mjs" | |
| - ".github/workflows/nix.yml" | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| cache: "npm" | |
| - uses: cachix/install-nix-action@v31 | |
| with: | |
| nix_path: nixpkgs=channel:nixos-unstable | |
| - name: Update lockfile + Nix hash if stale | |
| run: ./scripts/update-nix.sh | |
| - name: Build Nix package | |
| run: nix build .#default -o result | |
| - name: Smoke Nix daemon | |
| run: | | |
| set -euo pipefail | |
| export PASEO_HOME | |
| PASEO_HOME="$(mktemp -d)" | |
| export PASEO_LISTEN=127.0.0.1:6767 | |
| WRAPPER_LOG="$PASEO_HOME/paseo-server-wrapper.log" | |
| cleanup() { | |
| if [[ -n "${DAEMON_PID:-}" ]] && kill -0 "$DAEMON_PID" 2>/dev/null; then | |
| kill "$DAEMON_PID" | |
| wait "$DAEMON_PID" || true | |
| fi | |
| rm -rf "$PASEO_HOME" | |
| } | |
| trap cleanup EXIT | |
| ./result/bin/paseo-server --no-relay >"$WRAPPER_LOG" 2>&1 & | |
| DAEMON_PID=$! | |
| deadline=$((SECONDS + 30)) | |
| while (( SECONDS < deadline )); do | |
| if STATUS_JSON="$(./result/bin/paseo daemon status --json)" \ | |
| && jq -e '.connectedDaemon == "reachable"' <<<"$STATUS_JSON" >/dev/null; then | |
| echo "$STATUS_JSON" | |
| exit 0 | |
| fi | |
| if ! kill -0 "$DAEMON_PID" 2>/dev/null; then | |
| echo "Nix daemon exited before becoming reachable." | |
| break | |
| fi | |
| sleep 1 | |
| done | |
| echo "::group::daemon.log" | |
| cat "$PASEO_HOME/daemon.log" 2>/dev/null || echo "<missing>" | |
| echo "::endgroup::" | |
| echo "::group::paseo-server stdout/stderr" | |
| cat "$WRAPPER_LOG" 2>/dev/null || echo "<missing>" | |
| echo "::endgroup::" | |
| echo "::group::paseo daemon status" | |
| ./result/bin/paseo daemon status || true | |
| echo "::endgroup::" | |
| exit 1 | |
| - name: Build Nix desktop package | |
| run: nix build .#desktop -o result-desktop |