8000 fix(install): restart a microsandbox rerun cleanly and stop waiting with the logs and why by adeelahmad · Pull Request #327 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

fix(install): restart a microsandbox rerun cleanly and stop waiting with the logs and why - #327

Closed
adeelahmad wants to merge 1 commit into
mainfrom
claude/installer-rerun-hang-lr79o2
Closed

adeelahmad wants to merge 1 commit into
mainfrom
claude/installer-rerun-hang-lr79o2

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: running the install line again over a microsandbox install (seen on a Mac) printed "Waiting for the web app..." and then nothing, forever.

After: the rerun stops the running sandbox first, starts a new one, and shows the steps the sandbox logs while it waits (installing packages, building, starting the database), with a line a minute when nothing new happens. If a step fails, the sandbox stops, or the web app doesn't answer in time, it stops waiting and prints the last lines the sandbox logged and the reason.

Motivation and Context

Each check in the wait loop was a curl with no time limit. A port that takes the connection but never answers (a port forward with nothing behind it yet) held that curl, and so the loop, for good. The loop also printed nothing until it gave up. Reproduced here: the old check against a port that accepts and never answers was still hanging when cut off; the new loop stops at its deadline with the logs and the reason.

How:

  • install.sh, microsandbox: a rerun stops the running lens sandbox (msb stop -t 60, then -f), so SurrealDB closes cleanly instead of being killed by --replace after 10 seconds. It then waits for the port to be free and, if something else holds it, names the process (lsof) and fails.
  • The wait: each curl has --max-time 5, and the deadline is in seconds (LENS_WAIT, default 1800 in a microsandbox, 600 with Docker, as before). Every 10 seconds it prints new [lens] lines from msb logs, fails at once on a [lens] Failed line or when the sandbox is not running twice in a row, and on timeout checks inside the sandbox to tell "Lens is up but the port doesn't reach it" apart from "Lens didn't start". It prints the last 40 log lines (msb logs --tail or compose logs --tail).
  • microsandbox/run.sh: finer steps (backend packages, web packages, web build, database), and an EXIT trap that logs Failed (exit N): <step> and stops what it started.

Steps to reproduce (if appropriate):

Install with LENS_BACKEND=microsandbox, then run the line again while Lens runs.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (shellcheck clean, actionlint clean).
  • I added or updated tests: the microsandbox CI job now checks that the install shows the sandbox's progress, that a rerun stops the running sandbox first, and that LENS_WAIT=8 stops waiting with the reason and the sandbox's log.
  • My change requires documentation updates, and I have updated docs/ accordingly (docs/microsandbox.md, docs/get-started.md).
  • Users need more than the title to understand it: n/a.

Done questions (AGENTS.md)

  • Goal: a rerun restarts cleanly and never waits silently or forever; merged on green CI.
  • Agents: n/a, the installer runs on the host; the upgrade agent and web installer get the same output.
  • Zero setup: no new prerequisite (lsof is optional, used only to name what holds a port).
  • Fewest clicks: same one line.
  • Configurable: LENS_WAIT is optional, an install-time setting like the others at the top of install.sh.
  • Light: no new services.
  • Private and secure: no new surface.
  • Cost: n/a, no model calls.
  • User decides: defaults unchanged (same wait lengths).
  • Upgrades: a cleaner stop protects the database on rerun; no stored-data change.
  • Honest: docs say what it does.
  • Tests, docs and generated files updated.
  • Open standards; no new dependencies.
  • Reported with evidence. Refine later: no Mac CI (GitHub's macOS runners can't run microVMs); keeping the pnpm store in the volume would make rebuilds after an update faster.

🤖 Generated with Claude Code

https://claude.ai/code/session_01C5hhPc28UXdCfRpV9qP9it


Generated by Claude Code

…ith the logs and why

Running the install line again over a microsandbox install could sit at
"Waiting for the web app..." forever with no output: each check was a curl
with no time limit, so a port that takes the connection but never answers
held it for good, and the loop only printed when it gave up.

- A rerun stops the running sandbox first (a minute to close the database,
  then forced), waits for its port to be free, and says who holds it if not.
- Each check gives up after 5 seconds; the wait is time based (LENS_WAIT).
- While waiting, it shows the steps the sandbox logs, and a line a minute.
- It stops at once when a step fails or the sandbox stops, and on timeout,
  printing the last log lines and the reason (including a port that doesn't
  reach a Lens that is up inside the sandbox).
- run.sh logs finer steps and a "Failed (exit N): step" line on error.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C5hhPc28UXdCfRpV9qP9it
adeelahmad commented 8000 Oct 11, 2026
Copy link
Copy Markdown
Owner Author

Superseded by #359, which carries this commit unchanged (rebased onto main). It adds a check that ends the wait when a part of Lens keeps stopping, and shows the log tail in the web installer. This PR will close when #359 merges.


Generated by 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.

2 participants

0