You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(bwopenchamber): add bwopenchamber and bwopencode2 --serve-open - #43
Adds bwopenchamber, which runs OpenChamber (a web UI for OpenCode) in the same bubblewrap sandbox as its OpenCode, so the terminal, git, worktrees and every tool call stay sandboxed and only the browser is outside, behind an ssh tunnel.
Also changes bwopencode2 --serve (from #37) so it is easier to sign in to: one block with the ssh -L command, a one-time sign-in link and a google-chrome --app=... command, a new link on Enter, and --serve-open, which opens the signed-in web UI in a browser on the same host. These are six commits at the end of the branch and are independent of bwopenchamber.
This depends on #37 and should not merge before it. It uses that PR's private network namespace and publish address, so until #37 merges this PR also shows #37's commits. Review only the 17 commits after #37's tip e8738f0 (git log e8738f0.. lists them): eleven for bwopenchamber and its sign-in, database-lock and data-directory fixes, and six for bwopencode2 --serve-open and the sign-in block (feat(bwopencode2): add --serve-open and a sign-in block for --serve, fix(bwopencode2): do not hand the --serve-open link to xdg-open without a browser, docs(bwopencode2): record that only a browser signs in with the --serve link, fix(bwopencode2): keep the launcher's descriptors from the --serve-open browser, feat(bwopencode2): make --serve-open work without --serve, and the cleaned-up --serve-open terminal output). Once #37 merges, the diff here shrinks to those.
Description
Why a launcher of its own, and not bwopencode2 --serve behind an OpenChamber on another machine. OpenChamber is not only a screen. Its server runs the browser terminal, git and worktree commands, project start commands and scheduled tasks, and it gives the agent tools that call back into it. Run outside the sandbox in front of a sandboxed OpenCode, all of that would run unsandboxed. So the whole server runs inside one sandbox.
What it does
Sources bin/bwopencode2 (it now runs main only when executed, and finds its library from its own file) for the OpenCode 2 mounts, environment, database guard and the --serve port pool, so a fix made there applies to both. Moving that shared code into lib/ is deliberately left for after Feat/bwrap private netns #37 lands, because bwopencode2 is being rewritten there.
Takes its port from the same pool and claim directory as --serve (24700-24709), published on the user's 127.H1.H2.1; one ssh_config block (--ssh-config) covers both. The server listens on 0.0.0.0 inside the private network, as --serve does.
Random UI password for each session (or BWOPENCODE2_SERVE_PASSWORD), passed only in the sandbox environment.
A random sign-in signing key for each session (OPENCODE_JWT_SECRET). Without it OpenChamber 2.7.0 writes a key to its data directory and reuses it, so a browser stayed signed in across restarts and password changes, and the agent could read the file.
The policy is a read-only /etc/openchamber/policy.json that the launcher generates and mounts from a descriptor inside the sandbox (the host's file is not visible there): enterprise mode (no tunnels, public relay, classification service, adding providers in the app), the installed OpenCode 2 pinned, allowNetworkAccess: true for the private network, no extensions. It is a file, not environment variables, because without one a saved opencodeBinary in OpenChamber's settings.json (which the agent can write) overrides OPENCODE_BINARY; only a policy file outranks it. Copilot's review found this: a fake OpenCode named in settings.json ran with the environment alone, and did not run with the file.
No host OPENCODE_* or OPENCHAMBER_* variable reaches the server, and no OpenChamber argument is passed through.
Finds a Node.js that is new enough, not just the first on PATH: BWOPENCHAMBER_NODE if set, else the node on PATH if it is 24.14 or newer, else the newest node-24 / nodejs24 in /usr/bin and /usr/local/bin that is (RHEL 10 keeps nodejs 22 as the default and nodejs24 installs node-24 beside it). With no node on PATH it takes the newest versioned one (a bug found in Copilot's review: it first took the first one found). When none qualifies the error lists what it found with versions and what to do. Checked on the real host with no stubs: it lists /usr/bin/node and /usr/bin/node-22 (both 22.23.2), and BWOPENCHAMBER_NODE set to a pixi Node 24.22.1 launches. On babelfish (RHEL 10.2) the dry run, with no override, uses /usr/bin/node-24 (24.21.0, from nodejs24, installed next to the default 22.23.2), and a real launch started the server, the pinned OpenCode and the browser terminal's node-pty. The matching install is NSLS2/ansible#5064.
The data directory is bound whole and read-write, so it is checked in bind mode: a symlink to a directory that contains a blocked path (~/.config/gh) is refused, and the resolved path is what is mounted (found in Copilot's review; _check_dir_safe had accepted it).
OpenChamber's data directory is ~/.local/share/bwopenchamber, apart from any OpenChamber run outside a sandbox. Its run/ directory is an empty tmpfs, because OpenChamber writes the UI password there in plain text (checked with 2.7.0).
bwopencode2 --serve: sign-in block and --serve-open
When the server answers, the wrapper inside the sandbox prints one block: the ssh -L command and the ssh_config alias, the one-time sign-in link for http://127.0.0.1:PORT, the same link as a google-chrome --app=... command (an app window without tabs), the link for this host and the password. A link works once and expires after 5 minutes and an ssh tunnel can take longer to set up, so Enter in the terminal asks the server for a new one. The wrapper only reads Enter when it has a terminal and stops at end of input. A backslash or double quote in a fixed password is now escaped for curl's config file.
--serve-open is --serve plus a browser on the same host, so it works by itself (--serve --serve-open means the same) and --serve alone opens nothing. It starts a helper on the host, outside the sandbox, just before the sandbox replaces the launcher. The helper waits for the server, asks it for a one-time link of its own and starts the browser detached: google-chrome --app=LINK (or google-chrome-stable, chromium, chromium-browser), else firefox, else xdg-open but only when xdg-mime names a default web browser for http (the scheme of the link). BWOPENCODE2_SERVE_BROWSER names another one. With no desktop session (DISPLAY and WAYLAND_DISPLAY unset) or no browser it opens nothing and says so; --dry-run opens nothing.
The --serve-open terminal output is short, since it is for the host you are on: one line, OpenCode web UI on ADDR:PORT, opened in google-chrome., or, if no browser opened (none found, no desktop session, the browser exited with an error within 8 seconds, the server never answered), a fresh one-time link to open by hand, how to get another (Enter), and the password for "Use password" (only there). --serve output is unchanged.
The helper closes the launcher's descriptors before starting the browser. Found in Copilot's review of this PR and reproduced: the browser inherited the database session lock and held it as long as its window was open, so the next launch on the same data directory would have been refused. A test fails without the fix.
Why xdg-open is guarded: on a workstation with no browser, xdg-open handed the link to the GNOME text editor, which showed "Could Not Open File, HTTP Client Error: Unauthorized".
Only a browser signs in. The server redirects to / and sets the cookie only for Accept: text/html; curl or the text editor get a JSON token and use up the code (checked with OpenCode 2.2.7).
Known limit (documented in docs/bw-wrappers.md). OpenChamber puts its credentials into the environment of the OpenCode it starts, so the agent's shell has OPENCHAMBER_UI_PASSWORD, OPENCODE_SERVER_PASSWORD, OPENCODE_PASSWORD and the new OPENCODE_JWT_SECRET (checked in a running session). With them an agent could sign in to the UI (or sign a cookie itself) or call its own OpenCode server and so change settings or answer its own permission prompts. Nothing leaves the sandbox. The launcher cannot remove them, and hiding them only from the agent's shell would not help, because a process of the same user can read the server's environment from /proc. The agent is told not to use them; that is an instruction, not a control.
Sourcing bwopencode2 is the smallest change but couples the two launchers. Is a follow-up PR that moves the shared code into lib/ after Feat/bwrap private netns #37 the right way to untangle it?
Sharing the --serve port pool and claim directory means one alias covers both. Any objection to the two sharing it?
--share-net is still accepted. The server then binds the user's publish address on the host network, and OpenCode's own port is on the host's loopback behind its own random password. Keep it as the escape hatch for hosts without pasta or slirp4netns, or refuse it for OpenChamber?
The published 127.H1.H2.1 address is not access control (the Feat/bwrap private netns #37 docs say so); another local user can connect, and the UI password keeps them out. Is that acceptable for a UI that gives a terminal, or should this wait for per-user access control on published ports?
OpenChamber's own outbound traffic (update checks, GitHub) goes through the private network and is logged, but nothing filters it.
On a real launch ss -ltnp shows the published socket owned by platform-python (the network log's helper) and not by pasta. Is that expected?
Copilot's review summary of the second push says pasta startup "releases the database session lock", with no detail. Checked on a real launch (fuser on the lock file while a bwopencode2 session ran on pasta): the lock is held for the whole session and released after it ends, but only by the network log's helper processes (a forked copy of the launcher shell and its condenser), which inherited the descriptor before the launcher execed into pasta; pasta, bwrap and OpenCode do not hold it. By reading the code, with no log tool (neither systemd-cat nor logger) there is no helper and the lock would be released at the exec; that is not tested. It is Feat/bwrap private netns #37's launch code and affects bwopencode2 too, so the fix belongs there (I've asked Thomas A Caswell (@tacaswell) on Feat/bwrap private netns #37); the new paragraph in docs/bw-wrappers.md records what was found.
Separately, Copilot's fourth review found a real bug with --share-net, and I confirmed it: oc2db_guard put the session lock on bash's first free descriptor (10 or 11), and the launcher's descriptor relay hands the sandbox its data on descriptors 10 and up, opening them over whatever is there. The relay closed the lock, so with bwopenchamber (policy 10, context 11) the lock was released while the sandbox ran; bwopencode2 (context 10, lock 11) kept it by luck. Fixed in lib/opencode2-db-lock.sh: the lock is now on a descriptor from 200 up. A lock on 200 stayed held through the real relay and a real bwrap. Two new checks in tests/test-opencode2-db-guard.sh (82 now) fail on the old code and pass on the new. With pasta, pasta closes the descriptor before the relay runs, so the relay never meets it there and the position described above is unchanged.
--serve-open puts the one-time link on the browser's command line, so another user of the host can read it with ps for the moment the browser starts and sign in first (30-day cookie). The published address already accepts every local user, with the password as the only protection, and the link works once and expires in 5 minutes. A local redirect file would avoid it but could not be tested here. Acceptable, or should it wait for that? (docs/bw-wrappers.md says not to use it on a host where others log in.)
The weak directory check described above (_check_dir_safe on a directory bound whole, which accepts a symlink to a directory containing ~/.config/gh) is on main in bwopencode2 (data, cache, TUI state) and, by reading, in bwclaude, bwcodex, bwcopilot and bwopencode. Reproduced for bwopencode2 and fixed here only for bwopenchamber; a comment on Feat/bwrap private netns #37 has the details and the suggested _bwrap_canonicalize_safe fix.
Not in this PR: the ansible install (pinned @openchamber/web, Node 24.14 or newer), and OpenChamber is not on the approved-tools list, so DSSI approval is needed before any rollout.
Testing
Tested on a workstation with a test install of OpenChamber 2.7.0 (not through ansible), with OpenCode 2.2.7.
A real launch (bwopenchamber --port 24700, pasta):
The host has one new listener, 127.H1.H2.1:24700, and nothing on 3000 or on OpenCode's port. Without a password the API gives 401, the same port on 127.0.0.1 is refused, and OpenCode's own port is refused from the host.
A browser signed in through an ssh -L tunnel and an agent session worked through the model gateway.
OpenChamber's browser terminal runs inside the sandbox: BWRAP_SANDBOX is bwopenchamber, ~/.ssh does not exist, ssh is masked and BWRAP_NET_BACKEND is pasta.
After Ctrl-C the OpenCode that OpenChamber started is gone.
The database guard refused to start next to an older OpenCode build, as designed.
The sign-in key was checked against the real server in a private network namespace: without a key a cookie survives a restart and a new password and jwt-secret is written; with a new key per run the cookie is refused after a restart (401), signing in again works, and no file is written.
Tests and lint
tests/test-bwopenchamber.sh: 104 checks through --dry-run (argument refusals, a symlinked data directory (refused when it leads to a directory containing .config/gh), the environment and mounts built, the generated policy file, hostile host variables dropped, password and sign-in key handling, Node and install checks). tests/bwopenchamber-harness accepts the development machine's bwrap, and stubs the port probe, so a running session holding the first port cannot change the result (Copilot found that it did; checked that without the stub the same scenario gives the next port). The library's owner check is not changed for real runs. Two checks in the first version could not fail, because --dry-run prints variables named PASSWORD or SECRET as REDACTED; they now check the names.
tests/test-opencode2-db-guard.sh: 82 of 82 pass. tests/test_serve_timeout.py passes. bwopencode2 still runs main when executed directly and through a symlink.
pixi run -e dev lint on all files passes (every hook, including actionlint and zizmor), and the commit hook passes on the staged files.
--serve-open and the sign-in block
tests/test_serve_signin.py (25 tests, with tests/test_serve_timeout.py 73 pass in the whole suite): the in-sandbox wrapper against a fake server (the password reaches it through curl, including a quote and a backslash; a new code on Enter through a pseudo-terminal; no spinning at end of input; a failed pairing) and the host helper against a stub browser (--app= link, plain link, login page when no link came, a launcher that has gone, a helper that survives the launcher's exec, nothing on --dry-run, no password in the browser's arguments).
tests/test-bwopencode2-serve.sh: 57 checks through --dry-run (arguments, --serve-open by itself and with --serve, browser choice, no desktop session, no browser installed, a registered default browser, firefox). tests/bwopencode2-harness accepts the development machine's bwrap and stubs the port probe, as for bwopenchamber.
A real launch on babelfish (RHEL 10.2, Wayland) with a stand-in browser script: the helper started it once the server answered, with the right link; a browser-style fetch of the link gave 302 to / and the login cookie (value not logged). With no browser installed it opens nothing and says so. After installing Google Chrome, --serve-open works there.
Not tested: git and worktrees from OpenChamber, an install through ansible on a managed host, Enter for a new link inside the real sandbox's terminal (only through a pseudo-terminal), and --serve-open over ssh -X.
Checklist
Edit the sections above with relevant information
Update in-repo documentation, if applicable
Run pixi run -e dev lint locally (or wait for CI) — see .github/workflows/lint.yml
Test the changes on a representative managed host (or runansible deployment)
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The documentation needs to clarify that private-network mode does not block local access to the published OpenChamber UI and that the UI password controls access in both modes.
Adds bwopenchamber to run OpenChamber and its managed OpenCode server within one bubblewrap sandbox, keeping terminals and tool execution isolated. It builds on #37’s private networking; the current diff also includes that dependency’s changes.
Changes:
Reuses OpenCode 2 sandbox setup, database protection, and port allocation.
Adds OpenChamber-specific policy, passwords, isolated data storage, tests, and documentation.
Includes private-network support, network logging, and CI tooling updates from the dependency.
File
Description
tests/test-bwopenchamber.sh
Tests launcher arguments, mounts, environment, and passwords.
tests/test_serve_timeout.py
Checks pairing-request timeout handling.
tests/test_netlog.py
Tests network-log parsing and DNS relay behavior.
tests/fakes/pasta-bin/pasta
Provides a fake pasta backend.
tests/fakes/bin/unshare
Simulates namespace setup and failures.
tests/fakes/bin/systemd-cat
Captures journal output for tests.
tests/fakes/bin/slirp4netns
Provides a fake slirp4netns backend.
tests/fakes/bin/logger
Captures syslog output for tests.
tests/fakes/_nsproxy.py
Shares namespace and forwarding test helpers.
tests/fake-net-run
Runs launchers with fake network backends.
tests/bwopenchamber-harness
Adapts launcher setup for isolated tests.
README.md
Lists OpenChamber and networking requirements.
pixi.toml
Adds actionlint and a unit-test task.
pixi.lock
Locks actionlint packages across platforms.
lib/bwrap_netlog.py
Adds network-log condensation and DNS logging.
docs/bw-wrappers.md
Documents networking and OpenChamber operation.
bin/bwopencode2
Adds server support and permits sourcing shared functions.
bin/bwopencode
Integrates private networking and prek cache mounts.
bin/bwopenchamber
Implements the sandboxed OpenChamber launcher.
bin/bwcopilot
Integrates networking and descriptor-based config delivery.
bin/bwcodex
Integrates networking and descriptor-based file delivery.
bin/bwclaude
Integrates networking and descriptor-based credential delivery.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Critical issues allow saved settings to override the guarded executable and pasta startup to release the database session lock, risking shared-database corruption.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The test harness probes real host sockets, allowing existing sessions to change port selection and break hard-coded assertions or exhaust the port pool.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Stub host socket probe in dry-run port selection tests
tests/bwopenchamber-harness:17
The harness still probes real host sockets when choosing the server port. The publish address depends on the UID, not the temporary HOME, so running these tests while a real bwopenchamber or bwopencode2 --serve session occupies port 24700 selects 24701 and fails the hard-coded port and tunnel assertions; a full pool makes otherwise valid launches fail entirely. Please stub the availability probe here so these dry-run fixtures are independent of existing sessions.
…ests independent of sessions
Copilot review of NSLS2#43 found two real problems, both checked.
Pinning. The launcher passed OPENCODE_BINARY and the docs called OpenCode pinned. Without a policy file OpenChamber 2.7.0 lets a saved opencodeBinary in settings.json override OPENCODE_BINARY, and settings.json is in the persistent data directory that the agent can write. A fake OpenCode named there ran. Only a policy file outranks the saved setting. The launcher now generates /etc/openchamber/policy.json and mounts it read-only from a descriptor (enterprise mode, the installed OpenCode pinned, allowNetworkAccess true for the private network, no extensions, built-in skills catalogues hidden). With it the installed OpenCode started and the fake never ran, and the server still listened on 0.0.0.0. OPENCHAMBER_ALLOW_NETWORK_ACCESS is dropped: the file governs, and with the file missing the server now fails closed instead of running unpinned.
Tests. The harness probed real sockets on the user's publish address, so a running bwopenchamber or bwopencode2 --serve session holding 24700 made every dry run pick 24701 and fail the checks that expect the first port. The probe is stubbed. Without the stub the same scenario gives 24701; with it 24700. New checks cover the generated policy and that a held port changes nothing.
Assisted-by: opencode:claude-sonnet-5-5
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
A critical descriptor collision releases the database session lock before sandbox exit, allowing another host to concurrently open the same NFS-backed SQLite database.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The network-accessible terminal and agent-readable control credentials require maintainer security review, while managed-host deployment and git/worktree integration remain unvalidated atop draft PR #37.
…x relay uses
oc2db_guard took the session lock on bash's first free descriptor (10 or 11). The launcher's descriptor relay hands the sandbox its files and data on descriptors 10 and up and opens them over whatever is there, closing the lock and so releasing it while the sandbox runs. bwopencode2 with --share-net (one data descriptor, the lock on 11) kept it by luck; bwopenchamber (policy 10, context 11, lock 11) lost it. Found in Copilot's review of NSLS2#43 and reproduced with the real relay shim and a real bwrap.
The lock is now on the first free descriptor from 200 up. A lock on 200 stayed held through the real relay and bwrap. With pasta the relay never sees it (pasta closes inherited descriptors first), so that path is unchanged. Two new checks open descriptors 10 to 29 through the real relay and assert the lock is above 199 and still held; both fail on the old code. 82 guard checks and the 95 bwopenchamber checks pass.
Assisted-by: opencode:claude-sonnet-5-5
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The resolver can stop at the first versioned Node binary when no unversioned node exists on PATH, selecting an older qualifying version instead of the documented newest one.
…ne on PATH
The resolver treated the first candidate as the node on PATH and stopped there when it was new enough. With no node on PATH the first candidate is the first versioned binary (node-24 sorts before node-25), so it chose that one instead of the newest, which the docs promise. Track the node found on PATH explicitly and prefer only that. A test with a PATH that holds no node and node-24 and node-25 in the search directory fails on the old code (it picked node-24) and passes now; 97 checks pass. Found by Copilot's review of NSLS2#43.
Assisted-by: opencode:claude-sonnet-5-5
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The browser-accessible terminal, agent-readable credentials, and network-sharing escape hatch warrant human security review, compounded by reliance on draft #37 and unvalidated managed deployment and git/worktree integration.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because multiple critical sandbox-boundary risks could allow host-side code execution or expose host credentials and session sockets.
bwopenchamber sources this file for its OpenCode 2 mounts, environment and --serve port pool. Running the launcher, directly or through a symlink, is unchanged.
Assisted-by: opencode:claude-sonnet-5-5
OpenChamber is a web server that starts its own opencode serve and adds a terminal, git and worktree handling. All of that does work, so it all runs in one sandbox: the server, its OpenCode, the shells, git and every tool call. Only the browser is outside, behind an ssh tunnel.
The launcher sources bwopencode2 for the OpenCode 2 mounts, the database guard and the --serve port pool, so one ssh_config alias covers both. The port is published on the user's 127.H1.H2.1; the server listens on 0.0.0.0 inside the private network. A random UI password is set for each session.
Enterprise mode is forced on through the environment and /etc/openchamber/policy.json is not mounted, because a policy file would override it. OPENCODE_BINARY is pinned and no host OPENCODE_* or OPENCHAMBER_* variable reaches the server. OpenChamber's run/ directory, where it writes the UI password in plain text, is a tmpfs. No OpenChamber argument is passed through.
Assisted-by: opencode:claude-sonnet-5-5
SCRIPT_DIR came from $0, which is the running script. When bwopenchamber or a test sources bwopencode2 from another directory, the library was looked up next to that script, so it only worked by accident. BASH_SOURCE[0] is the same value when bwopencode2 runs directly or through a symlink.
Assisted-by: opencode:claude-sonnet-5-5
… limits
OpenChamber 2.7.0 signs sign-in cookies with a key it writes to jwt-secret in its data directory and reuses. A browser that signed in stayed signed in across restarts and after the password changed, and the agent could read the file. The launcher now sets a random OPENCODE_JWT_SECRET for each session; checked against the real server that the old cookie is refused after a restart and that no jwt-secret file is written.
The docs now say that the published 127.H1.H2.1 address is not access control (any local user can connect, the UI password keeps them out), which the first version of this launcher got wrong. They also record that the agent can read the UI and server passwords OpenChamber puts in its environment, checked in a running session, and that hiding them from the agent's shell would not help because /proc/PID/environ is readable by the same user. The agent is told in the sandbox context not to use them.
The checks made on a real launch move from not checked to checked. Two tests that could not fail are fixed: --dry-run prints variables named PASSWORD or SECRET as REDACTED, so they now check the names.
Assisted-by: opencode:claude-sonnet-5-5
Checked in a running session: the agent's shell has OPENCODE_JWT_SECRET set (printenv | grep -c prints 1). The per-session key stops a reusable key being stored, but an agent can still sign a cookie for the current session. Say so under the sign-in key and in the known limit.
Assisted-by: opencode:claude-sonnet-5-5
…ests independent of sessions
Copilot review of NSLS2#43 found two real problems, both checked.
Pinning. The launcher passed OPENCODE_BINARY and the docs called OpenCode pinned. Without a policy file OpenChamber 2.7.0 lets a saved opencodeBinary in settings.json override OPENCODE_BINARY, and settings.json is in the persistent data directory that the agent can write. A fake OpenCode named there ran. Only a policy file outranks the saved setting. The launcher now generates /etc/openchamber/policy.json and mounts it read-only from a descriptor (enterprise mode, the installed OpenCode pinned, allowNetworkAccess true for the private network, no extensions, built-in skills catalogues hidden). With it the installed OpenCode started and the fake never ran, and the server still listened on 0.0.0.0. OPENCHAMBER_ALLOW_NETWORK_ACCESS is dropped: the file governs, and with the file missing the server now fails closed instead of running unpinned.
Tests. The harness probed real sockets on the user's publish address, so a running bwopenchamber or bwopencode2 --serve session holding 24700 made every dry run pick 24701 and fail the checks that expect the first port. The probe is stubbed. Without the stub the same scenario gives 24701; with it 24700. New checks cover the generated policy and that a held port changes nothing.
Assisted-by: opencode:claude-sonnet-5-5
…etwork
The database guard section said the lock is a descriptor that the final exec passes on to bwrap. With a private network the launcher execs into pasta, which closes inherited descriptors, so nothing in the sandbox holds it. On a real launch fuser on the lock file showed only the network log's helper processes (a forked copy of the launcher shell and its condenser) holding it; it was held all session and gone after exit. So the guard works, but through inheritance by a helper started before the exec.
Record that, and the two cases the code implies but that were not tested: no log tool, so no helper, and a helper stopped mid-session. Prompted by a Copilot review summary that said pasta releases the lock: the claim is wrong for the normal launch and right in outline for those cases.
Assisted-by: opencode:claude-sonnet-5-5
…one on PATH
The launcher took the first node on PATH and stopped if it was older than 24.14. On RHEL 10 the default node is 22 and the nodejs24 package installs node-24 next to it, so a new enough Node was installed and the launcher still refused. Resolve it in this order: BWOPENCHAMBER_NODE if set (only that one; an error if too old), the node on PATH if it is new enough, then the newest node-24 or nodejs24 style binary in /usr/bin and /usr/local/bin that is. The error lists what was found with versions and what to do on RHEL 10, RHEL 8 and 9, and with BWOPENCHAMBER_NODE (for example a pixi Node).
Checked on the real host with no stubs: /usr/bin/node and /usr/bin/node-22 are both 22.23.2 and the message lists them; BWOPENCHAMBER_NODE set to a pixi Node 24.22.1 launches. The tests are hermetic by default (the versioned search points at an empty directory) and cover each rule, a binary that is not node and one that is not executable. RHEL 9 (runansible1) has 24.21.0 on PATH from the nodejs:24 module and RHEL 10 offers nodejs24 24.19.0 through Satellite; whether nodejs24 installs a binary called node-24 is inferred from node-22 being there, not checked.
Assisted-by: opencode:claude-sonnet-5-5
…x relay uses
oc2db_guard took the session lock on bash's first free descriptor (10 or 11). The launcher's descriptor relay hands the sandbox its files and data on descriptors 10 and up and opens them over whatever is there, closing the lock and so releasing it while the sandbox runs. bwopencode2 with --share-net (one data descriptor, the lock on 11) kept it by luck; bwopenchamber (policy 10, context 11, lock 11) lost it. Found in Copilot's review of NSLS2#43 and reproduced with the real relay shim and a real bwrap.
The lock is now on the first free descriptor from 200 up. A lock on 200 stayed held through the real relay and bwrap. With pasta the relay never sees it (pasta closes inherited descriptors first), so that path is unchanged. Two new checks open descriptors 10 to 29 through the real relay and assert the lock is above 199 and still held; both fail on the old code. 82 guard checks and the 95 bwopenchamber checks pass.
Assisted-by: opencode:claude-sonnet-5-5
…ne on PATH
The resolver treated the first candidate as the node on PATH and stopped there when it was new enough. With no node on PATH the first candidate is the first versioned binary (node-24 sorts before node-25), so it chose that one instead of the newest, which the docs promise. Track the node found on PATH explicitly and prefer only that. A test with a PATH that holds no node and node-24 and node-25 in the search directory fails on the old code (it picked node-24) and passes now; 97 checks pass. Found by Copilot's review of NSLS2#43.
Assisted-by: opencode:claude-sonnet-5-5
Print the ssh command, a one-time sign-in link and a google-chrome --app
command in one block once the server is up, and a new link when Enter is
pressed. --serve-open starts a browser on the host, outside the sandbox, with
a pairing link of its own.
Assisted-by: opencode:claude-sonnet-5-5
…ut a browser
With no browser installed and none registered, xdg-open on GNOME opens the
link in the text editor, which shows an Unauthorized error and uses up the
one-time link. Use xdg-open only when xdg-mime names a default web browser,
try firefox before it, and otherwise say that nothing will be opened.
Assisted-by: opencode:claude-sonnet-5-5
…ve link
The server redirects and sets the cookie only for Accept: text/html; curl or the GNOME text editor get a JSON token and use up the one-time code.
Assisted-by: opencode:claude-sonnet-5-5
…en browser
The helper inherited the database session lock descriptor and so did the browser it started, which then held the lock for as long as its window stayed open and made the next launch on the same data directory fail. Close every descriptor above 2 in the helper.
Also check the default browser for http, the scheme of the sign-in link, not https.
Assisted-by: opencode:claude-sonnet-5-5
--serve-open is now --serve plus a browser on the same host, so it needs no --serve next to it, and --serve alone still opens nothing. --serve-port also works with --serve-open.
Assisted-by: opencode:claude-sonnet-5-5
… blocked path
The data directory is bound whole and read-write, but it was only checked with _check_dir_safe, which accepts a symlink to a directory that contains ~/.config/gh. Check it in bind mode and mount the resolved path.
Assisted-by: opencode:claude-sonnet-5-5
For the host you are on, print one line when the browser opened, or only a fresh one-time link to open by hand with the password when it did not (no browser, no desktop session, the browser exited with an error within 8 seconds, or the server never answered). --serve prints the same block as before.
Assisted-by: opencode:claude-sonnet-5-5
actionlint became a local pixi hook, so its repo entry is gone and the grep exited 1, stopping every lint job in Collect tool versions under pipefail.
Assisted-by: opencode:claude-sonnet-5-5
…caping, hold bwopenchamber's lock
Copilot's review of NSLS2#37 named two problems in the --serve code, and a third gap is closed here.
- Port claims: two launches that start together and both see a stale claim file could each remove the other's new file and end up with the same port. serve_choose_port now holds an flock on claims.lock in the state directory while it cleans up stale claims and claims a port, and releases it before the sandbox starts (without flock it warns, as the publish-address claim does). tests/test_serve_claims.py starts six launches at once against stale files, and a launch that must wait for a held lock; both fail without the lock.
- Password: both pairing calls already escape a backslash and a double quote before writing curl's config. Add the missing test for the host-side one (serve_request_code), and refuse a BWOPENCODE2_SERVE_PASSWORD with a control character, a newline for one, which would add a second line to curl's config. The help texts and docs say so.
- bwopenchamber registers its database lock with net_hold_fd, as bwopencode2 does since the holder commit in NSLS2#37, so its lock is held under pasta without a log tool. Tests start the real guard against a temporary data directory for both launchers.
- docs/bw-wrappers.md: the lock under a private network is now held by the holder (it described the accident), and the claims lock is described.
Assisted-by: opencode:claude-sonnet-5-5
Assisted-by: opencode:gpt-6-astra
…em directories only
The --serve-open helper runs on the host, outside the sandbox, for as long as it waits for the server (up to a minute) and then starts the browser. It found curl, sleep, setsid, grep and basename through the launcher's PATH, which can include a directory the sandbox can write to (an activated project environment, for one): an agent could replace one of those tools and have it run on the host. Copilot's review of NSLS2#43 reported it.
serve_open_detached now sets PATH=/usr/bin:/bin before it runs the helper, as the launcher already does for the exec, and as the database lock holder does with /usr/bin/sleep. The browser stays the full path chosen before the sandbox started; it and its children get the same PATH, which the docs say. A test puts fakes of the five tools in a directory first on PATH and checks that none ran; it fails without the change.
Assisted-by: opencode:claude-sonnet-5-5
…tories only
The browser is started on the host, outside the sandbox, but it was found with command -v on the launcher's PATH, which can include a directory the sandbox can write to (an activated project environment, ~/.pixi). An agent could plant a chromium or firefox there and have it run outside the sandbox. Copilot's review of NSLS2#43 reported it on the last commit.
The browser, xdg-open and xdg-mime are now looked up in /usr/bin, /usr/local/bin and /snap/bin only. A program is used only when it, the file it resolves to through symlinks and the directories that hold them are owned by root and not writable by group or others; one that is not is skipped. BWOPENCODE2_SERVE_BROWSER takes a name in those directories or an absolute path, under the same rule, and stops the launch with a message when it fails. There is no switch to turn the check off.
The harness takes the directories and the owner from HARNESS_SERVE_OPEN_DIRS and HARNESS_SERVE_OPEN_UID, so the stubs can be owned by the test user; the real rule is tested too. 18 of the new checks fail without the change.
Assisted-by: opencode:claude-sonnet-5-5
…re directory
The negative check for files not owned by root cleared the harness directories and so searched the real system directories: on a workstation with a root-owned Chrome or Firefox it found one and failed. It now keeps the stub directory, where the stubs are refused because the test user owns them. The check that a system browser is found with the real directories still runs only where one is installed, and now looks for any of the launcher's candidates in any of its directories instead of the first one on PATH. Copilot's review of NSLS2#43 reported it.
Assisted-by: opencode:claude-sonnet-5-5
…mal environment, drop BWOPENCODE2_SERVE_BROWSER
Copilot's review of NSLS2#43 said inherited startup and loader variables and replaceable browser paths can run agent-controlled code outside the sandbox.
The helper's curl, sleep, setsid, grep and basename, and the browser, now run under env -i with PATH=/usr/bin:/bin and only the variables a desktop program needs (HOME, USER, LANG, LC_*, DISPLAY, WAYLAND_DISPLAY, XAUTHORITY, XDG_RUNTIME_DIR, DBUS_SESSION_BUS_ADDRESS and a few more). LD_PRELOAD, LD_LIBRARY_PATH (an activated project environment sets it), BASH_ENV, ENV, BROWSER, XDG_DATA_DIRS and the rest no longer reach them. A test starts the helper with those set and a browser that records its environment; it fails without the change.
BWOPENCODE2_SERVE_BROWSER is removed. An absolute path from the caller would have to be checked up to the root, since a root-owned file under a directory the user owns can be swapped by renaming the directory, and the choice is not worth that. The browser is found by name in /usr/bin, /usr/local/bin and /snap/bin only, as before. A leftover variable is ignored, and a test says so.
Assisted-by: opencode:claude-sonnet-5-5
…-open fallback
Copilot's review of NSLS2#43 named Node probing and HTTP handler launches as ways to run agent-controlled code outside the sandbox.
bwopenchamber ran 'node --version' on the host for every candidate, including the node on PATH, which can be in a directory the sandbox can write to (~/.pixi/bin, where pixi global installs node). The probe now runs in a sandbox of its own: bwrap with the file system read-only, all namespaces unshared and an empty environment (env -i, for bwrap too, which keeps it working with bwrap 0.4.0). A replaced node can only print a version; the one chosen runs in the real sandbox as before. A test puts a node on PATH that tries to write a file and is still chosen; the write fails, and the test fails without the change.
bwopencode2 --serve-open no longer falls back to xdg-open. It started whatever ~/.config/mimeapps.list and a .desktop file named, which the launcher cannot check, and xdg-mime, a shell script, ran on the host to decide. Only google-chrome, google-chrome-stable, chromium, chromium-browser and firefox, checked as before, are started; without one the link is printed to open by hand.
Assisted-by: opencode:claude-opus-5-5
Copilot's review of NSLS2#43 named inherited loader variables as a risk. A loader or shell start-up variable in the shell that starts a launcher (LD_PRELOAD, LD_LIBRARY_PATH, BASH_ENV, ENV) takes effect in the launcher's bash before its first line, so the launcher cannot defend against it; re-running under env -i would lose the variables it needs. The new section says not to point them into a directory the sandbox can write to, and lists what the launchers already start with a clean environment.
Assisted-by: opencode:claude-opus-5-5
…and /tmp
Copilot's review of NSLS2#43 (on cdfa67b) said a replaced node could still reach host credentials and Unix sockets from its version probe. It could: the probe bound the whole file system read-only, so a planted node could read ~/.ssh, the N2C tokens in /run/user and connect to Unix sockets such as the D-Bus session bus, which a network namespace does not stop.
The probe now sees, read-only, only /usr, /bin, /sbin, /lib, /lib64 and /etc, the candidate's directory and that of the file it resolves to, and that file's PREFIX/lib (a conda or pixi environment), with an empty /tmp. A node directly in the home directory or above it is not probed. A pixi global trampoline in ~/.pixi/bin starts a node the probe cannot see and is no longer found; BWOPENCHAMBER_NODE can name the real one, as the docs say. The system node, node-24 and a pixi exec node were checked by hand. The test's planted node now reports a usable version only when it could read nothing outside its own directory; it and the home-directory check fail without the change.
Assisted-by: opencode:claude-opus-5-5
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
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.
Summary
Adds
bwopenchamber, which runs OpenChamber (a web UI for OpenCode) in the same bubblewrap sandbox as its OpenCode, so the terminal, git, worktrees and every tool call stay sandboxed and only the browser is outside, behind an ssh tunnel.Also changes
bwopencode2 --serve(from #37) so it is easier to sign in to: one block with thessh -Lcommand, a one-time sign-in link and agoogle-chrome --app=...command, a new link on Enter, and--serve-open, which opens the signed-in web UI in a browser on the same host. These are six commits at the end of the branch and are independent ofbwopenchamber.This depends on #37 and should not merge before it. It uses that PR's private network namespace and publish address, so until #37 merges this PR also shows #37's commits. Review only the 17 commits after #37's tip
e8738f0(git log e8738f0..lists them): eleven forbwopenchamberand its sign-in, database-lock and data-directory fixes, and six forbwopencode2 --serve-openand the sign-in block (feat(bwopencode2): add --serve-open and a sign-in block for --serve,fix(bwopencode2): do not hand the --serve-open link to xdg-open without a browser,docs(bwopencode2): record that only a browser signs in with the --serve link,fix(bwopencode2): keep the launcher's descriptors from the --serve-open browser,feat(bwopencode2): make --serve-open work without --serve, and the cleaned-up--serve-openterminal output). Once #37 merges, the diff here shrinks to those.Description
Why a launcher of its own, and not
bwopencode2 --servebehind an OpenChamber on another machine. OpenChamber is not only a screen. Its server runs the browser terminal, git and worktree commands, project start commands and scheduled tasks, and it gives the agent tools that call back into it. Run outside the sandbox in front of a sandboxed OpenCode, all of that would run unsandboxed. So the whole server runs inside one sandbox.What it does
bin/bwopencode2(it now runsmainonly when executed, and finds its library from its own file) for the OpenCode 2 mounts, environment, database guard and the--serveport pool, so a fix made there applies to both. Moving that shared code intolib/is deliberately left for after Feat/bwrap private netns #37 lands, becausebwopencode2is being rewritten there.--serve(24700-24709), published on the user's127.H1.H2.1; one ssh_config block (--ssh-config) covers both. The server listens on0.0.0.0inside the private network, as--servedoes.BWOPENCODE2_SERVE_PASSWORD), passed only in the sandbox environment.OPENCODE_JWT_SECRET). Without it OpenChamber 2.7.0 writes a key to its data directory and reuses it, so a browser stayed signed in across restarts and password changes, and the agent could read the file./etc/openchamber/policy.jsonthat the launcher generates and mounts from a descriptor inside the sandbox (the host's file is not visible there): enterprise mode (no tunnels, public relay, classification service, adding providers in the app), the installed OpenCode 2 pinned,allowNetworkAccess: truefor the private network, no extensions. It is a file, not environment variables, because without one a savedopencodeBinaryin OpenChamber'ssettings.json(which the agent can write) overridesOPENCODE_BINARY; only a policy file outranks it. Copilot's review found this: a fake OpenCode named insettings.jsonran with the environment alone, and did not run with the file.OPENCODE_*orOPENCHAMBER_*variable reaches the server, and no OpenChamber argument is passed through.PATH:BWOPENCHAMBER_NODEif set, else thenodeonPATHif it is 24.14 or newer, else the newestnode-24/nodejs24in/usr/binand/usr/local/binthat is (RHEL 10 keepsnodejs22 as the default andnodejs24installsnode-24beside it). With nonodeonPATHit takes the newest versioned one (a bug found in Copilot's review: it first took the first one found). When none qualifies the error lists what it found with versions and what to do. Checked on the real host with no stubs: it lists/usr/bin/nodeand/usr/bin/node-22(both 22.23.2), andBWOPENCHAMBER_NODEset to a pixi Node 24.22.1 launches. On babelfish (RHEL 10.2) the dry run, with no override, uses/usr/bin/node-24(24.21.0, fromnodejs24, installed next to the default 22.23.2), and a real launch started the server, the pinned OpenCode and the browser terminal'snode-pty. The matching install is NSLS2/ansible#5064.~/.config/gh) is refused, and the resolved path is what is mounted (found in Copilot's review;_check_dir_safehad accepted it).~/.local/share/bwopenchamber, apart from any OpenChamber run outside a sandbox. Itsrun/directory is an empty tmpfs, because OpenChamber writes the UI password there in plain text (checked with 2.7.0).bwopencode2 --serve: sign-in block and--serve-openssh -Lcommand and the ssh_config alias, the one-time sign-in link forhttp://127.0.0.1:PORT, the same link as agoogle-chrome --app=...command (an app window without tabs), the link for this host and the password. A link works once and expires after 5 minutes and an ssh tunnel can take longer to set up, so Enter in the terminal asks the server for a new one. The wrapper only reads Enter when it has a terminal and stops at end of input. A backslash or double quote in a fixed password is now escaped for curl's config file.--serve-openis--serveplus a browser on the same host, so it works by itself (--serve --serve-openmeans the same) and--servealone opens nothing. It starts a helper on the host, outside the sandbox, just before the sandbox replaces the launcher. The helper waits for the server, asks it for a one-time link of its own and starts the browser detached:google-chrome --app=LINK(orgoogle-chrome-stable,chromium,chromium-browser), elsefirefox, elsexdg-openbut only whenxdg-mimenames a default web browser forhttp(the scheme of the link).BWOPENCODE2_SERVE_BROWSERnames another one. With no desktop session (DISPLAYandWAYLAND_DISPLAYunset) or no browser it opens nothing and says so;--dry-runopens nothing.--serve-openterminal output is short, since it is for the host you are on: one line,OpenCode web UI on ADDR:PORT, opened in google-chrome., or, if no browser opened (none found, no desktop session, the browser exited with an error within 8 seconds, the server never answered), a fresh one-time link to open by hand, how to get another (Enter), and the password for "Use password" (only there).--serveoutput is unchanged.xdg-openis guarded: on a workstation with no browser,xdg-openhanded the link to the GNOME text editor, which showed "Could Not Open File, HTTP Client Error: Unauthorized"./and sets the cookie only forAccept: text/html;curlor the text editor get a JSON token and use up the code (checked with OpenCode 2.2.7).Known limit (documented in
docs/bw-wrappers.md). OpenChamber puts its credentials into the environment of the OpenCode it starts, so the agent's shell hasOPENCHAMBER_UI_PASSWORD,OPENCODE_SERVER_PASSWORD,OPENCODE_PASSWORDand the newOPENCODE_JWT_SECRET(checked in a running session). With them an agent could sign in to the UI (or sign a cookie itself) or call its own OpenCode server and so change settings or answer its own permission prompts. Nothing leaves the sandbox. The launcher cannot remove them, and hiding them only from the agent's shell would not help, because a process of the same user can read the server's environment from/proc. The agent is told not to use them; that is an instruction, not a control.Open questions for reviewers (1, 3 and 6 especially for Thomas A Caswell (@tacaswell), as the author of #37)
Sourcing
bwopencode2is the smallest change but couples the two launchers. Is a follow-up PR that moves the shared code intolib/after Feat/bwrap private netns #37 the right way to untangle it?Sharing the
--serveport pool and claim directory means one alias covers both. Any objection to the two sharing it?--share-netis still accepted. The server then binds the user's publish address on the host network, and OpenCode's own port is on the host's loopback behind its own random password. Keep it as the escape hatch for hosts without pasta or slirp4netns, or refuse it for OpenChamber?The published
127.H1.H2.1address is not access control (the Feat/bwrap private netns #37 docs say so); another local user can connect, and the UI password keeps them out. Is that acceptable for a UI that gives a terminal, or should this wait for per-user access control on published ports?OpenChamber's own outbound traffic (update checks, GitHub) goes through the private network and is logged, but nothing filters it.
On a real launch
ss -ltnpshows the published socket owned byplatform-python(the network log's helper) and not bypasta. Is that expected?Copilot's review summary of the second push says pasta startup "releases the database session lock", with no detail. Checked on a real launch (
fuseron the lock file while abwopencode2session ran on pasta): the lock is held for the whole session and released after it ends, but only by the network log's helper processes (a forked copy of the launcher shell and its condenser), which inherited the descriptor before the launcherexeced into pasta; pasta,bwrapand OpenCode do not hold it. By reading the code, with no log tool (neithersystemd-catnorlogger) there is no helper and the lock would be released at theexec; that is not tested. It is Feat/bwrap private netns #37's launch code and affectsbwopencode2too, so the fix belongs there (I've asked Thomas A Caswell (@tacaswell) on Feat/bwrap private netns #37); the new paragraph indocs/bw-wrappers.mdrecords what was found.Separately, Copilot's fourth review found a real bug with
--share-net, and I confirmed it:oc2db_guardput the session lock on bash's first free descriptor (10 or 11), and the launcher's descriptor relay hands the sandbox its data on descriptors 10 and up, opening them over whatever is there. The relay closed the lock, so withbwopenchamber(policy 10, context 11) the lock was released while the sandbox ran;bwopencode2(context 10, lock 11) kept it by luck. Fixed inlib/opencode2-db-lock.sh: the lock is now on a descriptor from 200 up. A lock on 200 stayed held through the real relay and a realbwrap. Two new checks intests/test-opencode2-db-guard.sh(82 now) fail on the old code and pass on the new. With pasta, pasta closes the descriptor before the relay runs, so the relay never meets it there and the position described above is unchanged.--serve-openputs the one-time link on the browser's command line, so another user of the host can read it withpsfor the moment the browser starts and sign in first (30-day cookie). The published address already accepts every local user, with the password as the only protection, and the link works once and expires in 5 minutes. A local redirect file would avoid it but could not be tested here. Acceptable, or should it wait for that? (docs/bw-wrappers.mdsays not to use it on a host where others log in.)The weak directory check described above (
_check_dir_safeon a directory bound whole, which accepts a symlink to a directory containing~/.config/gh) is onmaininbwopencode2(data, cache, TUI state) and, by reading, inbwclaude,bwcodex,bwcopilotandbwopencode. Reproduced forbwopencode2and fixed here only forbwopenchamber; a comment on Feat/bwrap private netns #37 has the details and the suggested_bwrap_canonicalize_safefix.Not in this PR: the ansible install (pinned
@openchamber/web, Node 24.14 or newer), and OpenChamber is not on the approved-tools list, so DSSI approval is needed before any rollout.Testing
Tested on a workstation with a test install of OpenChamber 2.7.0 (not through ansible), with OpenCode 2.2.7.
A real launch (
bwopenchamber --port 24700, pasta):127.H1.H2.1:24700, and nothing on 3000 or on OpenCode's port. Without a password the API gives 401, the same port on127.0.0.1is refused, and OpenCode's own port is refused from the host.ssh -Ltunnel and an agent session worked through the model gateway.BWRAP_SANDBOXisbwopenchamber,~/.sshdoes not exist,sshis masked andBWRAP_NET_BACKENDispasta.jwt-secretis written; with a new key per run the cookie is refused after a restart (401), signing in again works, and no file is written.Tests and lint
tests/test-bwopenchamber.sh: 104 checks through--dry-run(argument refusals, a symlinked data directory (refused when it leads to a directory containing.config/gh), the environment and mounts built, the generated policy file, hostile host variables dropped, password and sign-in key handling, Node and install checks).tests/bwopenchamber-harnessaccepts the development machine'sbwrap, and stubs the port probe, so a running session holding the first port cannot change the result (Copilot found that it did; checked that without the stub the same scenario gives the next port). The library's owner check is not changed for real runs. Two checks in the first version could not fail, because--dry-runprints variables named PASSWORD or SECRET asREDACTED; they now check the names.tests/test-opencode2-db-guard.sh: 82 of 82 pass.tests/test_serve_timeout.pypasses.bwopencode2still runsmainwhen executed directly and through a symlink.pixi run -e dev linton all files passes (every hook, including actionlint and zizmor), and the commit hook passes on the staged files.--serve-openand the sign-in blocktests/test_serve_signin.py(25 tests, withtests/test_serve_timeout.py73 pass in the whole suite): the in-sandbox wrapper against a fake server (the password reaches it through curl, including a quote and a backslash; a new code on Enter through a pseudo-terminal; no spinning at end of input; a failed pairing) and the host helper against a stub browser (--app=link, plain link, login page when no link came, a launcher that has gone, a helper that survives the launcher'sexec, nothing on--dry-run, no password in the browser's arguments).tests/test-bwopencode2-serve.sh: 57 checks through--dry-run(arguments,--serve-openby itself and with--serve, browser choice, no desktop session, no browser installed, a registered default browser, firefox).tests/bwopencode2-harnessaccepts the development machine'sbwrapand stubs the port probe, as forbwopenchamber.302to/and the login cookie (value not logged). With no browser installed it opens nothing and says so. After installing Google Chrome,--serve-openworks there.Not tested: git and worktrees from OpenChamber, an install through ansible on a managed host, Enter for a new link inside the real sandbox's terminal (only through a pseudo-terminal), and
--serve-openoverssh -X.Checklist
pixi run -e dev lintlocally (or wait for CI) — see.github/workflows/lint.ymlrunansibledeployment)Assisted-by: opencode:claude-sonnet-5-5