Repository navigation
Conversation
…WE-AF and PR-AF Each image runs a pinned artifact: codeaf from a published dev release checked against its sha256, the AgentField control plane from its published image (built with sqlite_fts5) pinned by digest, SWE-AF and PR-AF built from pinned commits of their public repositories. The containers start as root only long enough to give a platform volume to the service's user, then run as that user. The runner is the engine host that registers the factory on AgentField. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Railway's builder rejects a cache mount that has no id, and an id has to be spelled with the service it belongs to, which no portable Dockerfile can know. The two Go reasoners build in about a minute without the cache, so they build the same way under Compose and on Railway. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
One `docker compose up` runs the organization server, the AgentField control plane, the factory runner, SWE-AF and PR-AF, each with a volume for its state, a health check, and a published port only where a person has to reach it (on 127.0.0.1 unless the operator opens it). The scripted stub model is an optional profile for a keyless smoke test. setup.sh writes .env with fresh random secrets and never overwrites one; .env, the model keys and the organization token never enter an image. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The control plane's health check used a glibc busybox that the distroless base is too old to run, so it is now the static musl one. The reasoner images now name the user they run as, so a platform volume is handed to the right user and git finds its home (PR-AF was looking in SWE-AF's). The node entrypoint can make a throwaway repository for the keyless smoke test to plan against. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
smoke.sh starts the stack against the scripted stub model and checks, section by section, that the nodes are registered, the operator link claims the organization, a second person joins by invite, a factory job reaches SWE-AF through AgentField with strict run-owner proofs and its plan question is answered by the owner, and that a restart of every service keeps the people, the runs and the registrations. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ec into it Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…point and never uses a fixed password Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…away, then runs unprivileged The published image is distroless and runs as uid 65532, so a root-owned platform volume left it unable to write its database, and the only way round was to run it as root. It now gets the same hand-off as the other images, done with the one busybox binary it already carries for its health check. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…uns as Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…nt the Railway services A link is only accepted with exactly the address the server names itself by, so rewriting the host in the printed link broke it. The README now says what that address is on a laptop, and lists the variables each Railway service takes. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ontainer stub, not a send path deploy/org/modelstub answers /chat/completions on purpose so the keyless smoke test spends nothing; like test/remote/stub it is built into its own image and the product never runs it. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…f running open A fence that can apply nothing used to let the command run as it was. A Require fence returns ErrFenceRequired instead, in a sentence with none of the machine's words, so a hosted chat's commands are confined or not run, never run open. Without Require nothing changes, and the helper's spec is byte-identical. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…LE shortens the idle windows Both are read only by the engine door and only when set, so an engine started without them is what it was. A hosted engine builds its own fence, which ignores jail.allow: off, because a chat's own shell can write that file. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…folder per chat codeaf sessionhost serve|probe|health, plus the hidden helpers it re-executes as the chat's user. The supervisor keeps five capabilities, fails closed when it cannot switch users or confine commands, and answers its API only to the organization server's shared secret and a named person. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…door a chat reaches its model through /v1/hosted/sessions[/...] proxies to the sessionhost with the shared secret and the verified person only; the wire is a reverse proxy that parses no frames. /v1/model/ takes a bearer the server minted for one chat (twelve hours, ended on stop or delete) and adds the organization's key itself. With CODEAF_HOSTED_URL unset neither exists and every path answers as before. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The thin client: the same surface as --at over a WebSocket to the organization server, the bearer only in a header, a chat picked or made for the person, plain sentences for every refusal. It advertises no client tools and drops the automation banner raiser, so nothing an engine sends makes this computer write a file, run a program or open an address. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… people ask them Where the chat runs, what stays on a person's computer, who can see a hosted chat, what the operator of the machine can see, what happens when the person disconnects, the limits and the refusal sentences, and how an operator turns it on. Probes in chat_hosted_test.go keep the questions reaching the page. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
A supervisor that chooses the folders other people's homes live in needs to know, before it makes one, whether an engine host can listen there. The helper returns the longest path a host socket can have under a codeaf home, and a test pins it to the length of the socket a real host listens on. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…t (C5) The first live run showed a chat's turn dying with its client. The engine keeps working after a disconnect only as a host behind a unix socket in the chat's own home, and with the data folder at /sessions that socket's path was 104 bytes, one over the 103-byte ceiling, so the engine quietly ran inside the connection's process instead and nothing said so. The default folder is now /chats, and the supervisor refuses to start with a folder that leaves no room, naming how many characters there are. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ke test needs no key A user message starting "bash:" makes the stub ask for one bash tool call with the rest of the message, and the tool's answer comes back quoted as "STUB ran: <output>". Any other message is answered "STUB noted: <message>" as before, so the existing smoke test is unchanged. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ke test that proves them A `hosted` Compose profile adds the sessionhost (five capabilities, a volume at /chats, a network shared only with the organization server, a healthcheck), the local-binary build argument for an image that has `codeaf sessionhost` before a release does, the shared secret in setup.sh, and README "Hosted chats". `SMOKE_HOSTED=1 ./smoke.sh` drives real `codeaf chat --org` clients against the scripted model stub and checks, by contract item: a chat runs on another machine in a folder of its own, other chats cannot read, write, list or signal it, no secret reaches a chat, a machine that cannot isolate refuses, a turn finishes after its client is killed, the host restarts without orphans or lost files, limits and cleanup, and that another person's chat cannot be told from one that never existed. The checks of what a chat's user can see are made as that user (the machine's root holds no right to look inside a chat), and what a chat's shell holds in its environment is read from the machine's side, because the engine rightly refuses a command that searches for secrets. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… the fit check The test asked SocketPath for the real path, and SocketPath refuses a state root that is too long for a socket, which a CI runner's temporary folder is. The test passed on a short /tmp and failed there. It now measures the same path through the unexported where and socketName. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…where the kernel cannot Abstract Unix sockets have no owner and no file mode, so every process in one network namespace can connect to every other's, and the hosted chats on one machine share that namespace. A live check showed one chat connecting to a socket another chat was listening on. A required fence (the hosted engine's) now asks Landlock to scope them, so a command cannot connect to an abstract socket made outside its own fence, and where the kernel is older than Landlock ABI 6 the command is refused instead of run with the gap. A fence nobody required keeps the ruleset it always had. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…pe local sockets starts none /tmp and /dev/shm are one folder for every chat on the machine, and a file made there with the usual umask 022 was readable by every other chat (checked live). Chat processes now start with 077. The probe also refuses fenced mode where Landlock is older than ABI 6, because abstract Unix sockets belong to no user and only the fence can keep chats from each other's; an operator who accepts that says so with CODEAF_SESSIONHOST_REQUIRE=uid. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…folders and local sockets Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ct sockets, the engine socket, process internals) Each is checked with a control that shows the check can pass: a chat's own abstract socket and its own engine socket work from inside the chat, and the chat's own user can read its own process's environment. The kernel answers for another chat's user are asked by a plain script running as that user, so the engine's own wording check is not what refuses. README says what the fence now needs (Linux 6.12 or newer) and that chats start with umask 077. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This was referenced Nov 24, 2026
Collaborator
Author
|
Consolidated into #2903, the |
AbirAbbas
added a commit
that referenced
this pull request
Nov 25, 2026
…ack (#2903) The hosted organisation line: a team-mode org server deciding every request through one access model (verbs, roles, grants and policy in SQLite), hosted chats run by the sessionhost under a per-chat uid inside a Landlock fence with minted model bearers, sealed keys and a git helper, shared chats acting through verbs, bots owned by their creator, the Hosting and chats policy settings, and a self-hosting stack (deploy/org Docker Compose, published images behind a leak gate, a Railway path). Consolidates #2894 #2895 #2896 #2898 #2899 #2900 and the follow-ups #2904 #2905 #2907 #2908 #2910 #2911 #2912 #2913 #2915 #2916 #2918 #2927 #2936 #2944. Proven by the full suite, a keyless Compose smoke, a hostile wire client, sandbox escape probes, a real-model run and a production-style install from the published images. Co-Authored-By: Santosh kumar <[email protected]> Co-Authored-By: ZeroPoint95 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
DRAFT. Do not merge. Stacks on #2894 (
w24/org-compose, headfb344e9ec): the first commits in this PR's list are that PR's, the commits after them are this one. Rebase ontodevonce #2894 lands.What this does
P0 of the hosted-chat design: one full codeaf chat (model, shell, git, a worktree) runs on a machine the organization keeps, and a person attaches to it from a thin client,
codeaf chat --org <url>. It runs in a newsessionhostCompose service, behind the organization server. Everything is opt-in: withCODEAF_HOSTED_URLunset the organization server,codeaf chat,--hostand--atbehave as they did.sessionhost(new,internal/sessionhost,codeaf sessionhost serve|probe|health): one Linux user and one0700folder per chat, commands fenced and refused (never run open) when no fence can be applied, five capabilities, no organization secret and no model key, per-person and per-host limits, stop/delete leave no process, state survives a restart.internal/factory/serve):/v1/hosted/sessions[...]proxies to the sessionhost with the shared secret and the verified person only (client identity headers are stripped); the wire is a reverse proxy that parses no frames./v1/model/is a model door: a chat reaches its model only with a bearer the server minted for that chat (twelve hours, ended on stop or delete), and the server adds the organization's key itself.cmd/codeaf/chatv3_org.go): the same surface as--atover a WebSocket, the bearer only in a header, plain-words refusals, no client tools advertised, nothing a frame says can make this computer write, run or open anything.deploy/org): the service, ahostednetwork shared only withcodeaf, the local-binary build argument,setup.shsecret,SMOKE_HOSTED=1 ./smoke.sh, README "Hosted chats".organization-hosted-sessionswith probes.Validation contract (written before the code) and where it stands
Live =
SMOKE_HOSTED=1 ./smoke.shon Docker Desktop (three services in their own Compose project: the organization server, the sessionhost on a different host, the scripted model stub; a Linux user per chat, Landlock fence). Go = the contract-named tests (TestC<n>_...) ininternal/sessionhost,internal/factory/serve,internal/executor,internal/enginehost,cmd/codeaf.codeaf chat --orgopens a chat; a scripted bash call runs git and a worktree there (?? f); the hostname is another container's than the organization server's; the chat's folder is/chats/people/<person>/<chat>/workand its user is 200000 or above; nothing was written where the client ran; a later message reaches the same chat and its files. Go:TestC1_*.smoke.sh, uid+fence, Landlock ABI 7): another chat's file cannot be read, its folder written to or listed, its home read, it cannot be signalled,/proc/<pid>/fdis refused; the same person's other chat is refused too; the organization server's data folder is empty on the chats' machine; nothing planted reached a chat and its own file was intact (read as the chat's own user). Found open and closed here: before the fix a file one chat left in/dev/shmor/tmpwas readable by another chat (umask 022), and another chat connected to an abstract Unix socket the first was listening on (both checked live on the previous build). Now: chats start with umask 077 (the file is refused), and a required fence scopes abstract sockets in Landlock (the connect is refused with EPERM, while a command's own abstract socket still works). Another chat's engine socket is refused (EACCES; the first chat connects to its own). Asked as the other chat's user by a plain script, not the engine's wording check:/proc/<pid>/environEACCES,/proc/<pid>/memEACCES,ptraceattach EPERM; the chat's own user can read its own environment, which is the control. Named gaps: formemandptracethis kernel's Yama setting refuses the same user too, so that answer is Yama's and the user rule's together (a different user needsCAP_SYS_PTRACE, which no chat has);/tmpand/dev/shmfile names are listable by other chats (the contents are not); a chat can still open its own files up on purpose; on a kernel older than Linux 6.12 (Landlock ABI below 6) the machine starts no chats unless the operator choseCODEAF_SESSIONHOST_REQUIRE=uid. Go:TestC2_*.OPENAI_API_KEY(the minted bearer is in the engine's environment only). Go:TestC3_*(environment is exactly an allow-list, credentials never touch disk, bearer lifecycle: revoked on stop).uid+fencewith Landlock; a container started withoutSETUIDis not ok and starts no chat. Go:TestC4_*(forced probe failure answers a sentence and starts nothing; a required fence refuses when none can be applied;uidmode needs an explicit opt-in and warns)./sessionsput a chat's engine socket path at 104 bytes, one over the 103-byte ceiling, so the engine silently ran inside the connection's process. Fixed: the default folder is/chatsand the sessionhost refuses to start with a folder that leaves no room (TestC5_*). Live: the client is killed 5 s into a 10 s command; 14 s later a reconnect shows the result and no cut-off tool call.TestC6_*.setsid, and does not touch the other chats; delete answers 404 afterwards. Go:TestC7_*(host-wide limit sentence, state derived from processes, kill reachessetsiddescendants, the idle window). The idle window was watched live once, see Known limits.TestC8_*: hosted is off whenCODEAF_HOSTED_URLis empty and refused when half set; the fence is unchanged unless required; the existing tests in the touched packages pass untouched.TestC9_*.TestC10_*.TestC11_*(a hostile frame makes the client write, run and open nothing; the surface has no banner raiser).Approval path (driven live with tmux and the built client attached to a hosted chat). A fresh interactive hosted chat starts in the product's own default posture, YOLO (the engine's welcome says so and the status line shows it), so its first command runs without a card, inside the fence; that is the same default as a local chat.
alt+aswitches the chat to "asks" from the client. Then: a command shows the card "needs your ok to run bash" with allow once, always, deny; before approving, the file the command writes did not exist; approving ran it as the chat's user in its folder; denying left the file absent and the transcript reads "denied by the person". An interactive attach right after a--oncerun was NOT refused (the suspected execution-mode refusal did not occur): the conversation resumed and a command ran in it. Frames are kept with the lane notes. Not done: an operator setting that makes "asks" the default for every hosted chat (follow-up). In the first interactive run the client also drew a "calls are not being sealed ... Permission denied" notice that cleared by itself; it is not diagnosed.CI gates run locally before the push:
make test-quick(exit 0: build, vet, fmt, packed manual, change entries, manual gates, laws, help and belt-page tests), the light packages' tests, the namedcmd/codeaftests, and the windows and darwin builds of./cmd/codeaf. Live:SMOKE_HOSTED_ONLY=1 ./smoke.shend to end from a fresh stack with images built from the fixed code: 74 checks pass, 0 fail (SMOKE PASSED); then the hosted sections with the new C2 checks: 72 pass, 0 fail.Deviations from the design (each deliberate)
SETPCAPis needed to empty a chat's capability bounding set. The supervisor also narrows itself to the five at start./procand signals through pidfds (stop, re-check the uid, kill), instead of a real-uid-0 trick.jail.allow: off: a chat's shell can write its own settings file, so honouring it would let one command remove the fence.hostedCompose network, so a chat cannot reach AgentField, the nodes, the runner or the model stub. On Railway the private network is open, so the shared secret and the bearer are what protect.CODEAF_FENCE_REQUIREandCODEAF_ENGINE_IDLEare new, read by the engine door only and only when set./chats, short on purpose (see C5): a socket path has a 103-byte ceiling and a chat's engine socket lives in its own home.umask 077and the fence scopes abstract Unix sockets (kernel 6.12 or newer; see C2).CODEAF_BINARY_FROM=local) because the pinned release has nosessionhostyet; the default build is unchanged.Known limits (not hidden)
--oncehas nobody at a keyboard to approve a command, so under the default policy its first command is refused, as for a localcodeaf chat --once. The smoke seeds one settings row for its test chats; an operator knob for unattended hosted chats is a follow-up.furrow servestorage helper keeps that helper running as the chat's user, reparented to init, after the engine is gone; the sessionhost counts a chat as running while it has any process, so such a chat holds one of its person's slots until it is stopped (stop kills it; the smoke's stop-frees-the-slot check passes). Whether the helper should exit with the engine is a follow-up for whoever owns furrow's lifecycle.Not run here
make pr-readyand the fullcmd/codeaf,tui3,sessionsuites were not run on the laptop (CI's legs carry them). No Railway deployment was made: the Railway step was optional and was not reached; thesessionhostservice for it is described indeploy/org/README.md, andcodeaf sessionhost probein that service is what says whether the fence works there.🤖 Generated with Claude Code