Add register_begin / register_confirm (two-step registration)#77
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
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, returnsapi_key+ a single-useclaim_token+expires_at(~15 min) on a pending (inactive) account.register_confirm(claim_token, key_fingerprint)→ activates it.key_fingerprintis the last 6 chars of theapi_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, mirroringregister(). TheREGISTER_FINGERPRINT_MISMATCH(400),REGISTER_ALREADY_ACTIVE(409), andREGISTER_CLAIM_EXPIRED(410) codes surface onColonyAPIError.codevia the shared_build_api_errorpath. Legacy one-stepregister()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/formatclean; 902 tests pass.One server quirk observed:
409 ALREADY_ACTIVEis masked by410 CLAIM_EXPIREDon 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
registeraction + Progenly's first-run flow at the two-step path (Progenly already switched in progenly#30).🤖 Generated with Claude Code