Repository navigation
Cells: a deployment spreads its orgs over complete deployments behind a router, each serving only the orgs placed in it - #452
Merged
Conversation
9 tasks done
zlareb1
force-pushed
the
docs/pg-placement-units
branch
from
November 10, 2026 04:44
d9e3391 to
9921096
Compare
This was referenced Nov 10, 2026
zlareb1
force-pushed
the
docs/pg-placement-units
branch
from
November 10, 2026 16:22
9397c1c to
f4d106d
Compare
9 tasks done
zlareb1
force-pushed
the
docs/pg-placement-units
branch
from
November 11, 2026 01:24
b6bd271 to
10312a3
Compare
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
force-pushed
the
docs/pg-placement-units
branch
from
November 11, 2026 21:03
0c0869a to
d3ce44c
Compare
zlareb1
marked this pull request as ready for review
November 11, 2026 21:04
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.
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
...
Why
Under
LOOM_STORAGE_AUTHORITY=postgresa deployment's whole authority is one Postgres primary, and its ClickHouse service and bucket are shared by every org. Measured with a synthetic load (Memory at scale), a key costs about 6.8 KB of Postgres and 13.6 KB of ClickHouse, so one primary reaches several TB around a billion keys, where vacuum, failover, backup, restore and erasure by org all slow down. An org may also need its memory in services of its own.docs/architecture/cells.mdis the design the cell pull requests implement. An earlier draft of this page split Postgres alone into placement units behind one control plane. That draft was replaced because every security check, worker lease, erasure, policy generation and the audit chain would then span stores, and each needs a protocol of its own (the page's "Rejected" section).Design
cells,placements,hosts) in its own Postgres and routes by host, by SCIM host, by the token's issuer, and otherwise to the first cell. Until the first cell isserving, it passes every request on the shared host but its own/cells/and health paths through to the existing deployment.LOOM_CELLset, a cell serves only the orgs it holds aloom.tenancyrow for. An org comes to a cell only through a verified request whose principal is scoped to it (or, on the first cell inrecording, an org-declaring CLI command, recorded as a request is), throughloom cell placewith the router's operator credential (for a bot, an import or a new org of people), at attach (the orgs the first cell already holds and each cell's configured orgs), or through theloom cell updatethat changes a configured org. The cell calls the router's placement API (under a per-org lock, the winner read, else the cell judged on its locked row and the placement inserted), and another cell's org answers 409WRONG_CELLwith nothing written. A cell's placement calls are rate-limited per cell at each router replica (an operator'sloom cell placeis not rate-limited), bounded in total by a per-cell quota once one is set, and are never deleted. Until attach's step 3 writesenforcedto the cell's mode, and again whenever step 3 or step 4 returns it torecording, the first cell (only the first cell ever records) records a new org as a single deployment does, while the directory answersattaching, with a tenancy row and no placement call (the insert reads the mode rowFOR SHARE, and attach takesLOCK TABLE loom.tenancy_mode IN EXCLUSIVE MODEbefore writing the mode, in short tries, in one transaction with server-side timeouts, ending a cut-off session and reading the mode back after any error (each recording insert commits on its own), so the write waits for running inserts, later ones queue behind it, and a queued insert waits a few seconds at most), and attach places those orgs unrefused; after step 3 or step 4 returns it torecording, a process whose cache still readsenforcedplaces through the router's gate until its cache expires. In every state but open (nofirst, mode, tenancy or own row) and the first cell inrecording(docs/architecture/cells.md, "Thefirstrow"), statement-level triggers refuse a row of any org-keyed table of the authority butloom.tenancyfor an org the cell does not hold, and attach requires the cell's ClickHouse writer credentials rotated to checking builds; an older CLI given the rotated credential still writes ClickHouse unchecked, andloom doctorlists what it wrote. Under the Postgres authority, a server process or an org-declaring CLI command withLOOM_CELLunset refuses in those same states; org-free commands run as before.loom cell restore(after a restore) or a prepare rerun (after a stopped prepare): the cell's Postgres, which holds its state, cannot tell it from a deployment never prepared (ClickHouse carries no cell state: adding it would make the write path read a second store for tenancy), and a process withLOOM_CELLunset never reads the directory, so nothing local can refuse. A process withLOOM_CELLset stays unready (no mode row), andloom doctor, which reads the directory, names the cell. Every other state but the first cell inrecording, including both rows absent beside a tenancy or own row, is gated.loom.cell_selfrow (current, andnextduring a change) answers 503 to everything but health and the probe route. It also stands aside from the workers in every mode.loom cell updatewidens directory-first and narrows cell-first, so no issuer is ever accepted unreserved.loom cell prepareregisters a cell. It proves the stores are the live ones by a nonce echoed through an internal probe address, and records an immutablefirstrow and the tenancy mode. The first cell is anchored to the router's own upstream configuration.loom cell attachruns the overlap refusals (issuers, OIDC client, hosts, org patterns, configured orgs, the root-secret fingerprint, the deployment id, Keeper and bucket isolation) under one directory lock, then moves the first cell fromrecordingtoenforced.GET /cells/lookup?org=<org>is unauthenticated and rate-limited, so it tells that an org outside the first cell exists, as a workspace URL does. This is the one place the design confirms an org exists without a token; ops addressed by id still answerfound=False, never a 403. The lookup is what letsloom login --organd the sign-in page start every flow at the org's cell host, so no flow crosses cells.lsc_<cell>_…).Scope and risk
Documentation only. The page describes settings, tables, routes and CLI commands that the pull requests built on it add. It merges only together with that implementation, or cut down to what has landed.
Compatibility, rollout and rollback
Tests
tests/unit/test_doc_links.py,tests/unit/test_public_copy.py,python scripts/codegen/docs_reference.py --check(llms.txtlists the page);prettier --checkon the pages. The page's Tests section lists the behaviour each implementing pull request tests.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make format-check,make lint,make typecheckandmake test-unitpass; the integration suite passes if server behaviour changed.docs/reference/configuration.mdand thedocs/reference/tables (python scripts/codegen/docs_reference.py), the reach manifest,schemas/schema.sql(make schema-dump) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py).main; no merged migration is edited.hooks/,lib/,bin/,skills/,.mcp.json, the Codexplugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.npm --prefix frontend run build) and its tests pass, iffrontend/changed.docs/describe the system as it now is: not yet. The page describes the cells the implementing pull requests add, so this stays a draft until they land with it.tests/unit/test_public_copy.py).git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code