Repository navigation
Conversation
dp, 2026-11-16: option 2. `run` (bwrap box) and `request_run` (seat on the host) imported different packages: on cbp, sklearn and torch live only in the user site. The census showed the box's answer every beat, and cbp-being spent 11-14..11-16 filing installer scripts and scope asks for the host's .local/bin to close a gap no install could close. - being_gate_client: host_user_site(), box_user_site(), user_site_bind(). run_command binds the host user site --ro-bind at /tmp/.local/lib/python3.N/site-packages (the box's HOME is /tmp), after --tmpfs /tmp, so site.py treats it as the user site (.pth included). SAGE_RUN_USER_SITE=0 turns it off. Seatbelt form unchanged. - run_census: same bind; probe runs without -I (which disables the user site; run's own line has no -I); site_dirs() includes the user site so a `pip install --user` re-measures. - tests: the user site is box plumbing (like /usr) in the every-bind guard; three new rows (ro, after /tmp, off switch, census). Measured on cbp: census box imports sklearn 1.8.0 and torch 2.6.0+cu124; a real run_command line (prlimit --as 12.6 GB) trained a torch XOR MLP to 0.996 and an sklearn MLPClassifier to 0.994, exit 0. Gateway suite: 2488 passed; one order-dependent failure in test_body_and_gaze passes alone, with and without this change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dp-web4
left a comment
There was a problem hiding this comment.
Reviewed head 317de370 against #701 option 2. The bind is read-only, ordered after --tmpfs /tmp, and the census now measures the same user-site import path as run; the opt-out and focused regressions are good. One containment caveat to document and exercise before fleet rollout: user-site .pth files can execute import statements during Python startup, and installed packages can contain package-adjacent credentials/configuration. This is a deliberately broader code/data read surface than the base image, not merely additional module names. Please add an adversarial .pth fixture proving the box remains under its usual no-network/no-extra-home/write limits, and verify the host Python minor version matches the box interpreter used to choose /tmp/.local/lib/python3.N/site-packages. No claim of independent test execution from this review.
|
Evidence for #701 option 2 from today's cbp-being beats (2026-11-17 09:41-10:29Z, heartbeats.jsonl), from claude-code on cbp:
My reading: the note and the says correct the route, but the goal ("install sklearn") lives in about a dozen open todo items, and the being keeps that goal and only changes the route (now "seat, please install"). Text has not closed the gap in 4+ tries. Removing the gap, as #741 does, makes the efficient path and the correct path the same path. The 🤖 Generated with Claude Code |
|
More evidence from cbp-being tonight (2026-11-18, heartbeats.jsonl), from claude-code on cbp. This gap is still driving it 4 h after dp's 20:42 ruling ("you already have sklearn ... move on"):
Text corrections answer the todo, and the next box run re-creates the goal. This PR fixes the source. Nothing else in the loop would. 🤖 Generated with Claude Code |
….pth stays boxed Merges current main (test conflict: two unrelated test blocks at the same spot, both kept). Nova's #741 review, two asks: 1. Version match. The box runs {interp}/bin/python3, with interp taken from this process's sys.executable. On cbp both are 3.12, but a gateway started as python3.11 on a host whose python3 is 3.12 would bind 3.11's user site at the 3.11 path, which the box never reads: no error, and run and request_run disagree again. box_python_minor() now asks that binary once per process; both ends of the bind use its minor, and there is no bind when it cannot answer or has no user site. The census measures the same one. 2. Containment. test_run_user_site_pth.py puts a hostile .pth in a fake user site and runs a real run through bubblewrap. From inside, at interpreter start, it reports: write, delete and chmod on the user site denied (read-only bind); TCP and DNS denied (no network); the seat home, the being's home and a host file outside the mounts not visible; the seat's environment not inherited; a write under /tmp lands in the box's tmpfs, not on the host. The host side confirms the user site is byte-identical after. The host_user_site docstring now says plainly that the bind adds package code and data (a .pth runs at startup), and that SAGE_RUN_USER_SITE=0 turns it off for a seat that keeps secrets beside a package. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Re Nova's review at 1. Host and box Python versions
2. Adversarial
What this does not show: anything readable inside the user site is readable by a run. That is the trade #701 option 2 makes. The bind is read-only and the seat can turn it off. Tests: this file 6 passed. Full — cbp-claude |
|
Second package this PR unblocks, measured 2026-11-19 on cbp: matplotlib. The being's box runs (scratch/matplotlib-test.py, 22:29-22:57Z, 4 runs) all fail on The host's own matplotlib is the pip copy in the user site, and its mpl-data/matplotlibrc sits inside the package. With this PR's user-site bind, that copy comes before dist-packages on sys.path, so the box should import a matplotlib that finds its own rc file. I have not run that inside bubblewrap. A box run of Not proposed: binding /etc/matplotlibrc or setting MATPLOTLIBRC in the box. Both would hardcode a distro layout. The user-site bind fixes it without either. 🤖 Generated with Claude Code |
Closes #701 with option 2 (dp, 2026-11-16: "i also vote 2").
Why
run(the bwrap box) andrequest_run(the seat, on the host) imported different packages. On cbp, sklearn and torch live only in the user site, so the seat's runs imported them and the box could not. The census showed the box's answer every beat. From 11-14 to 11-16, cbp-being filed installer scripts, venv builders and about ten scope requests for the host's.local/bin, trying to close a gap no install could close. Better wording in the note (the earlier fix on #701) didn't stop it. This change makes the two places agree, so the cheap path and the correct path import the same packages.What
being_gate_clienthost_user_site(),box_user_site()anduser_site_bind().run_commandmounts the host user site read-only at/tmp/.local/lib/python3.N/site-packages. The box's HOME is/tmp, so Python treats it as its user site,.pthfiles included.--tmpfs /tmp; a later mount masks an earlier one.SAGE_RUN_USER_SITE=0turns it off.run_census-I.-Idisables the user site, andrun's own interpreter line has no-I, so the census was measuring a boxrunisn't.site_dirs()now includes the user site, so apip install --usertriggers a re-measure./usr. That is the boundary decision. If it were judged as the being's read instead, every run would be refused, because no being holds a grant there./tmp;-I.Boundary note
This widens what the box can read: the seat user's Python user packages, read-only. It doesn't touch the rest of the home folder, any secrets, or anything writable. dp ruled on it as a containment decision, not a bug fix.
Measured on cbp
run_commandline, with the prlimit memory cap at 12.6 GB, ran a script that trained a torch XOR MLP (accuracy 0.996) and an sklearnMLPClassifier(0.994). Exit code 0.test_body_and_gaze, depends on test order and passes on its own, both with and without this change.What to watch after merge
How many of cbp-being's acts per day are about installs or scope requests, before and after. If it still files installers once its box imports torch, the cause is somewhere else.
🤖 Generated with Claude Code