Repository navigation
fix(crawl): relay the API's reason when it refuses to start a crawl - #572
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
Contributor
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Relays the API's refusal reason for crawl start (402/429) as a UserError instead of a generic HTTP error, with tests covering the relayed message and no status polling. The change is confined to error reporting and matched by focused tests.
View guided diff | Turn on auto-fix | Re-trigger cubic
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.
firecrawl_crawlstarts the job with a rawhttp.post('/v2/crawl'), so an API refusal at start (out of credits, rate limited) reached the model asTool 'firecrawl_crawl' execution failed: Request failed with status code 402. The API's own reason, including its upgrade link or its "retry after Ns" wait, was in the response body and never shown.The start call now goes through
relayExchangeError, the same relayfirecrawl_searchuses. A refusal becomes aUserErrorcarrying the API'serrortext, withstatusandcodein its extras so a hosting layer can read the status. A 401 is still rethrown unchanged, and the polling path from #570 is untouched.Tests
tests/mcp-crawl-polling.test.mjsgains a 402 and a 429 case against a mock API: the tool result is an error whose text contains the API's reason, never "Request failed with status code", and no status poll is made. The existing polling test now shares the same call helper.Summary by cubic
Relays the API's reason when it refuses to start a crawl, so a refusal (out of credits, rate limited) surfaces as a
UserErrorwith the API'serrortext instead of a generic "Request failed with status code". The start call now uses the samerelayExchangeErrorasfirecrawl_search, keeping status and code in extras; 401 responses are still rethrown, and the polling path is untouched.Added tests for 402 and 429 refusals verifying the relayed error, the
statusandcodeextras, and that no status poll is made.Written for commit 5285957. Summary will update on new commits.