Skip to content

Add register_begin / register_confirm (two-step registration)#77

Merged
jackparnell merged 2 commits into
mainfrom
feat/two-step-registration
Jun 18, 2026
Merged

Add register_begin / register_confirm (two-step registration)#77
jackparnell merged 2 commits into
mainfrom
feat/two-step-registration

Conversation

@ColonistOne

Copy link
Copy Markdown
Collaborator

What

Client support for The Colony's opt-in two-step registration (live as release 2026-06-18a) — the fix for the "agent loses the once-shown api_key → re-registers → duplicate/orphaned account" failure (e.g. sol-raven → solraven).

  • register_begin(username, display_name, bio) → reserves the name, returns api_key + a single-use claim_token + expires_at (~15 min) on a pending (inactive) account.
  • register_confirm(claim_token, key_fingerprint) → activates it. key_fingerprint is the last 6 chars of the api_key (non-secret by construction). The confirm gate makes "save the key" a precondition: a lost key just lets the pending reg expire and frees the name, instead of minting a silent duplicate.

Both are static methods on ColonyClient + AsyncColonyClient, mirroring register(). The REGISTER_FINGERPRINT_MISMATCH (400), REGISTER_ALREADY_ACTIVE (409), and REGISTER_CLAIM_EXPIRED (410) codes surface on ColonyAPIError.code via the shared _build_api_error path. Legacy one-step register() is unchanged.

Verification

Smoke-tested live against thecolony.cc (begin shape, confirm happy path, fingerprint-mismatch gate all match the server contract). 100% coverage retained (sync + async, incl. error/network branches); mypy src/ clean, ruff check/format clean; 902 tests pass.

One server quirk observed: 409 ALREADY_ACTIVE is masked by 410 CLAIM_EXPIRED on a same-token re-confirm (single-use claim_token), flagged to @arch-colony. Docstrings note it; non-blocking for confirm-once.

Downstream: unblocks pointing the colony-skill register action + Progenly's first-run flow at the two-step path (Progenly already switched in progenly#30).

🤖 Generated with Claude Code

The Colony shipped opt-in two-step registration (release 2026-06-18a) to
fix the "agent loses the once-shown api_key -> re-registers -> duplicate/
orphaned account" failure. Wire up the client side:

- register_begin(username, display_name, bio) -> reserves the name and
  returns api_key + a single-use claim_token + expires_at (~15 min) on a
  PENDING (inactive) account.
- register_confirm(claim_token, key_fingerprint) -> activates it, where
  key_fingerprint is the last 6 chars of the api_key (non-secret by
  construction). The confirm gate enforces "save the key" as a precondition.

Both are static methods on ColonyClient + AsyncColonyClient, mirroring the
existing register(). The REGISTER_FINGERPRINT_MISMATCH (400),
REGISTER_ALREADY_ACTIVE (409) and REGISTER_CLAIM_EXPIRED (410) codes surface
on ColonyAPIError.code via the shared _build_api_error path. Legacy one-step
register() is unchanged.

Verified live against thecolony.cc. 100% coverage retained (sync + async +
error/network branches); mypy + ruff clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TRn9SBFGaxRwZbwRsKNJ7b
@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@jackparnell jackparnell merged commit 5d86825 into main Jun 18, 2026
7 checks passed
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.

2 participants