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]>
…on's own keys are sealed under a key of their own The bearer table lives in hosted-bearers.json (hash, chat, person, expiry; never a token). A person's provider key and GitHub token live in person-keys.json, each sealed with AES-256-GCM under a per-person data key that a server key wraps, with a canary that makes a wrong server key a clear refusal. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… by the host's own fingerprint, and a person can store their own keys A bearer minted before an org-server restart still works after it; the attach asks the chat's host which bearer it holds and pushes a fresh one before the wire opens when it is not the current one, so the first attach after a host restart no longer says the chat has no model access. /v1/hosted/keys stores, lists (last four only) and deletes a person's own provider key and GitHub token. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…server can be served in-process ChatSpend sums what one chat has posted to a workstream, counting both the organization's key and the person's own key, so a per-chat cap can be checked against what was really spent. modelapi.Server gains Handler() so the org server can mount one metered funnel per chat without opening a second port. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ire a key, and a git stub stands in for GitHub The stub now answers with a fixed token usage and cost per call, can be put in "key required" mode so a run proves which key reached the upstream, and counts its calls. A second stub speaks the git smart-HTTP protocol with a fixed credential, so clone and push through the org server can be proven with no network and no real token. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ect to (hosted chats, item 0c) On Linux with Landlock ABI 4 (Linux 6.7) or newer, a fence that is required and names ConnectPorts refuses every other TCP connect with the kernel's own EACCES, and says so in a plain sentence. Landlock filters by port and not by address, so this keeps a chat's commands off services an operator runs on other ports of the same private network; it does not make a service on an allowed port safe. Every fence that is not a hosted chat's keeps the whole network, and the helper's spec is byte-identical when the list is empty. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…exact REQUIRE=uid setting in refusals, and the connect-port list The host accepts the git address and hosts with a chat's credentials and hands them to the engine as two names, reports the first sixteen hex characters of the model bearer it holds so the org server can tell when it must push again, spells CODEAF_SESSIONHOST_REQUIRE=uid exactly in both refusals that offer it (item 0b), and writes CODEAF_FENCE_CONNECT_PORTS for a required fence from CODEAF_SESSIONHOST_CONNECT_PORTS plus the organization's own model-door port (item 0c; default 22, 80, 443, 9418; "none" keeps only the organization's). Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… reaches git only through the org server /v1/model/ now serves one modelapi funnel per hosted chat with the person's own key, else the organization's key, else the keyless stub. Every call is metered into the person's My space to the cent, refused in a plain sentence when the chat's cap or the person's monthly limit is reached (402) or the chat is making too many requests at once (429), and never falls back to the organization's key when a person's own key cannot be opened. /v1/hosted/git/ is a smart-HTTP reverse proxy to an allowed git host: the chat authenticates with its model bearer, the org injects the person's GitHub token upstream, so the token never enters the chat, and each git operation writes one line to the audit log (GET /v1/hosted/audit). Replaces the one-line routes stub left by the first stage. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…t setup and credential helper `codeaf factory serve` reads the server key, the session cap, the git hosts and the upstream key for the metered model door from the environment (and checks them at start, refusing with a sentence that names the setting). A hosted chat's engine writes a git config that sends GitHub addresses to the org server's git door and installs `codeaf git-credential` as the credential helper: it answers git with the chat's own bearer read from a 0600 broker file, never a GitHub token. A model door call without a usable key says why in one sentence. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…tub, and the hosted smoke proves P1 on them Compose gains the git stub, the server key and caps settings, the connect-port list and the keyless "key required" model stub; setup.sh makes the server key the way it makes the shared secret; the README says "Linux 6.12 or newer; on older kernels set CODEAF_SESSIONHOST_REQUIRE=uid" and states plainly that the connect-port limit is port-based. The smoke gains rows for the real key never reaching a chat, spend to the cent, the caps, revocation, sealed own keys, git without a token and its audit lines, a restart not breaking an attached chat, and a disallowed port refused. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…, own keys, git, limits) The hosted-sessions manual page says what a person can rely on (spend is measured by the organization and capped, their own keys are kept sealed, git works without the token ever reaching the chat, and which ports a chat's commands may reach) and what it cannot (a hostile service on an allowed port is still reachable). PROTOCOL.md lists the new routes and the host's bearer fingerprint. The change entry says what was believed before and what is true now. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… chat's first command seals its calls The first interactive hosted command printed "calls are not being sealed ... Permission denied". The furrow history helper fsyncs every ancestor folder after it first creates its group-commit file, and the 0711 folders above a chat made that open fail with EACCES for the chat's own uid. The ancestors are now 0755 (names only; the chat folders below stay owner-only), and an older 0711 ancestor is widened when it is found. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ommand's note names what the chat may reach avoiding() used to drop every grant below a folder it could not list; it now keeps granting what lies beside and below. A port-limited fence also writes its own sentence into the transcript, through Fence.WithNote, so a refused connection says which ports a chat may reach. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The git setup reads its variables through internal/env, the hosted model funnel has an owner row in the spend ledger, and the sealed-key provider names use modelsource.DefaultID rather than a literal. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… readable folders, shorter change title Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…e reads the broker file's mode as the chat's own user Alpine keeps the smart-HTTP backend in git-daemon, so the stub answered every clone with a 500. The smoke's last row globbed chat folders as the machine's root, which cannot look inside them, and found nothing; it now stats each file as the chat's own user. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…, never a retried 502 When the provider answered 401 or 403 to the organization's model key, the model door relayed a 502, the engine retried it quietly about once a minute and the organization's log said nothing. Now the chat's call gets a 401 with one plain sentence (not retried, no key or provider words in it) and the server's log gets ONE line naming the cause, repeated at most every 30 minutes and again as a new outage once the key has worked. A person's own stored key that is rejected gets the same treatment worded as theirs, and the organization's key is never used in its place. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…tences The manual's cost section and deploy/org's README say the exact sentences a person reads when the provider refuses the organization's key or their own, the change entry records what was true before, and a probe keeps the sentence reachable. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…made the contract
TestP1_1 still expected the provider's own words ("invalid key") in what a person reads when
their own key is refused. Item 0 made that a plain sentence worded as theirs with none of
the provider's words, so the test now asserts that sentence and that the provider's words
and the key are absent; it still asserts the 401, that the key never appears in the body or
headers, and that the upstream saw exactly the keys it should. The code is right and the
test was stale: the contract said so before the code changed.
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. Stacks on #2896 (hosted chats P0), which stacks on #2894. The base here is
dev, so the diff also shows the earlier two until they land; revieworigin/w24/sessionhost..w24/sessionhost-p1(15 commits) for P1 alone. Not for merge: a human hand-tests it first.What this adds
P1 of hosted chats: a chat runs without ever holding a secret, and what it spends is measured on the server.
/v1/model/is now a real proxy throughprovider/modelapi: the org's upstream key (CODEAF_HOSTED_MODEL_KEY, explicit, never defaulted from the key the org uses for its own work) never leaves the org server; every call is posted to the person's My space to the cent; a chat stops atCODEAF_HOSTED_SESSION_CAP_USD(default 5.00) and a person at their monthly limit, each with one plain sentence and an OpenAI-style error body (402/429/401).PUT/GET/DELETE /v1/hosted/keys/{provider}for a model key and a GitHub token: a data key per person, wrapped by a server key (CODEAF_SERVER_KEY), AES-256-GCM, with a canary so a wrong server key refuses to start. A person's own key is used for their chats only and never falls back to the org's.codeaf git-credentialgives git the chat's own revocable access; the org server's/v1/hosted/git/<host>/<owner>/<repo>.git/...adds the person's GitHub token and audits every clone and push (hosted-audit.jsonl).CODEAF_SESSIONHOST_REQUIRE=uid, anddeploy/org/README.mdsays "Linux 6.12 or newer; on older kernels set CODEAF_SESSIONHOST_REQUIRE=uid".CODEAF_SESSIONHOST_CONNECT_PORTSto change it,nonefor the org's alone), through Landlock'sACCESS_NET_CONNECT_TCP(ABI 4). The AgentField, node, reasoner and model-stub ports are not on the list. A refused connection gets the kernel's "permission denied" and one plain sentence in the transcript. It is port-based, and the manual and README say so: a hostile service on an allowed port is reachable and a chat's own dev server on another port is not.Validation contract
CODEAF_SERVER_KEY; with no server key chats run on the org key and storing a key is refused plainly.git cloneandgit pushwork as the person with the token never in the chat; one audit line per operation; a host that is not allowed, a path that is not a repository's and a person with no token each get a plain sentence and no upstream request.Every test is named for the contract item it covers (
TestP1_<n>_...); the map is in the lane notes.Evidence
go build ./...,make vet,make fmt-check, packed corpora, change entry, manual gates, carried help, belt pages,make test-laws, Windows and macOS cross builds): all exit 0. Focused suites on the touched packages (executor,sessionhost,sessionfence/jail,factory/store,factory/serveP1/C-series,cmd/codeafhosted tests) all pass. The fulltui3/session/cmd/codeafsuites are left to CI's touched-packages legs.deploy/org: codeaf, sessionhost, a model stub that reports a fixed cost and can require a key, a git stub) runs the hosted smoke on a fresh stack at the head commit: 138 checks pass, 0 fail (the key scans, cent-exact spend, caps, own keys, realgit clone/git pushfrom a chat, audit lines, the org-server and sessionhost restarts, the first-command row for item 0, the port rows for item 0c). Its earlier runs found and fixed three things on the way: the item 0 root cause and its twin in the fence's read grants (15 failures), the git stub image missinggit-http-backend(7), and one smoke row that looked inside chat folders as root (1).Open decisions
:own)./health) answer a caller with no credential; they should each require their own. The port fence keeps a chat away from them for now.🤖 Generated with Claude Code