Skip to content

fix: fail clearly when the Pod has no build instead of crash-looping - #799

Merged
ng merged 2 commits into
devfrom
fix/missing-build-crash-loop
Oct 10, 2026
Merged

ng merged 2 commits into
devfrom
fix/missing-build-crash-loop

Conversation

@ng

@ng ng commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A community user ran next build on their Pod. Next empties .next before compiling, and the build can't finish in 2GB of RAM, so .next/standalone/server.js disappeared. The unit then fell back to pnpm start. That fallback can never work because the service runs as sleepypod with home /nonexistent. The result was a crash loop (574 restarts) whose only error was a misleading pnpm permission failure.

  • next.config.mjs: refuses next build when /etc/sleepypod/data-dir exists (only installed Pods have it). This happens during config load, before Next touches .next. Override with SP_ALLOW_POD_BUILD=1.
  • scripts/install: removes the dead pnpm start fallback. When server.js is missing, ExecStart now prints the recovery steps (sp-update / ./scripts/deploy POD_IP) and exits 1.
  • scripts/bin/sp-update: writes the same ExecStart as an execstart.conf drop-in, so already-installed Pods pick it up on OTA updates. This follows the existing nats-ordering.conf pattern, and sp-uninstall already removes sleepypod.service.d.
  • Docs: adds a "Web UI down, service restarting in a loop" section to docs/DEBUGGING.md, and a "Changing the code" note in docs/DEPLOYMENT.md.

Test plan

  • With pod detection forced on, next build fails during config load with the refusal message; a placeholder .next/standalone/server.js survives
  • With SP_ALLOW_POD_BUILD=1, the config still loads
  • A normal pnpm build on macOS succeeds and produces .next/standalone/server.js
  • The ExecStart shell snippet exits 1 with the message when server.js is missing, and execs node when it's present
  • bash -n passes on scripts/install and scripts/bin/sp-update; eslint and tsc are clean
  • On a Pod: run sp-update, confirm /etc/systemd/system/sleepypod.service.d/execstart.conf exists and systemctl cat sleepypod shows the new ExecStart, and confirm the service starts normally
  • On a Pod: move .next/standalone/server.js aside, confirm journalctl -u sleepypod shows the recovery message, then restore the file
🛏️ Beam this PR onto a sleepypod ✨

Pick the snippet that matches your pod. Already-installed pods can't use the curl bootstraps below — sleepypod's egress firewall DROPs github.com, and the script that knows how to unblock WAN is the very file curl is trying to fetch. Use sp-update instead; it's on disk and opens WAN as its first step.

🔄 Already on a sleepypod (most common — review a PR on a running pod):

sudo sp-update fix/missing-build-crash-loop

🚀 Fresh pod / first install — bootstraps from GitHub, rebuilds every push:

curl -fsSL https://raw.githubusercontent.com/sleepypod/core/fix/missing-build-crash-loop/scripts/install \
  | sudo bash -s -- --branch fix/missing-build-crash-loop

🎯 Pin to this exact build (run 38014455292 · f66dd3d) — fresh-pod path, locked to one CI artifact for reproducible review:

curl -fsSL https://raw.githubusercontent.com/sleepypod/core/f66dd3d8e3113dce38f1b49f4e24b60fdbd90f86/scripts/install \
  | sudo bash -s -- \
      --branch fix/missing-build-crash-loop \
      --artifact-url 'https://nightly.link/sleepypod/core/actions/runs/38014455292/sleepypod-core.zip'

🧊 Artifact: sleepypod-core · self-destructs in 30 days 💥

@vercel

vercel Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
sleepypod-demo Ignored Ignored Preview Oct 10, 2026 1:46am UTC

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 58 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e6e3acd6-2959-43c9-a695-820978e0ace5

📥 Commits

Reviewing files that changed from the base of the PR and between 8077afa and f66dd3d.


📒 Files selected for processing (5)
  • docs/DEBUGGING.md
  • docs/DEPLOYMENT.md
  • next.config.mjs
  • scripts/bin/sp-update
  • scripts/install


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

…restarting a missing build

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@ng
ng added this pull request to the merge queue Oct 10, 2026
Merged via the queue into dev with commit 6d457ef Oct 10, 2026
9 checks passed
@ng
ng deleted the fix/missing-build-crash-loop branch October 10, 2026 01:59
ng added a commit that referenced this pull request Oct 10, 2026
…, and missing-build guard (#800)

Promote `dev` at `74110f700ecf371fb68ef4eff99cdc4b561c9c49` to `main`.

- **No false pump stalls from priming** (#798): scheduled priming could produce pump motion before the status poll reported `isPriming`, arming the stall guard on an idle side. Priming intent is now tracked from command dispatch, bounded to 90 seconds both in flight and after the ACK, and real heating runs stay protected.
- **HomeKit pump faults move to the thermostats** (#798): stalls now show as `StatusFault` on each Bed thermostat instead of separate pump `LeakSensor` accessories. Pairing and thermostat IDs are unchanged. **Automations that used the removed leak accessories need to be recreated, and stalls no longer raise HomeKit critical water-leak alerts.** sleepypod stall notices and the MQTT problem sensors are unchanged.
- **A missing build fails clearly instead of crash-looping** (#799): `next build` refuses to run on an installed Pod (override only with `SP_ALLOW_POD_BUILD=1`). When `.next/standalone/server.js` is missing, the service logs recovery steps and stops (exit 78, no restart) instead of looping on a misleading pnpm error. `sp-update` installs the new ExecStart as a drop-in, so existing Pods pick it up.

## Test plan
- [x] dev CI (lint, typecheck, unit tests, build) green on #798 and #799 through the dev merge queue
- [x] CodeRabbit (via mirror) on both PRs; the four findings were fixed and confirmed resolved
- [ ] After release: `sp-update main` on the Pod; `systemctl cat sleepypod` shows `execstart.conf` with `RestartPreventExitStatus=78`; service active; web UI loads

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant