Skip to content

org: the Compose path walked as a stranger, docs corrected and a terminal path written - #2915

Merged
AbirAbbas merged 8 commits into
org/mainfrom
org/compose-walk
Nov 25, 2026
Merged

AbirAbbas merged 8 commits into
org/mainfrom
org/compose-walk

Conversation

@AbirAbbas

@AbirAbbas AbirAbbas commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

What this is

A stranger's walk of the Docker Compose path for a self-hosted organization, following only the published docs in order (README.md, docs/organizations.md, deploy/org/README.md and what they link to) on a machine that had never seen this code: stand up the stack, claim it as the operator, invite a second person who joins from a terminal, run a first hosted chat on the scripted stub model, share it at view, then follow the backup and upgrade sections.

The stack came up and every step could be completed, but 17 places in the docs were wrong, missing or out of order, and three of them also had a real code or script fault behind them. This PR fixes all of them.

The worst three

  1. The one-machine path the docs describe cannot work (E4, E5). The operator link names http://[::]:8787, which does not connect from the browser or the app on the same machine under Docker, and a password is refused over plain http because Docker's published port never looks like loopback to the server (https_required). CODEAF_PUBLIC_DOMAIN=localhost makes the server restart in a loop. The README now has a "Trying it on one machine" recipe (Caddy with its own certificate authority, a localtest.me name, CODEAF_TRUSTED_PROXIES), and the [::] claims are corrected.
  2. A person without the desktop app cannot join, get a token or be shared with (E6, E7, E8). Inviting, joining, the sign-in token and sharing were written only as app buttons. docs/organizations.md has a new "From a terminal" section with the exact requests (sign_up, POST /v1/access/links, sign in again, POST /v1/resources/session/<id>/grants with its body), and the manual's organization pages say the same.
  3. The documented backup was unsafe and had no restore (E12). It wrote a root-owned, world-readable archive holding accounts.json (password hashes), sessions.json and the organization token, used a bind mount that fails on Docker Desktop, and said nothing about restoring. It is rewritten (stdout form under umask 077, one archive per volume, a restore that was run).

Code and script fixes (each its own commit, each with a test that fails on the old code)

  • operator-link.sh printed a link that had already been used. It now asks the server (verb: check) and says plainly when the link is spent, with the 24-hour lifetime and how to get a fresh one. deploy/org/operator_link_test.sh: 8 rows, 5 fail against the old script.
  • gitstub was in the stub profile but exits without GITSTUB_TOKEN, which only smoke.sh makes, so COMPOSE_PROFILES=stub crash-looped it. It has its own gitstub profile; smoke.sh asks for it. deploy/org/compose_profiles_test.sh: 5 rows, 3 fail against the old file.
  • codeaf --help and the guide did not name --org. The usage text now does, and TestTheUsageNamesEveryFlagAPersonCanType requires it (the 123-line help cap is kept by folding the flags).
  • Both new shell tests run in .github/workflows/org-images.yml.

The rest

Clone step before cd deploy/org (E1); a taken port 8080 or 8787 stops up half way, with AGENTFIELD_PORT (E2); a keyless route through COMPOSE_PROFILES=hosted,stub and its variables, which was previously only visible inside smoke.sh (E3); smoke.sh claims the organization itself and must run on an unclaimed stack (E11); what the plain-HTTP start-up warning means behind a proxy (E16); --org exists only in dev-channel builds, and codeaf attach also moves new windows to that factory until codeaf detach (E15, E17). The manual pages are updated in the same change (THE MANUAL LAW), with four new probes.

Validation contract

# Behaviour Result
1 The stack comes up from a clean checkout and the docs: organization server, sessionhost, AgentField, the two agent services, the stub model Pass, after two doc-caused failures (port, gitstub)
2 The organization is claimed as operator the way the docs say Pass, only through the terminal route the docs did not give
3 A second person is invited, joins from the terminal, runs codeaf chat --org <url> and gets a stub reply Pass
4 The chat is shared with the operator at view and is read-only for them Pass
5 Backup and upgrade sections are coherent Pass for what exists; backup was wrong six ways
6 Every doc error recorded and fixed Pass, this PR

Tests run

  • make test-focus for the help and usage tests, and for internal/manual (the four new probes, the old ones still reach their pages).
  • deploy/org/operator_link_test.sh and deploy/org/compose_profiles_test.sh, each failing on the old files and passing on the new.
  • SMOKE_HOSTED=1 ./smoke.sh against a fresh Compose project on the final tree: 261 checks passed, 0 failed, including every section after restarting all the services, and the stack was taken down with its volumes afterwards.
  • make pr-ready BASE=origin/org/main: the light gate, the touched-package laws and internal/manual passed locally. The cmd/codeaf leg ran out its 15-minute shard ceiling on a laptop busy with other work (many unrelated timing-sensitive tests timed out, none of them the usage or help tests), so I re-ran the usage, help, flag and org tests of cmd/codeaf alone (pass) and left the full package to CI, where touched codeaf, touched rest, light gate, windows native tests, gate self-test and the image builds are all green.

Not covered by this walk

