Repository navigation
Conversation
This branch has not been deployed
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.
PERPLEXITY_TIMEOUT_MS goes through parseInt straight into setTimeout. Node runs a timer after 1ms when the delay is NaN, below 1, or above 2147483647, so setting the variable to 0 (a common way to ask for no timeout), to a typo like "abc", or to a very large value meant to give research runs plenty of time made every tool call fail right away. The error then reads "Perplexity API did not respond within 3000000000ms", which sends people looking in the wrong place.
I moved the parsing into one small helper used by both makeApiRequest and performAgentResponse. A value that is not a positive number falls back to the 300000ms default, and anything above the timer limit is capped at 2147483647ms (about 24 days). Valid values behave exactly as before.
The new tests set PERPLEXITY_TIMEOUT_MS to 0, -1, abc and 3000000000 and check that an agent call answering after 20ms still returns its answer, plus the same check for perplexity_search with the large value. All five fail on main with the immediate timeout error and pass with this change.