Skip to content

fix(addie): surface did_you_mean in billing tools for non-canonical lookup_key aliases - #3353

Closed
bokelley wants to merge 1 commit into
mainfrom
claude/issue-2550-billing-did-you-mean
Closed

bokelley wants to merge 1 commit into
mainfrom
claude/issue-2550-billing-did-you-mean

Conversation

@bokelley

@bokelley bokelley commented Apr 27, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2550

Summary

  • getPriceByLookupKey now returns { priceId, canonicalKey } instead of string | null, so alias resolution is a single call and callers learn the canonical key automatically
  • create_payment_link, send_invoice, and confirm_send_invoice include did_you_mean: canonicalKey in 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 calls
  • Tool descriptions tightened with explicit prohibition on constructing lookup_key from tier name + billing interval; lookup_key field description simplified to "do not construct or guess this value"
  • getPriceByLookupKey moved inside try/catch with early-return on null — previously a Stripe network error would propagate as an unhandled rejection instead of a { success: false } response
  • Removed now-unnecessary getBillingProducts and resolveLookupKeyAlias imports from billing-tools.ts (alias resolution is handled inside getPriceByLookupKey)
  • CODE_VERSION bumped to 2026.04.6

Non-breaking: adds an optional did_you_mean field to existing success-response JSON; no fields renamed or removed; existing callers unaffected.

Test plan

  • create_payment_link with alias key (e.g. explorer_annual) → response includes did_you_mean: "aao_membership_explorer_50"
  • create_payment_link with canonical key → no did_you_mean field in response
  • create_payment_link with unknown key → { success: false, error: "No product matches..." }
  • Same three cases for send_invoice and confirm_send_invoice
  • Stripe network error during getPriceByLookupKey → { success: false } (not unhandled rejection)

Triage-managed PR. To iterate: push fixup commits directly to this branch, or comment /triage execute on issue #2550 to re-trigger.

https://claude.ai/code/session_01HULrqPhn8kLM76nSmcpj4d

@bokelley bokelley added the claude-triaged Issue has been triaged by the Claude Code triage routine. Remove to re-triage. label Apr 27, 2026
…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
@bokelley
bokelley force-pushed the claude/issue-2550-billing-did-you-mean branch from aad8856 to 22cf57b Compare April 27, 2026 11:36
@bokelley bokelley changed the title feat(addie): surface canonical_lookup_key in billing tools; tighten lookup_key descriptions fix(addie): surface did_you_mean in billing tools for non-canonical lookup_key aliases Apr 27, 2026
bokelley added a commit that referenced this pull request Apr 30, 2026
The lifecycle-flow doc PR accidentally absorbed the did_you_mean billing
changes that are the subject of #3353. Reverting billing-tools.ts and
stripe-client.ts to origin/main and removing the duplicate changeset so
this PR is docs-only as intended.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
bokelley added a commit that referenced this pull request Apr 30, 2026
…l variation (#3354)

* fix(addie): surface did_you_mean in billing tools for non-canonical lookup_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

* docs: add Media Buy Lifecycle Flow page with state diagram and PG deal variation

Closes #2570.

https://claude.ai/code/session_01HULrqPhn8kLM76nSmcpj4d

* chore: remove billing changes that belong on #3353

The lifecycle-flow doc PR accidentally absorbed the did_you_mean billing
changes that are the subject of #3353. Reverting billing-tools.ts and
stripe-client.ts to origin/main and removing the duplicate changeset so
this PR is docs-only as intended.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
@bokelley

Copy link
Copy Markdown
Contributor Author

Closing — main is already at the right shape per the feedback_addie_tools_just_work design intent.

Current state in server/src/billing/stripe-client.ts:343-350 (getPriceByLookupKey):

  • Cache lookup
  • Direct Stripe lookup
  • Alias resolution via resolveLookupKeyAlias with an observability logger.info line on hit
  • Structured warn on miss (no #admin-errors page)

The tool already accepts aliases and resolves silently. The PR's additions (return-shape change, did_you_mean response field, "IMPORTANT do NOT construct" prompt rules) would make Addie aware of canonical vs alias — which is exactly what the design memory says to avoid. If we want to go further, the right next step is the opaque-token approach (e.g. product_id: "prod_abc123" returned from find_membership_products, taken verbatim by create_payment_link) — separate PR.

— Triage 2026-05-13

@bokelley bokelley closed this May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude-triaged Issue has been triaged by the Claude Code triage routine. Remove to re-triage.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Addie billing tools: surface did_you_mean in tool response + tighten lookup_key tool descriptions

2 participants