Skip to content

Commit cfa6b2f

Browse files
committed
fix(pi): restore firecrawl's server-side budget after the timeout rename
Pi search set params.timeout, which served as both the transport deadline and Firecrawl's own body timeout -- the collision this PR exists to remove. Renaming the tool param dropped the body field from the host path while the sandbox path still hardcoded it, so the two diverged. Setting firecrawlTimeout restores the documented intent that both paths send the same effective deadline.
1 parent 2937b7e commit cfa6b2f

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

apps/sim/executor/handlers/pi/search/normalize.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
PI_SEARCH_MAX_RESULTS,
1414
PI_SEARCH_MAX_SNIPPET_LENGTH,
1515
PI_SEARCH_MAX_TITLE_LENGTH,
16+
PI_SEARCH_TIMEOUT_MS,
1617
PI_SEARCH_TOOL_PARAMETERS,
1718
PI_SEARCH_TRUNCATED_MESSAGE,
1819
parsePiSearchArgs,
@@ -90,6 +91,10 @@ describe('buildPiSearchProviderArgs', () => {
9091
expect(buildPiSearchProviderArgs('firecrawl', query)).toEqual({
9192
query: 'ts 5.9 release notes',
9293
limit: 3,
94+
// Firecrawl's own server-side budget, carried under a name that does not collide with the
95+
// transport's reserved `timeout`. The sandbox path sends the same value, and
96+
// parity.test.ts is what holds the two paths together.
97+
firecrawlTimeout: PI_SEARCH_TIMEOUT_MS,
9398
})
9499
})
95100
})

apps/sim/executor/handlers/pi/search/normalize.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ export function parsePiSearchArgs(args: Record<string, unknown>): PiSearchQuery
156156
* default — so this is the one place the mapping is written down.
157157
*
158158
* Note two declared-type traps that make this look impossible from the tool definitions:
159-
* `firecrawl_search` declares only `query`/`apiKey` yet its request body reads `params.limit`, and
159+
* `firecrawl_search` declares only `query`/`apiKey` yet its request body reads `params.limit` and
160+
* `params.firecrawlTimeout`, and
160161
* `exa_search` declares `text` as a boolean yet the object form is what requests page text. Both
161162
* work because `executeTool` hands the raw parameter bag to `body()`.
162163
*/
@@ -172,7 +173,12 @@ export function buildPiSearchProviderArgs(
172173
case 'parallel':
173174
return { objective: query, max_results: numResults }
174175
case 'firecrawl':
175-
return { query, limit: numResults }
176+
/**
177+
* `firecrawlTimeout` becomes Firecrawl's own server-side `timeout` body field. It is named
178+
* apart from `timeout` because the transport reads `params.timeout` as the outbound fetch
179+
* deadline, so a single key cannot mean both. The sandbox path hardcodes the same value.
180+
*/
181+
return { query, limit: numResults, firecrawlTimeout: PI_SEARCH_TIMEOUT_MS }
176182
}
177183
}
178184

0 commit comments

Comments
 (0)