Repository navigation
Open
Description
Summary
In one thread I used a regular (jj workspace) sandbox, then open_sandbox_direct on a parent directory, then clone_repo again on the original repo. That left the thread unable to run any command. The second clone_repo reports success, but every execute_command fails with a jj error before running, and re-initializing is refused. The only way forward is to spawn a child thread.
Possibly related: #132 (sandbox position reset on suspend/reload).
Setup (generic names)
REPO=/home/user/ws/src/repo-a: a git repo with jj (.jjpresent), several bookmarks.WS=/home/user/ws: a parent directory that containsREPO(and sibling repos underWS/src/).WSitself is not a git or jj repo.
Steps to reproduce
clone_repo(REPO). This works normally and creates a jj workspace sandbox atREPO/.infinity/.sandboxes/.tmpXXXXwith asandbox-<thread-id>bookmark. A long session of edits and commands runs fine.open_sandbox_direct(WS), to read and build sibling repos underWS/src/. It returnsRepository initialized (Direct mode …), even thoughWSis not a git repo.- Keep working. Observed after step 2:
- The first few
execute_commandcalls still started in the old sandbox path (pwd=REPO/.infinity/.sandboxes/.tmpXXXX). Later calls started inWS. The cwd switch is not immediate. - The old sandbox became read-only. Writes there fail with
EROFS, because it is nested insideWS, which direct mode mounts read-only by default. cd <absolute path under WS>is rejected withDo not cd to the absolute path … Commands are already executed in a sandboxed copy of that repository. This includescdinto the old sandbox path and into sibling repos.- Edits outside direct mode's scope work through
additional_permissions(write-orig,write:/some/path). But each permission scope appears to get a different$TMPDIR, so a temp file written under one permission set is gone in the next call. I lost a build log this way.
- The first few
- At some point, I'm not sure when, the old sandbox directory
REPO/.infinity/.sandboxes/.tmpXXXXand itssandbox-<thread-id>bookmark were deleted. No data was lost, because the work had been committed to another bookmark, but nothing reported the cleanup. clone_repo(REPO)again, to get a writable regular sandbox back. It returnsRepository initialized (using Jujutsu workspaces).- Every
execute_command, evenpwd, now fails before running with:Error: jujutsu command failed: jj failed: Error: There is no jj repo in "." clone_repo(REPO)again fails with:(It is the same repository as step 1 and step 5.)Error: A repository has already been initialized for this thread. Re-initializing with a different repository is not supported.
Expected
- Switching modes should either be supported cleanly or be refused up front. Any of these would work:
open_sandbox_directshould not silently degrade the existing regular sandbox, by making it read-only or deleting it.- Or it should refuse or warn when the thread already has a regular sandbox.
- Or it should document that the regular sandbox is dropped.
- A second
clone_reposhould yield a working sandbox, or fail loudly, not report success and leave a broken one. - If a thread's sandbox is broken, there should be a way to re-initialize it, at least for the same repo.
- Ideally the cwd switch after
open_sandbox_directshould be immediate and consistent. $TMPDIRshould be stable across calls that differ only inadditional_permissions. Or the docs should say it isn't.
Actual
The thread is permanently unable to run commands. Workaround: spawn a child thread, which gets a fresh sandbox.
Notes
- The tool docs say
open_sandbox_directis for whenclone_repofails, so mixing the two may be off the happy path. But the use case is real: a direct sandbox on a parent directory is how I reached sibling repos from a thread whose regular sandbox covers only one repo. - A nice alternative for that use case would be a way to add a second regular sandbox for another repo in the same thread, or a supported read-only view of sibling paths.
Metadata
Metadata
Assignees
Labels
No labels
Activity
kaluli123123 commentedon Nov 3, 2026
Implemented in draft PR #183 (commit
4b2066306e681f92e08eea0fbd7792886fcbc862).1abc6fcff1f186124f924b56aa92c3a3684c90c5(355 passed, 7 failed). No baselines or tolerances were changed.I am maintaining this proposed fix. The PR remains Draft, not ready or merged: full checks are not green, remote CI currently lists no checks, and maintainer review remains outstanding. The repository script skipped docs/UI Prettier because node_modules are absent; optional browser e2e and THIRD-PARTY verification were not reached after the test gate failed. No live model account was used. No merge, Issue closure, or deployment has been performed.
This prevents new mode/cache corruption; it does not claim automatic repair of sessions already corrupted by older versions.