feat: reliable account-code recovery (shop_account_code_get)#37
Merged
Conversation
A chat-registered customer needs their accountCode to set up web login, but surfacing it at registration is model-mediated and can be skipped, which previously left them with no way to recover it (shop_customer_lookup strips the code; /account needs login first). Add a read-only, own-code-only path so they are never stuck: a linked customer can ask "what's my account code / how do I log in online" and the agent calls the new shop_account_code_get tool, which resolves the caller's OWN customer by channel identity and returns just that account's code. An unlinked or mismatched caller is refused — it can never return another account's code. Purely additive: no existing function/tool/response shape changed, no data-model change (accountCode already exists), no mutation, no web/storefront/auth changes. shop:eval +3 (97 total): owner reads own code; unlinked refused (no leak); own-only (a second linked customer gets THEIR code, never Lin's). Verified live: a linked customer asked for their code and the agent returned the correct one with web-login guidance. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Why
Setting up a web login for a chat-registered account (the bridge from #35) needs the account code. Surfacing it at registration is model-mediated (#36 made it a hard skill rule, but a prompt can't guarantee 100%), and there was no recovery path if the agent skipped it: `shop_customer_lookup` deliberately strips the code, and `/account` needs login first. So a customer could get genuinely stuck.
What
A read-only `shop_account_code_get` tool + skill guidance: a linked customer who asks "what's my account code / how do I log in online" gets it read back. The tool resolves the caller's own customer strictly by channel identity and returns only that account's code; an unlinked or mismatched caller is refused.
Blast radius (deliberately minimal)
Coverage
🤖 Generated with Claude Code