8000 fix(install): stop waiting when Lens can't start, and show what it logged in the web installer by adeelahmad · Pull Request #359 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

fix(install): stop waiting when Lens can't start, and show what it logged in the web installer - #359

Merged
adeelahmad merged 4 commits into
mainfrom
claude/project-thread-ufyh1d
Oct 11, 2026
Merged

adeelahmad merged 4 commits into
mainfrom
claude/project-thread-ufyh1d

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: when Lens couldn't start in its microsandbox, the installer (and the web installer on a Mac) sat at "Waiting for the web app..." for 30 minutes and then said only "Lens didn't answer within 30 minutes. See what happened: ... msb logs -f lens". Running the line again over a running install could also hang there with no output.

After: the installer lists the sandbox's own steps as they happen (installing packages, building, starting the database), and stops waiting as soon as a step fails, the sandbox stops, or a part of Lens keeps stopping (run.sh has started it three times). It then prints the last lines Lens logged and the reason, and the web installer shows those lines under the reason. For #358's case, that means "Lens's API keeps stopping in its microsandbox" within a minute or two, with the API's own cannot open SurrealDB ... SURREAL_USER/SURREAL_PASS don't match line on screen.

Motivation and Context

This takes over #327, which stalled, and builds on it. #327's commit is kept as is (rebased onto main); the second commit adds the crash-loop check and the log tail in the web installer.

How:

  • From fix(install): restart a microsandbox rerun cleanly and stop waiting with the logs and why #327: a rerun stops the running lens sandbox first (msb stop -t 60, then -f) and waits for its port, naming what holds it (lsof). Each check gives up after 5 seconds, and the wait is time based (LENS_WAIT). New [lens] lines are shown while waiting. It fails at once on a [lens] Failed line or when the sandbox is not running twice in a row. On timeout it checks inside the sandbox whether only the port is the problem, and prints the last 40 log lines. run.sh logs finer steps and a Failed (exit N): step line on error.
  • Here: the sandbox's lines go out as bold say lines, so the web installer lists them as steps. Three [lens] NAME stopped; starting it again lines for the same part end the wait, with a reason that names the part (database, API, web app, job worker). lens_installer.py keeps the lines after "The last lines Lens logged:" (log_tail) and returns them as tail, and page.html shows them under the error.

Steps to reproduce (if appropriate):

Install with LENS_BACKEND=microsandbox, then change SURREAL_PASS in ~/lens/.env and run the line again. The microsandbox CI job does exactly that: it checks for the "keeps stopping" reason and the API's own words, then restores .env and reinstalls. It also keeps #327's LENS_WAIT=8 check and #358's reinstall-after-delete check.

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, ruff and actionlint clean).
  • I added or updated tests (installer unit tests for the log tail; microsandbox CI job for the crash loop, the wait limit and the rerun).
  • 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, so I wrote it under ## Unreleased in CHANGELOG.md.

Done questions (AGENTS.md)

  • Goal: a start that can't succeed ends quickly with the reason and the log on screen, in the terminal and the web installer; merged on green CI.
  • Agents: n/a, the installer runs on the host before Lens exists. The upgrade agent reads the same output.
  • Zero setup: no new prerequisite (lsof is optional, used only to name what holds a port).
  • Fewest clicks: no copying a command to a terminal to find out what went wrong.
  • Configurable: LENS_WAIT is optional and install-time, like the other settings at the top of install.sh.
  • Light: no new services or downloads.
  • Private and secure: the log stays on this machine and is shown only on the installer's local page. 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 and changelog say what it does.
  • Tests, docs and generated files updated.
  • Open standards; no new dependencies.
  • Reported with evidence. Refine later: Docker has the same orphaned-volume gap as fix(install): start a fresh microsandbox install on its own volume when an earlier install's data is there #358; there's no Mac CI (GitHub's macOS runners can't run microVMs); the sandbox name lens collides when two install folders are used.

Closes #327.

🤖 Generated with Claude Code

https://claude.ai/code/session_01G7Lm1fFWPE5g9CMRUJxeSL


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
…ow what Lens logged in the web installer

install.sh lists the sandbox's own steps as steps (the web installer shows them as they come), stops waiting at
once when run.sh has started the same part of Lens three times, and the web installer shows the last lines Lens
logged under the reason instead of only a command to run. CI breaks the database keys on purpose and checks that
the wait ends with the API's own words.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7Lm1fFWPE5g9CMRUJxeSL
…nd shows why

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7Lm1fFWPE5g9CMRUJxeSL
…teps without their [lens] prefix in CI

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7Lm1fFWPE5g9CMRUJxeSL
@adeelahmad
adeelahmad merged commit 65551cb into main Oct 11, 2026
19 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-ufyh1d branch October 11, 2026 14:33
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