fix: relay the upgrade line when Firecrawl usage runs out

MA
2d ago
+114-20

Why

When an account runs out of credits, or use without an account reaches its daily limit, the agent should finish what it can and tell the person how to keep going. Today a crawl that hits a 402 shows only Request failed with status code 402, the keyless message calls its limit a rate limit and gives the agent nothing to relay, and the server instructions are silent on both.

Summary

  • Server instructions (src/server.ts): both default profiles open with one sentence, first so clients that shorten instructions keep it:

    If Firecrawl reports that credits ran out or the daily limit without an account was reached, end your final answer with the line it provides, link included.

    The trigger names both cases as the errors state them, and matches neither the free plan's monthly credits nor an ordinary rate limit. The rest of the instructions is unchanged: 3,411 characters authenticated and 1,565 keyless, inside Claude Code's current 4,096 limit, with the pinned routing copy still ending at character 1,774, inside the older 2,048 limit.

  • Daily limit without an account (src/recovery.ts): search, scrape and parse return

    Firecrawl's daily limit without an account was reached.
    
    <setup steps, unchanged>
    
    Finish the task without Firecrawl, then end your answer with this line:
    You've reached Firecrawl's daily limit without an account. Sign up free for 1,000 credits a month: <signup link>
    

    The relay line closes the message. A 429 without a known reason gets a generic message instead, since its cause may be transient.

  • Crawl errors (src/server.ts): firecrawl_crawl relays the API's error text, so an account out of credits sees the upgrade link. Search (3.30.2), scrape, map and agent already did.

  • Release 3.30.3.

Test Plan

  • pnpm test: 171 of 171 pass.
  • End to end, keyless: search, scrape and hosted parse against a 429 with reason: "credits" return KEYLESS_QUOTA_EXHAUSTED ending with the relay line; a 429 without a reason returns KEYLESS_LIMIT_REACHED with no daily limit claim and no relay line.
  • End to end, account: search, scrape, map and crawl against a 402 each show the API's text. Without the crawl change, crawl shows only Request failed with status code 402.
  • Smoke tests pin the sentence at the start of both profiles; routing copy assertions still pass inside the first 2,048 characters.
  • Contract snapshots regenerated; every change is the prepended sentence.
  • tsc --noEmit and eslint are clean.