Skip to content

feat: reliable account-code recovery (shop_account_code_get)#37

Merged
Lelevinson merged 1 commit into
mainfrom
feat/account-code-recovery
Jun 11, 2026
Merged

feat: reliable account-code recovery (shop_account_code_get)#37
Lelevinson merged 1 commit into
mainfrom
feat/account-code-recovery

Conversation

@Lelevinson

Copy link
Copy Markdown
Owner

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)

  • Purely additive — no existing function, tool, or response shape changed.
  • No data-model change (`accountCode` already exists on every customer), no mutation, no preview/confirm, no money.
  • Untouched: cart, orders, returns, checkout, storefront, existing auth.
  • The one real risk — gating — is pinned by evals: own-code returned, unlinked refused (no leak), and a second linked customer gets THEIR code, never another's.

Coverage

  • shop:eval +3 (97 total).
  • Verified live: a linked customer asked for their code; the agent called `shop_account_code_get` and returned the correct code with web-login guidance.

🤖 Generated with Claude Code

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>
@Lelevinson Lelevinson merged commit 28992f2 into main Jun 11, 2026
2 checks passed
@Lelevinson Lelevinson deleted the feat/account-code-recovery branch June 11, 2026 13:54
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