Repository navigation
Keep the code in the sandbox; factory-up git prep; pi telemetry off; python kit without services - #16
Conversation
- README: "Keep the code in the sandbox" (mountless sandbox, clone in ~/workspace), getting work out, lifetime, and moving an existing sandbox - factory-up: SSH GitHub origin goes over HTTPS (global insteadOf), /.factory/ in info/exclude, records the repository for autostart - factory-autostart: restarts every repository factory-up ran in - factory image: pi's install telemetry off by default - python: uv refuses run/sync/add/remove on a .venv from another interpreter (the host's); docs on worktree .env and upward dotenv Refs #14, #15 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The project brings the services its tests need, at its own versions. Removes sandbox-services and its boot hook, with-worktree-env, libpq-dev and postgresql-client, and the Docker Hub allow rules. The README says how a project brings its own services and keeps parallel tickets apart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The sandbox's Docker daemon can pull images, such as the services a project's tests run, now that the python kit no longer brings its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sbx run always mounts a workspace (the current directory when no path is given); only sbx create with no path makes a sandbox without a mount. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
some findings: Make the .venv guard check the project uv actually selected. I reproduced this with the PR wrapper and its pinned uv version. From the repo root, uv sync --project nested proceeded and replaced nested/.venv even though it pointed at a missing interpreter. The reverse also happened. A foreign root .venv blocked a safe sync targeting the nested project. I’d fix this before relying on the guard for host-mounted checkouts and add a regression test for both cases. Detect port conflicts when restarting multiple repositories. Autostart now walks every registered repo, but each starter config uses port 7731. Once the first server is healthy, factory-up sees that same /health response for the second repo and skips starting its server. I’d have it report the conflict and require distinct ports if multiple repos are supported. Document Docker disk sizing and what to bring over. After moving PostgreSQL off its 4 GiB tmpfs, our full suite also filled the sandbox’s roughly 10 GiB Docker volume. The replacement sandbox has 40 GiB. Add DOCKER_SANDBOXES_DOCKER_SIZE=40g sbx create … as an optional example for heavier workloads. It applies at creation. The guide also says to copy only FACTORY.json and CONTEXT.md, which would leave behind any setup or validation scripts those files reference. Our config calls both from .factory/bin. |
…licts - uv-sfw asks uv for the workspace root (uv workspace dir) with the command's --project, --directory or UV_PROJECT, and checks that .venv, instead of the nearest .venv above the current directory. Adds python/test-uv-sfw and a CI job that runs it with the pinned uv. - factory-up stops when another recorded repository sets the same server.port, and a starter config takes the next free port (skipping the dashboard's 7732). - README: Docker volume size at creation (DOCKER_SANDBOXES_DOCKER_SIZE), and copy the files FACTORY.json and CONTEXT.md reference, such as .factory/bin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, all three are addressed in c99306f.
Port conflicts. Docs.
|
|
New findings: Some |
…ed repos only - uv-sfw checks $VIRTUAL_ENV with --active, and the project's .venv when it is unset. `uv run --script` and `uv run x.py` check the project's .venv unless the script has inline metadata, which gets its own environment. Adds 14 test cases. - factory-up adds a repository to the autostart roots only after its server answers, so a repository rejected for a port conflict doesn't block the one it conflicted with on the next boot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, both are fixed in 0455b31. I reproduced each one with the real uv first.
Rejected repo blocking restarts.
An entry left behind by the previous version still has to be removed from |
|
New finding: Remaining issue: Setting |
With UV_PROJECT_ENVIRONMENT set, the guard skipped every check, yet `uv sync --active` still replaces a foreign $VIRTUAL_ENV, and uv replaces a foreign UV_PROJECT_ENVIRONMENT too. The guard now checks the environment uv picks: $VIRTUAL_ENV with --active, else UV_PROJECT_ENVIRONMENT (relative to the workspace root), else the workspace root's .venv. Adds 7 test cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, fixed in 478c23a. I reproduced it, and found a related case: when The guard no longer skips when
Pointing
|
From factory-skills 0.6.0 the binary carries the stage skills and the operator's Pi extension, which `factory serve` writes to Pi's agent directory on every start, and it updates itself. Drop the factory-skills Pi package from the image, and default factory_version to 0.6.4, the release a new sandbox starts on. README: what the kit installs, updating the factory, and how a sandbox from before 0.6.0 moves over (install the binary by hand, then `pi remove` the pinned package). Closes #17 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ory version - factory/context.md: /factory comes from the extension `factory serve` writes to ~/.pi/agent/extensions/factory/, not the factory-skills package. - README: the manual install for older sandboxes downloads the latest release (no tag) and prints its version. - The image build checks `factory --version` against FACTORY_VERSION instead of running --help, and factory_version accepts 0.6.0 or later. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #14, #15. Closes #17.
#15: VM-private code
A sandbox created without a path mounts nothing from the host. The repository is cloned into
~/workspace, and the factory's worktrees, environments, caches and database stay on the sandbox's disk.sbx run --clonewas considered and not chosen: it protects the host's Git metadata, but the whole host directory, untracked.envincluded, stays readable at/run/sandbox/source(docs: Isolation → Clone mode; docker/sbx-releases#260).FACTORY.json,CONTEXT.mdand the files they reference, such as.factory/bin; optional larger Docker volume withDOCKER_SANDBOXES_DOCKER_SIZE), getting work out (pull request, bundle, patch, untracked tarball), stop/start vssbx rm, and moving an existing host-mounted sandbox.factory-up/factory-autostart:factory-uprecords each repository in~/.local/state/factory/roots. The boot hook restarts every recorded repository plus$WORKSPACE_DIR, so the checkout no longer has to be the workspace mount. A repository is recorded only once its server answers.factory-uprefuses when another recorded repository sets the sameserver.port, and a starter config takes the next free port (7731, then 7733 and up; 7732 is the dashboard's).uv run|sync|add|removerefuse when the environment uv would use has ahomeinterpreter that doesn't exist in the sandbox, such as the host's macOS.venvin a mounted checkout. That environment is$VIRTUAL_ENVwith--active, elseUV_PROJECT_ENVIRONMENT(relative to the workspace root), else.venvat the rootuv workspace dirfinds for the command's--project/--directory/UV_PROJECT. A script with inline metadata gets its own environment and is allowed.python/test-uv-sfw(47 cases) runs in CI with the pinned uv. The README andcontext.mdalso cover writing a worktree.envin setup, since upwardload_dotenv()otherwise reads the main checkout's.#14: Factory kit section
enableInstallTelemetry: falsein~/.pi/agent/settings.json./settingsorPI_TELEMETRY=1turns it back on.factory-upaddsurl.https://github.com/.insteadOfforgit@github.com:andssh://git@github.com/to the sandbox user's global git config. The repository config and the host are untouched.git status:factory-upadds/.factory/to.git/info/exclude..claude/skills: the README notes{"skills": ["../.claude/skills"]}in.pi/settings.json.Python kit: no shared services
The project brings the Postgres, Redis and other services its tests need, at its own versions. This addresses #14's shared-Redis, fixed-version and tuning items by leaving services to the project.
sandbox-servicesand its boot hook,with-worktree-env,libpq-dev/postgresql-client, and the Docker Hub allow rules.build-essentialandpkg-configstay.registry-1.docker.io,auth.docker.io,production.cloudfront.docker.com,production.cloudflare.docker.com), so the sandbox's Docker daemon can pull a project's service images. The factory contract now says so..factory/CONTEXT.md).context.mdpoints agents at.factory/CONTEXT.md.#17: the factory binary only
From factory-skills 0.6.0 the
factorybinary carries the stage skills and pi's/factoryextension, whichfactory servewrites to~/.pi/agent/extensions/factory/on every start, and it updates itself (/factory update, with rollback).pi install git:github.com/geut/factory-skills@v…step is gone; only the binary is installed, in~/.local/binwhere the agent can replace it.factory_version: default0.6.4, now the release a new sandbox starts on./reloadafter the server (re)starts; for sandboxes from before 0.6.0, which can't runfactory update: install the binary by hand, restart the server, thenpi removethe pinned package it names.Tested
python/test-uv-sfw, 47 cases against the real uv withsfwstubbed, in CI with uv 0.13.8. Covers--project/--directory/UV_PROJECTin every spelling, workspace members,--activewith and withoutVIRTUAL_ENV,UV_PROJECT_ENVIRONMENTalone and with--active, scripts with and without inline metadata, and arguments afteruv run <cmd>. Each reported case also failed on the wrapper before its fix.factory-up, with Herdr, curl and factory stubbed: SSH origin rewrite (once, quiet on rerun);.factory/exclude; starter ports 7731, 7733, 7734; a port clash refused in both directions and left out ofroots; the original repository restarts.settings.json; it keepspackages.Needs a real sandbox
WORKSPACE_DIRin a pathless sandbox (the dashboard reads$WORKSPACE_DIR/.factory/dashboard.env):/home/agent/workspace, also the starting directory, when made withsbx createand no path (sbx runwithout a path mounts the current directory; README fixed in 21777dc)~/workspaceis empty, sogit clone … ~/workspaceworks: empty in a new sandboxsbx exec factory mkdir -p …andsbx cpas written (since replaced by the tarball copy,sbx cpplussbx exec … sh -c 'tar -x …', not yet run)uv syncat the main checkout's root is refused and the host.venvsurvivesfactory-upstarts the server and/factoryworks in pi from the extension it installed/factory updatein a sandbox (needs a release after the one it starts on)🤖 Generated with Claude Code