The desktop app (the sign-up, invite, token and share paths were checked as the requests the app sends), Docker on native Linux, Windows, a Caddy on the host with a public certificate, a real model key, published images, the full upgrade, email invitations and GitHub sign-in.

Open calls

  • A product bug left open: a view guest's codeaf chat --org <url> --session <chat> --once on a stopped chat starts it for the owner in one-shot mode, and the owner's window then reads "already open in a different interactive or headless mode" until the chat stops or idles. Documented as a known limit; wants an issue and an engine-side fix.
  • There is no CLI for joining with a password, inviting or sharing a chat. A codeaf org join <link> that does the sign-up and keeps the token (as codeaf attach does) would remove E6, E7 and E8 for good.
  • The server prints its plain-HTTP warning behind a trusted proxy too; it could stay quiet when trusted_proxies is set.
  • The two new offline scripts need docker compose on the runner and have not run in CI until this PR does.

No secrets, tokens or internal URLs are in the diff (loopback addresses appear only where the docs explain them); examples use https://codeaf.example.com.

🤖 Generated with Claude Code

AbirAbbas and others added 8 commits November 25, 2026 02:38
…ready used

The server log keeps the operator link of every start, so after the
organization was claimed `./operator-link.sh` still printed the newest one: a
spent link, with the script's own "already claimed" message never reached.
Found walking the Compose path as a stranger. The script now asks the server
to check the link (a read: it claims nothing and uses nothing up) and reports a
used, expired or retired link instead of printing it. If the server cannot be
asked it prints what the log has, as before.

operator_link_test.sh runs it offline against a stand-in for `docker compose`
and is a step of the org-images workflow beside the Railway script tests.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…stub` no longer crash-loops it

gitstub refuses to start without GITSTUB_TOKEN, which only smoke.sh makes. In the
`stub` profile that left a container restarting forever for anyone who turned the
scripted model on by hand (the keyless way to try an organization), and `docker
compose ps` never reached all-healthy. It is now profile `gitstub`; smoke.sh asks
for it with the hosted part, as it already asked for the token there.

compose_profiles_test.sh reads `docker compose config --services` for each profile
and is a step of the org-images workflow.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… hosted chats

The flag was in `codeaf chat`'s own usage error and in `codeaf chat --help`, and
nowhere on the page an operator reads first, so a person setting up an
organization could not find how a terminal reaches it. The flag law test now
requires it there.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…alk of the Compose path found it wrong

Followed as a stranger with Docker Compose on one machine. What the README said and
what was true:

- No step said to clone the repository: the installer on the front page puts only the
  program on a computer, and the images are built from the checkout.
- Ports 8787 and 8080 had to be free, and a taken one stopped `docker compose up` half
  way ("port is already allocated") with nothing about it in the README.
- The keyless way to try an organization (the scripted model) was not written down; the
  only keyless thing named was smoke.sh, which claims the organization itself and uses
  the operator link up. Both now say so, and the scripted-model lines are given.
- The laptop paragraph said the operator link's `http://[::]:8787` works from the same
  machine. `[::]` does not connect to the published port, and over 127.0.0.1 the server
  refuses a password because Docker presents the request from its bridge, not loopback.
  A trial needs a name and an HTTPS proxy: a verified recipe is added.
- `operator-link.sh` is described as printing a link once claimed; the link also
  expires after 24 hours.
- The backup was a bare `tar` into a bind mount: root-owned and world-readable on a
  default host, containing password hashes, sessions and the organization's token, with
  no restore, nothing on stopping the services first and nothing on `sessions-data`.
  Volume names were written as `codeaf-org_` only. Backup and restore are rewritten,
  and both were run against a live stack.
- gitstub is listed under `--profile stub`; it is `--profile gitstub` now.
- setup.sh pointed at the smoke test for a keyless start; it points at the scripted model.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…path

The ten minutes assumed a desktop app at three steps and a checkout it never told you
to make. A person on a terminal could not join: nothing said where the sign-in token
for `codeaf chat --org` comes from, how an invitation is made or redeemed without the
app, or how a chat is shared (the manual says the app has no sharing buttons yet and the
README names the route without its body). "From a terminal" now gives each request,
verified against a running stack, and "Sharing a chat" gives the share. The guide listed
no `--org`.

Also written down: that a password needs HTTPS even from the server's own machine, which
Docker does not present as its own; that the released `codeaf` has no `--org` yet; and
that a guest's refused `--once` on a stopped chat starts it for the owner in one-shot
mode and blocks the owner's window until the chat is stopped.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…trial needs

THE MANUAL LAW for the two pages the walk found wrong. organization-start said anyone
"connecting from another computer" needs HTTPS, which let the person on the same machine
believe they did not; it now says everyone does and why, and what the operator link
names without a public name. organization-hosted-sessions said the `--org` sign-in
token was set or kept but never where it comes from; a section in the asker's words
(join or sign in from a terminal, no desktop app) says, and the share request now
carries its body. Four probes in their own words are added.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…TTPS too, and where the scripted lines go

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@AbirAbbas
AbirAbbas merged commit 5c64821 into org/main Nov 25, 2026
23 checks passed
@AbirAbbas
AbirAbbas deleted the org/compose-walk branch November 25, 2026 08:23
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant