Repository navigation
feat(worker): loopback-only network for worker bash and a per-project setup step (AGT-4798) - #841
Merged
Merged
Conversation
… setup step (AGT-4798) Worker shell commands now reach only localhost by default (autonomous.workerNetwork: loopback | open). The macOS profile splits bind/inbound/outbound on localhost because a single network* local-ip rule was measured to admit remote connections. Dependency installs that need the network go in projectAgents[].setup, run in the worktree before the worker inside the sandbox and without credentials; a failure ends the run as infra_error before any model call. The worker prompt now states what is true and forbids probing release/deploy scripts with --help.
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.
Why
#840 (AGT-4783) took away the credentials the worker shell picked up on its own. One path stayed open: a command could still read a token file by absolute path and use it, because the sandbox allowed the network. Turning the network off closes that path.
The plan's concern was that network-off without a setup step would break workers. I measured it first, inside the real sandbox:
uv run --frozen pytestruns offline.sharedPaths.src/support/web.provider.test.ts, EPERM). That is why this PR uses loopback-only, not none.What changes
allowNetwork: false: loopback only, split by direction:network-bind/network-inboundon local localhost,network-outboundto remote localhost.(allow network* (local ip "localhost:*"))also lets remote connections through (an outbound socket's local end matches).docker.sockwould hand out a networked container.--unshare-net, which gives a loopback-only namespace.autonomous.workerNetwork: loopback | open(defaultloopback).setWorkerNetworkPolicy).openon a host whose sandbox cannot isolate the network. vela: feat: make OpenSwarm durable, concurrent, and human-surface read-only #493 notes bwrap there cannot create a network namespace, so the vela config needsopenuntil that changes.projectAgents[].setup(src/agents/workerSetup.ts): install commands that run in the worktree before the worker.buildWorkerShellEnv).infra_errorbefore any model call.runnerExecution.tsgains two lines; it sits exactly at its 1500-line cap.resolveOwningProject: extracted fromresolveProjectGoalso setup and goal resolve the owning project the same way.--help.Test plan
osSandbox.test.tstools.test.ts(live): worker bash gets loopback, gets EPERM for a remote host, andworkerNetwork: openrestores remote access.workerSetup.test.ts(8 tests)onbut missing.setupFailureBeforeWorkerreturnsinfra_errornaming the failing command.config.test.ts: theworkerNetworkdefault isloopback;openandsetupare carried through.src/adapters, osSandbox, projectGoal, config, service, runnerExecution: 1216 + 138 passed. typecheck and lint pass.runnerExecutioncall site. It is two lines delegating to the tested helper.scripts/release.shwrapsgh workflow run, run viaopenswarm exec --issue. Expect 0 workflow runs.Deploy note
vela (Docker) needs
autonomous.workerNetwork: openunless its bwrap can create a network namespace. This is a config twin.