Skip to content

loom login --org signs in at the org's cell, as the router's lookup names it - #522

Merged
zlareb1 merged 1 commit into
mainfrom
feat/cell-login-org
Nov 12, 2026
Merged

zlareb1 merged 1 commit into
mainfrom
feat/cell-login-org

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • New feature

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 login --org <org> (and loom.login(org=…)) signs in at the org's own cell, as the router's GET /cells/lookup names it. With no router, or no cell registered yet, it signs in at the server it was given; it waits out the router's 429 for at most --wait seconds (default 120); on any other answer it refuses without starting a sign-in.

Why

The eighth of the pull requests that implement cells. It stacks on #521. The page says loom login --org starts every flow at the org's cell host so no flow crosses cells, with these exact rules per lookup answer. #497 and #520 added the lookup and its NO_CELL code; this adds the client.

Design

  • loom.credentials.org_server(server, org, *, wait_s) asks GET {server}/cells/lookup?org=:
    • 200: https:// and the cell's host, whatever the router's own scheme (its URL may be a local port-forward; the cell is reached in the open); a host that is not a bare name[:port] the sign-in can reach (not a string, userinfo, a path, a query, a bad port, whitespace, or one urlsplit or httpx rejects; the host must be its whole netloc, so even an empty ? or # refuses) or a body that is not JSON refuses, naming the router, as the router's fault (INVALID_RESPONSE, classed internal);
    • 404 (a deployment with no router) or 503 with code NO_CELL: server itself; the code is matched, never the message;
    • 429: waits the Retry-After, read as the transport reads it (loom.transport.parse_retry_after: seconds or an HTTP-date) and held to 1 to 60 s, and asks again, until the next wait would pass wait_s, then raises RateLimited (status 429, so classed capacity, retryable) naming the router's wait and the --wait left; time goes through a seam (_monotonic) so the loop is tested;
    • anything else: refuses naming the router, so no sign-in starts at a cell that may not hold the org; a 5xx (an outage's 503 included) is classed dependency, retryable, as the SDK's other sign-in errors are; every refusal after an answer carries the router's status.
  • login(..., org=None, wait_s=120) refuses a wait_s that is negative or not finite (with or without an org) and an empty org, then resolves the server first, says which cell host it chose when it is not the same server (same_server), then signs in there as before. The sign-in's own check that a server's endpoints are its own still applies at the cell host.
  • loom login gains --org and --wait (sdk/python/loom/cli.py); --wait without --org (whatever its value), --org "", and a --wait that is negative or not finite (nan, inf) are refused; loom.login(org="") refuses too.
  • Docs: the SDK reference's Credentials section (loom.login(org=…), and that the session is then the cell host's, so base_url or LOOM_BASE_URL points there), the CLI reference's session-commands paragraph, the guide to using Loom without the dashboard, and the page's code map.

Scope and risk

SDK only, and only with --org: a loom login without it is unchanged. Still to come with the routing pull request: routing rules 1 to 4, the first cell's org-first sign-in page, and the page's two-cell integration test for loom login --org (no router, NO_CELL, a 429 until --wait runs out, a down directory with a cached and an uncached org).

Compatibility, rollout and rollback

Additive flags and keyword arguments. Against a deployment with no router the lookup's 404 keeps the server, so --org is harmless there.

Tests

  • tests/unit/test_sdk_credentials.py: with --org, the lookup asks for that org (org=beta), the sign-in happens at the cell host the router names and the stored session names that server; a 404 and a NO_CELL 503 keep the given server; an outage's 503, a 500 and an answer with no host refuse with no sign-in started and nothing stored; a 429 is waited out (the Retry-After honoured) and the sign-in goes on at the cell; with Retry-After: 7 and a 20 s --wait it waits twice and then refuses as a RateLimited classed capacity, with status 429, with no sign-in; an http router still sends the sign-in to https:// at the cell; each malformed host (including [eu-2 and 999.1.1.1) refuses with no sign-in, classed internal, with status 200; an outage's 503 is classed dependency, retryable, with status 503, and a 400 is not retryable, with status 400; a body that is not JSON refuses naming the router; a lookup naming the given server (case and all) prints no 'Org … is at'; --wait without --org (whatever its value), --org "", and a --wait that is negative or not finite (nan, inf) are refused; loom.login(org=""), a wait_s of nan, inf or -1 (with or without an org) refuse with no lookup and no sign-in; the lookup asks for the org it was given; a Retry-After of 7, inf, nan, soon, 600 or 0 is waited as 7, 1, 1, 1, 60 and 1 s. The fake server now advertises each host's own endpoints, as a cell does at its own host.
  • Dropping the NO_CELL case made its test fail.
  • At this head: the SDK credential tests (114 passed); make lint and make typecheck pass. 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 typecheck and make test-unit pass (the full unit suite result follows in Tests).
  • Generated files are regenerated in this PR, not by hand: the SDK op tables, docs/reference/configuration.md and the docs/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).
  • A new migration is additive and numbered after the latest on main; no merged migration is edited.
  • A behaviour change to any file a plugin ships (hooks/, lib/, bin/, skills/, .mcp.json, the Codex plugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.
  • The frontend builds (npm --prefix frontend run build) and its tests pass, if frontend/ changed.
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers; the history goes in this description (tests/unit/test_public_copy.py).
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.

🤖 Generated with Claude Code

@zlareb1
zlareb1 force-pushed the feat/cell-wrong-cell-error branch from 9dbb584 to ee490a8 Compare November 11, 2026 14:48
@zlareb1
zlareb1 force-pushed the feat/cell-login-org branch from 452ee5c to 9ce65fe Compare November 11, 2026 14:48
@zlareb1
zlareb1 force-pushed the feat/cell-wrong-cell-error branch from ee490a8 to c342df7 Compare November 11, 2026 15:11
@zlareb1
zlareb1 force-pushed the feat/cell-login-org branch from 9ce65fe to 7d23c72 Compare November 11, 2026 15:11
@zlareb1
zlareb1 force-pushed the feat/cell-wrong-cell-error branch from c342df7 to 5386e61 Compare November 11, 2026 15:31
@zlareb1
zlareb1 force-pushed the feat/cell-login-org branch from 7d23c72 to 649c4e8 Compare November 11, 2026 15:31
@zlareb1
zlareb1 force-pushed the feat/cell-wrong-cell-error branch from 5386e61 to 1f1a1b2 Compare November 11, 2026 15:47
@zlareb1
zlareb1 force-pushed the feat/cell-login-org branch from 649c4e8 to 6002130 Compare November 11, 2026 15:47
@zlareb1
zlareb1 force-pushed the feat/cell-wrong-cell-error branch from 1f1a1b2 to f920c51 Compare November 12, 2026 01:10
@zlareb1
zlareb1 changed the base branch from feat/cell-wrong-cell-error to main November 12, 2026 01:10
@zlareb1
zlareb1 force-pushed the feat/cell-login-org branch from 6002130 to b5f0cad Compare November 12, 2026 01:40
@zlareb1
zlareb1 marked this pull request as ready for review November 12, 2026 01:40
@zlareb1
zlareb1 merged commit a4bcac7 into main Nov 12, 2026
@zlareb1
zlareb1 deleted the feat/cell-login-org branch November 12, 2026 01:40
@zlareb1 zlareb1 mentioned this pull request Nov 12, 2026
3 tasks done
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