fix(twitter): add 5s network timeout to resolveTwitterQueryId#1106
Merged
jackwener merged 1 commit intojackwener:mainfrom Apr 21, 2026
Merged
fix(twitter): add 5s network timeout to resolveTwitterQueryId#1106jackwener merged 1 commit intojackwener:mainfrom
jackwener merged 1 commit intojackwener:mainfrom
Conversation
The resolveTwitterQueryId() function in shared.js fetches an external JSON file from GitHub without a timeout. If the network request stalls, the function never resolves and the twitter article command hangs indefinitely. Add a 5-second AbortController timeout so the fetch fails fast and falls back to the local script-scanning strategy. This fixes the reported hang when opencli twitter article loses network connectivity.
luxiaolei
pushed a commit
to luxiaolei/OpenCLI
that referenced
this pull request
Apr 22, 2026
…jackwener#1106) The resolveTwitterQueryId() function in shared.js fetches an external JSON file from GitHub without a timeout. If the network request stalls, the function never resolves and the twitter article command hangs indefinitely. Add a 5-second AbortController timeout so the fetch fails fast and falls back to the local script-scanning strategy. This fixes the reported hang when opencli twitter article loses network connectivity. (cherry picked from commit f7fd805)
4 tasks
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.
Fix: twitter article command hangs on network stall
Problem
The
opencli twitter articlecommand hangs indefinitely when network connectivity is unavailable. This occurs becauseresolveTwitterQueryId()inclis/twitter/shared.jsfetches an external JSON file from GitHub without any timeout. If that fetch stalls (no response, no error), the function never resolves and the entire command hangs.Solution
Wrap the
fetch()call insideresolveTwitterQueryId()with anAbortControllerthat aborts after 5 seconds. On timeout (or any other network error), the code falls through to the existing script-scanning fallback strategy, which uses localperformance.getEntriesByType('resource')and requires no network access.Changes
clis/twitter/shared.js — Added a 5-second
AbortControllertimeout to the GitHub fetch. TheclearTimeoutis called in both thecatchand after the successful response so there's no lingering timer.Testing
npm run buildcompletes successfullynpx tsc --noEmitpassesRelated
Fixes open issue #1082