Repository navigation
A first cell in recording records a new org only while the directory answers that it is attaching - #519
Merged
Conversation
zlareb1
marked this pull request as draft
November 11, 2026 04:09
This was referenced Nov 11, 2026
zlareb1
force-pushed
the
feat/cell-router-directory
branch
from
November 11, 2026 14:48
4adc124 to
ee97a1d
Compare
zlareb1
force-pushed
the
feat/cell-router-state
branch
from
November 11, 2026 14:48
3c8f568 to
681c892
Compare
zlareb1
force-pushed
the
feat/cell-router-directory
branch
from
November 11, 2026 15:11
ee97a1d to
eb541c9
Compare
zlareb1
force-pushed
the
feat/cell-router-state
branch
from
November 11, 2026 15:11
681c892 to
221e6a5
Compare
zlareb1
force-pushed
the
feat/cell-router-directory
branch
from
November 11, 2026 15:31
eb541c9 to
8242b63
Compare
zlareb1
force-pushed
the
feat/cell-router-state
branch
from
November 11, 2026 15:31
221e6a5 to
d1eedc8
Compare
zlareb1
force-pushed
the
feat/cell-router-directory
branch
from
November 11, 2026 15:47
8242b63 to
0634607
Compare
zlareb1
force-pushed
the
feat/cell-router-state
branch
from
November 11, 2026 15:47
d1eedc8 to
4a6fdcb
Compare
zlareb1
force-pushed
the
feat/cell-router-directory
branch
from
November 11, 2026 22:47
0634607 to
4e3c11e
Compare
…answers that it is attaching Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…e as 503 Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
force-pushed
the
feat/cell-router-state
branch
from
November 12, 2026 00:17
4a6fdcb to
907e82c
Compare
zlareb1
marked this pull request as ready for review
November 12, 2026 00:18
This was referenced Nov 12, 2026
Merged
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):
On a cell (
LOOM_CELL), the first cell inrecordingrecords a new org only while the router's directory answers that the cell isattaching; while the directory is unreadable or answersserving, a new org answers 503 and the orgs the cell holds keep serving. The router answers that read atGET /cells/v1/cells/<cell>, for the first cell's own credential only.Why
The fifth of the pull requests that implement cells. It stacks on #497. A first cell's Postgres restored to before attach's step 3 reads
recordingagain. Ifloom cell restoreis skipped, that cell would record any new org with no check, becauseserver.auth.tenancy.ensure_heldrecorded whenever the mode row readrecording. The directory still saysservingthen, so asking it tells the two cases apart, which is what the design page says the cell does ("A process that readsrecordingrecords a new org only while the directory answers that its cell isattaching"). #473's and #497's descriptions named this read as still to come.Design
GET /cells/v1/cells/<cell>(server/router/app.py,Router.cell_state):directory.first_cell_named, a plain connection, not a lookup slot, so a lookup flood cannot starve it); any other cell answers 404;{"cell", "state"}.server/auth/tenancy.py):directory_says_attaching()asks the router withLOOM_CELL_ROUTER_URLandLOOM_CELL_ROUTER_TOKEN, bounded as a whole byLOOM_CELL_ROUTER_TIMEOUT_S, and is true only for a 200 whosestateisattaching. Anything else (no router configured, a refusal, a malformed or late answer) is false.LOOM_TENANCY_MODE_CACHE_S, and the requests waiting on it share one router call (a shielded task, as the placement call does).ensure_heldreads it only for an org the cell does not hold while the cached mode readsrecording: held orgs keep serving whatever the directory says. On false, the org answers 503 and nothing is written.server/cli/_ch.pydocstring updated), so an org-declaring command on a restored first cell refuses the same way.LOOM_CELL_ROUTER_TOKENfor that read, so it also keeps the page's rule on that credential: an org-declaring command refuses to run with it set, naming it, unless the cell readsrecording(a later cell readsenforced), since the credential can place orgs in the shared directory.LOOM_CELL_ROUTER_URL(httpx.InvalidURL) counts as no answer, here and in the placement call, instead of escaping as a 500.Scope and risk
With
LOOM_CELLunset nothing here runs, and no shipped command writes a mode row yet, so the read only matters onceloom cell prepareexists. A first cell that is genuinelyattachingnow depends on the router to record a new org: during a router outage in the rollout, a new org answers 503 there, as the page's failure table already says ("A directory outage during theLOOM_CELLrollout and between prepare and attach leaves the first cell serving the orgs it holds, a new org answering 503").Still to come with the routing pull request: routing rules 1 to 4, the cache of placed lookups,
NO_CELL, and the lookup's clients (loom login --org, the org-first sign-in page, a typedWRONG_CELLerror).Compatibility, rollout and rollback
A new router route and a new check on the cell, both inside a cell only. A router older than this answers the state read 404 (no route), which the cell reads as not attaching: run the router first, as the page's order already says. Rolling back the cell removes the check.
Tests
tests/unit/test_router.py(64): a malformed placement answers 400 before any credential read; the first cell reads its own state (attaching,serving); a later cell answers 404; a wrong credential, another cell's own credential, a malformed name and an unknown cell answer 401; no bearer reads nothing; a replaced credential still cached answers 401 and the new one is accepted after one more directory read; a directory outage answers 503.tests/unit/test_cell_tenancy.py: arecordingcell the directory marksservingwrites nothing for a new org and still serves a held one; the read is true only for a 200 namingattaching(serving, 404, 401, a non-object, a refused connection are false), is read once per window and shared by a burst of five, a false answer stands for the window too, a cancelled waiter leaves the read to the others, is false with no router configured (and the 503 names the unset setting) or with a URL httpx refuses (https://router.test:notaport, no request sent), and is cut off at the timeout; a placement with that URL answers 503 and writes nothing. The other recording tests run with the directory answeringattaching.tests/unit/test_cell_cli_orgs.py: the CLI's recording tests run with the directory answeringattaching; a restored first cell the directory marksservingrefuses a command for a new org and records nothing; a command withLOOM_CELL_ROUTER_TOKENset refuses on anenforcedcell, naming it, and runs on arecordingone.tests/integration/test_router_directory_pg.py:first_cell_namedanswers a cell the test marks first and nothing for another; the test moves the earlier first-cell mark to its own cell and restores it in afinally. Passed against a local Postgres.make lintandmake typecheckpass. The full unit suite has not run on this stack.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 full unit suite result follows in Tests).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, and this description names any operator steps and wire changes.tests/unit/test_public_copy.py).git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code