Repository navigation
fix(install): move a microsandbox install whose keys don't open its database to a volume of its own - #360
Merged
Conversation
…atabase to a volume of its own A reinstall made before #358, after ~/lens was deleted, wrote new keys but kept the earlier install's lens-data volume, and every update after it kept both: the API stopped at every start with "SURREAL_USER/SURREAL_PASS don't match". #358 only stopped a new first install from landing there. run.sh now signs in with .env's SURREAL_USER/SURREAL_PASS right after the database starts. When SurrealDB answers 401, it says "Another install's database", closes the database and stops instead of starting the API again and again. install.sh, seeing that line, moves Lens to a volume of its own (the first lens-data-N with no database, as a first install does), keeps it in .env as LENS_VOLUME, rewrites .lens-sandbox and starts again, once. The keys and the earlier volume are left as they are. CI: the "keeps stopping" check breaks ACCESS_SECRET_KEY instead of SURREAL_PASS, and a new step gives an install new keys and no LENS_VOLUME, as on Adeel's Mac, and checks that the line moves it to lens-data-3 and stays there. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016M1M7EXU6uJVnqfp77L19k
…-snty5h # Conflicts: # CHANGELOG.md
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016M1M7EXU6uJVnqfp77L19k
18 of 22 tasks
adeelahmad
pushed a commit
that referenced
this pull request
Oct 14, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014pKRz6HkdQ7hTqEbpnyhYo
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Adeel · project thread
Description
Before: running the install line to update a microsandbox install could end with the API and worker stopping at every start:
cannot open SurrealDB ... SURREAL_USER/SURREAL_PASS don't match the user this database was created with. Running the line again changed nothing.After: each start, the sandbox checks that the keys in
.envopen the database. When they don't, it saysAnother install's database, closes the database and stops. The install line then moves Lens to a volume of its own (lens-data-2, or the next one with no database), saves it in.envasLENS_VOLUME, and starts Lens there. The keys and the earlier volume are left as they are.Motivation and Context
The update path keeps
.env's secrets; CI's "Running it again ... keeps the secrets" step already proves that. The mismatch comes from earlier. A reinstall made before #358 (after~/lenswas deleted) wrote new keys but mounted the earlier install'slens-data, whose database only that install's keys open. #358 stopped a new first install from landing there, but an install already in that state has an.envwith noLENS_VOLUME, so every update mountslens-dataagain and crash-loops. That is the state Adeel's Mac is in. The old data can't be opened with the new keys anyway:ARCHIVE_SECRET_KEYwraps every namespace's data key. A volume of its own is the only way such an install comes up, and the earlier volume stays for the.envthat made it.How:
microsandbox/run.shPOSTs.env's credentials to SurrealDB's/signinright after it is ready. A 401 means other keys; any other answer is retried, then ignored, so the API reports it as before.install.shfactors the #358 volume choice intoown_volumeand the.lens-sandboxwriter intowrite_sandbox. On the sandbox's line it callsother_volumeonce, which picks a free volume, rewrites.lens-sandbox(also used at boot), and starts again with the wait reset.Steps to reproduce (if appropriate):
Reproduced locally with SurrealDB 3.2.4: a database created with
--pass AAAand started with--pass BBBlogs "existing root users were found. The root user 'root' will not be created", and/signinwith BBB answers 401 "There was a problem with authentication". The run.sh check in a harness exits 3 with the new line and closes the database cleanly; with the right keys it carries on.Types of changes
!in the title)Checklist:
LENS_VOLUME(as on Adeel's Mac), and checks that the line moves it tolens-data-3, keeps its keys and the other volumes, and stays there on the next run. The "keeps stopping" step now breaksACCESS_SECRET_KEY, because wrong database keys no longer crash-loop.docs/accordingly (docs/microsandbox.md, How it runs).## UnreleasedinCHANGELOG.md.Done questions (AGENTS.md)
.envedit.LENS_VOLUMEalready existed)..envplusLENS_VOLUME) or remove it. An install whose keys open its database behaves as before.~/lensis deleted withoutdown -v(its named volumes outlive the folder). Also,setenvrewrites.envwith the user's umask on updates, so an updated.envcan become 0644; that goes in a separate PR.🤖 Generated with Claude Code
https://claude.ai/code/session_016M1M7EXU6uJVnqfp77L19k
Generated by Claude Code