Skip to content

fix(sendcloud): require to_country to avoid 14s 'all carriers' calls#274

Merged
keysersoft merged 1 commit into
mainfrom
fix/sendcloud-shipping-methods
May 28, 2026
Merged

fix(sendcloud): require to_country to avoid 14s 'all carriers' calls#274
keysersoft merged 1 commit into
mainfrom
fix/sendcloud-shipping-methods

Conversation

@keysersoft
Copy link
Copy Markdown
Contributor

What

sendcloud_list_shipping_methods ran for 14.5s in production today. The user passed only from_country: NL so Sendcloud returned every method for every country worldwide. The other 23 Sendcloud calls in the same 48h window were 140-251ms — only this endpoint had the unscoped-query foot-gun.

Fix

  • Add to_country to the JSON Schema required[] list.
  • Rewrite the description to be explicit about why this matters.

The LLM already follows description hints reasonably well (it passed from_country without prompting), so the combined fix should drop p99 for this tool from 14s back to <1s.

Test plan

  • JSON validates
  • After release: trigger sendcloud_list_shipping_methods with to_country=DE → expect <1s response

@keysersoft keysersoft requested a review from D3nisty as a code owner May 28, 2026 10:33
@keysersoft keysersoft enabled auto-merge (squash) May 28, 2026 10:33
…calls

Telemetry showed sendcloud_list_shipping_methods running for 14.5s in
production — info@siliconesandmore.com called it with only
`from_country: NL` and no destination, so Sendcloud returned every
shipping method for every country (thousands of rows, no
server-side filter).

Fix: add to_country to the JSON Schema required[] list and rewrite the
description to be loud about the consequence of omitting it. Even
without the schema enforcement the LLM was already passing
from_country, so it clearly was reading the descriptions; making the
new copy explicit + flagging required[] should be enough.

This is a soft breaking change for any agent that was relying on the
'list everything' behavior — but in 48h of production data that was 0
of 24 Sendcloud calls. The other Sendcloud tools (list_parcels,
get_parcel) returned in 140-251ms; only this one endpoint had the
unscoped-query foot-gun.
@keysersoft keysersoft force-pushed the fix/sendcloud-shipping-methods branch from 6529656 to 4baa7a8 Compare May 28, 2026 10:41
@keysersoft keysersoft merged commit 178ef8f into main May 28, 2026
10 checks passed
@keysersoft keysersoft deleted the fix/sendcloud-shipping-methods branch May 28, 2026 10:43
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