fix(addie): surface did_you_mean in billing tools for non-canonical lookup_key aliases#3353
Draft
fix(addie): surface did_you_mean in billing tools for non-canonical lookup_key aliases#3353
Conversation
…ookup_key aliases When the LLM passes an aliased lookup_key (e.g. explorer_annual instead of aao_membership_explorer_50), create_payment_link/send_invoice/confirm_send_invoice now include did_you_mean: canonicalKey in the JSON response so the model learns the canonical key for subsequent calls in the same conversation. Also tightens the three tool descriptions to explicitly forbid constructing the key from tier name and billing interval. Bumps CODE_VERSION to 2026.04.6. Closes #2550 https://claude.ai/code/cse_01HULrqPhn8kLM76nSmcpj4d
aad8856 to
22cf57b
Compare
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.
Closes #2550
Summary
getPriceByLookupKeynow returns{ priceId, canonicalKey }instead ofstring | null, so alias resolution is a single call and callers learn the canonical key automaticallycreate_payment_link,send_invoice, andconfirm_send_invoiceincludedid_you_mean: canonicalKeyin their response when the LLM passed a non-canonical alias (e.g.explorer_annual→aao_membership_explorer_50), so the model corrects itself on subsequent callslookup_keyfrom tier name + billing interval;lookup_keyfield description simplified to "do not construct or guess this value"getPriceByLookupKeymoved inside try/catch with early-return on null — previously a Stripe network error would propagate as an unhandled rejection instead of a{ success: false }responsegetBillingProductsandresolveLookupKeyAliasimports from billing-tools.ts (alias resolution is handled insidegetPriceByLookupKey)CODE_VERSIONbumped to2026.04.6Non-breaking: adds an optional
did_you_meanfield to existing success-response JSON; no fields renamed or removed; existing callers unaffected.Test plan
create_payment_linkwith alias key (e.g.explorer_annual) → response includesdid_you_mean: "aao_membership_explorer_50"create_payment_linkwith canonical key → nodid_you_meanfield in responsecreate_payment_linkwith unknown key →{ success: false, error: "No product matches..." }send_invoiceandconfirm_send_invoicegetPriceByLookupKey→{ success: false }(not unhandled rejection)https://claude.ai/code/session_01HULrqPhn8kLM76nSmcpj4d