Skip to content

fix(identity): tie channel link codes to their app and claim them atomically (foreman-igvm) - #55

Merged
hamchowderr merged 1 commit into
mainfrom
claude/channels-link-codes
Oct 22, 2026
Merged

hamchowderr merged 1 commit into
mainfrom
claude/channels-link-codes

Conversation

@hamchowderr

@hamchowderr hamchowderr commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Requested by Chowderr · project thread

This is part 1 of 3 of the channels split, which replaces #54. Merge in order: this PR, then #57 (channels on the controller), then #58 (removing the old bots).

Before: a /link code made for Telegram also linked a Discord account, because redemption never checked which app the code was for. Checking that a code was unused and marking it used were two separate steps, so two redeems of the same code could both succeed.

After: a code made for a different app is refused with wrong_channel. The code is claimed with a conditional update (used_at IS NULL), so only one redeem wins. A successful redeem also returns the web user it linked to, which #57 uses to move old channel threads over.

How: the change is in redeemChannelLinkCode (lib/identity.ts), and RedeemResult becomes a discriminated union. The existing bots already reply "Code not found" for any other error, so they need no change here. Three unit tests are added.

Beads: foreman-igvm


🤖 Generated with Claude Code

https://claude.ai/code/session_01T3R2sPwBzA2bpj3HT2BDv2

…mically (foreman-igvm)

redeemChannelLinkCode never checked the code's channel, so a code made for
Telegram also linked a Discord account. The used check and the update were
two steps, so two redeems of one code could both link. Now a code for another
app is refused ("wrong_channel"), the claim is a conditional update on
used_at IS NULL, and a successful redeem returns the web user it linked to.

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

vercel Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
foreman Ready Ready Preview Oct 20, 2026 2:08pm UTC

Request Review

@hamchowderr
hamchowderr force-pushed the claude/channels-link-codes branch from e0b0537 to 0cc521e Compare October 20, 2026 14:07
@hamchowderr hamchowderr changed the title fix(identity): tie channel link codes to their app and claim them atomically fix(identity): tie channel link codes to their app and claim them atomically (foreman-igvm) Oct 20, 2026
@hamchowderr
hamchowderr marked this pull request as ready for review October 22, 2026 17:36
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-22T17:36:34.356225Z
We couldn’t complete this review. Comment @codex review to try again.
0cc521e Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@hamchowderr
hamchowderr merged commit 1c29162 into main Oct 22, 2026
8 checks passed
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

This branch was successfully deployed

1 active deployment
Preview — 0cc521e4 Deployed Oct 20, 2026 by vercel[bot]
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