Repository navigation
loom cell limit and credential write the router's directory through its operator API, and loom cell which reads its lookup - #526
Merged
Conversation
zlareb1
force-pushed
the
feat/cell-operator-commands
branch
2 times, most recently
from
November 11, 2026 09:05
26316a5 to
20425bd
Compare
Merged
8 of 9 tasks
zlareb1
force-pushed
the
feat/cell-operator-commands
branch
from
November 11, 2026 13:25
29aca52 to
7cda6fb
Compare
zlareb1
force-pushed
the
feat/cell-router-routing
branch
from
November 11, 2026 14:48
069cab7 to
10a4863
Compare
zlareb1
force-pushed
the
feat/cell-operator-commands
branch
from
November 11, 2026 14:48
7cda6fb to
c9a4216
Compare
zlareb1
force-pushed
the
feat/cell-router-routing
branch
from
November 11, 2026 15:11
10a4863 to
14bdc3f
Compare
zlareb1
force-pushed
the
feat/cell-operator-commands
branch
from
November 11, 2026 15:11
c9a4216 to
3f1d204
Compare
zlareb1
force-pushed
the
feat/cell-router-routing
branch
from
November 11, 2026 15:31
14bdc3f to
35acd3c
Compare
zlareb1
force-pushed
the
feat/cell-operator-commands
branch
from
November 11, 2026 15:31
3f1d204 to
180449d
Compare
zlareb1
force-pushed
the
feat/cell-router-routing
branch
from
November 11, 2026 15:47
35acd3c to
c93c4b7
Compare
zlareb1
force-pushed
the
feat/cell-operator-commands
branch
from
November 11, 2026 15:47
180449d to
2ea8282
Compare
zlareb1
force-pushed
the
feat/cell-router-routing
branch
from
November 12, 2026 01:55
c93c4b7 to
988b5e8
Compare
…ts operator API, and loom cell which reads its lookup Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
force-pushed
the
feat/cell-operator-commands
branch
from
November 12, 2026 02:22
2ea8282 to
28d2eef
Compare
zlareb1
marked this pull request as ready for review
November 12, 2026 02:22
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):
loom cell limitcloses, reopens or bounds a cell to new orgs,loom cell credentialmakes a router credential (new) and rotates a cell's (--next,--finish,--revert), andloom cell which --orgnames an org's cell.limitandcredentialwrite the router's directory alone, through a new operator API (whichreads the public lookup and sends no credential) the router answers with its operator credential, so they work while a cell is down.Why
The tenth of the pull requests that implement cells. It stacks on #523. The page's Operations section names these commands, and the router's credential rotation needs a
nexthash it accepts beside the current one; neither existed.Design
lco_and 128 lowercase hex (512 bits), whichloom cell credential new --operatormakes offline; any other form ofLOOM_ROUTER_OPERATOR_TOKENis refused when settings load, and the setting is masked as a secret (the secret-name classifier now coversoperator_token). The CLI holds it; the router keeps only its SHA-256,LOOM_ROUTER_OPERATOR_SHA256(64 lowercase hex), compared in constant time. With none configured, the operator API answers 503 with the codeNO_OPERATOR_CREDENTIAL; a wrong credential 401. Refusals are not rate-limited: behind an ingress every caller shares one client address, so a limit would let one stranger lock out every operator while slowing no guess of a 512-bit credential. No cell's configuration holds it.server/router/app.py):POST /cells/v1/operator/cells/<cell>/limitwithclosedand/orplacements_max(a whole number ornull), andPOST /cells/v1/operator/cells/<cell>/credentialwith a step (nextwith the new credential'ssha256,finish,revert). Bodies are bounded and checked (400: unknown keys, an explicitclosed: null, a rotation with extra keys); a name no cell can have answers 404 before the directory is asked, an unknown cell 404, a refused change 409; the answer is the cell's limit state and whether a next credential is pending. A rotation step makes the replica that took it read the hashes again on its next call; a read that began before the change is not kept for a window (a generation counter). Other replicas see it withinLOOM_ROUTER_DIRECTORY_CACHE_S, which the page now says: the new credential goes into the pods only after that.server/router/directory.py):set_limitandrotate_credentialeach run in one transaction under the directory lock (an advisory lock apart from placement's per-org one), lock the cell's row, write it in one statement and an audit row (actoroperator).nextis refused while one is pending and when any cell records the hash as current or next;finishmakesnextcurrent and drops the old;finishandrevertrefuse with none pending.cells.credential_next_sha256(schemas/router_migrations/003_cell_next_credential.sql, unique where set).directory.credentials()gives each cell's current and next hashes, and the placement call and the state read accept either (Cell.holds), as the page says.server/cli/cell.py):loom cell credential newmakeslcr_and 128 lowercase hex offline and prints it with its SHA-256;--nexttakes the hash only, refusing the credential itself;loom cell limitneeds one of--closed,--open,--placements-max;loom cell which --orgasks the public lookup and prints its answer. Its body does not say whether an org is placed: an org with no placement gets the first cell's answer with the same body as an org placed there. Only a placed org's answer is cached, so timing and an outage can still tell the two apart; an org name is not treated as a secret. The router is--router, elseLOOM_CELL_ROUTER_URL; an answer that is not the router's JSON object (another service's page at that URL) fails, so no change reads as made; a--cellno cell can have is refused before the operator credential is sent anywhere (a path such as../../v1/…would otherwise carry it to another route);--placements-maxtakes ASCII digits only; no router is a usage error (exit 2); the operator credential goes only to anhttpsrouter, orhttpon loopback with no proxy from the environment; a router URL with no host, a bad port, a path, a query, a fragment or a user is refused before any call (the router answers its API at its root and forwards anything else to a cell), and the CLI sets the operator path as the URL's path, so it cannot land in a query and carry the credential to a route the router forwards to a cell. A call sent but not answered within the router's longest operator change plus 10 s (OPERATOR_CHANGE_MAX_S: the connection wait and eight statements at their client bound, 98 s) says the change may have been made, since the router can still commit it, and what a retry shows (a credential step refused as already pending or done was made; a limit is safe to repeat); a connect failure, connect timeout or a proxy that refuses the tunnel is an unreachable router. The outcome is known only when the connection never opened or the router itself answered (200 with a JSON object naming the cell or org asked about, or one of its refusals with anerrorstring; a gateway's 502 or 504, JSON or not, is not the router's answer), other than with the codeBACKEND_UNAVAILABLE(every 503 the lookup and the operator API give carries a code, so one without is a proxy's; the operator API's directory 503, after which a COMMIT that waited past its bound on the standby may have landed); after a timeout, a dropped connection or a gateway's page the CLI says the change may have been made. A lookup's read waits out its two directory reads (the org, then the first cell) plus 10 s, not the operator bound, andwhichtells a router that did not answer from one it could not reach. None connects to a cell's stores.Scope and risk
Router and CLI only. Still to come:
loom cell prepare,attach,update,place,restoreandeach, which write a cell's own rows besides the directory.Compatibility, rollout and rollback
The lookup's 503 for a directory it cannot read (an org it has not cached) now carries the code
BACKEND_UNAVAILABLE;loom login --orgmatches onlyNO_CELLand reads it as before. An additive directory column. Runloom router migratebefore rolling out this router (it reads the new column; without it placements, state reads and the lookup of an org with no placement answer 503, and/readyzreports unready, since its check reads every cells column this build needs, so a rollout ahead of the migration halts), and start a rotation only once every router replica runs this build (an older one readscredential_sha256alone). The router needsLOOM_ROUTER_OPERATOR_SHA256set for the operator API; without it the API refuses and nothing else changes. Rollback: an older router readscredential_sha256alone, so it refuses a pod already on the next credential; roll back with nonextpending (--revertfirst). It fails closed.Tests
tests/unit/test_cell_operator.py(109): a new credential's form and hash; every malformedcredentialinvocation refused before any call; each rotation step and each limit sent to the operator API with the operator credential; an empty or malformed limit refused; no operator credential refused; a refusal printed and failing;whichasking the lookup; no router refused. The API: a wrong, missing or unconfigured operator credential answers 401 or 503 and writes nothing; a limit is written and answered; malformed limits and rotations answer 400; an unknown cell 404 and a refused rotation 409; a pending next is named; a row holds its current and next hash; an operator credential islco_; a limit setting nothing, a rotation with extra keys and a name no cell can have write nothing; a run of wrong credentials answers 401 each time and the right one still works; a rotation is read again by its replica on the next call, and a read begun before a change is not kept (the directory is read again); a page that is not the router's answer failswhichandlimit; a cell name no cell can have (a../path, uppercase, empty, too long) is refused with no call;--placements-maxwith²,+5, a space or a value past the directory's bigint is refused (the API answers 400 for one);credential newwith--routeris refused; anhttprouter that is not loopback gets no call. A timed-out change (read, write or pool timeout) says it may have been made, and a connect timeout says the router could not be reached; an operator change the directory cannot take answers 503, with the codeBACKEND_UNAVAILABLE, and the CLI says that change may have been made; a read error, a dropped connection and a gateway's 502 or 504, HTML or JSON, say so too, while a connect failure, an unconfigured router's 503 and a 409 do not.tests/unit/test_router.py: a cell's next credential places and reads its state during a rotation, and after--finishthe old one answers 401; the lookup answers an org with no placement exactly as an org placed in the first cell.tests/integration/test_router_directory_pg.py: a limit set and its quota cleared withclosedkept, an unknown cell refused, a rotation refused for another cell's current hash,finishrefused with none pending,nextrecorded and returned bycredentials(), a secondnextrefused while one is pending, another cell refused that next hash,finishmaking it current,revertdropping a pending next and refused with none, a retriednextof the same hash named as already the cell's next,directory.ping(which/readyzruns;test_router.pyshows a failed ping answers 503) failing without a column this build reads, the operator audit rows in order with every field of their detail, and two cells asking for one next hash at once with exactly one let in. 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: lint, typecheck and the targeted unit tests pass; the full unit suite has not run on this stack.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