Repository navigation
fix(plugins): add explicit timeouts to requests calls lacking one - #15124
glmbugbounty wants to merge 1 commit into
Conversation
requests applies no default timeout: an upstream that completes the TCP handshake and then stalls keeps the caller blocked forever, and a blocking call inside an async def handler stalls the whole event loop for every route on that worker. Add REQUEST_TIMEOUT = (5, 30) to the 16 plugin files that make 76 of the 108 requests calls under plugins/ with no timeout, and pass it to each of those calls (the 19 on the event loop are mostly OAuth token exchanges against third parties). This is the fourth instance of the same bug class (BasedHardware#14278, BasedHardware#14255, BasedHardware#14257), so per AGENTS.md add a reusable guard instead of a fifth one-off fix: scripts/check_plugin_request_timeouts.py, a stdlib ast scanner wired into .github/checks-manifest.yaml on plugins/**/*.py, with its own unit tests. Update the ClickUp client test mocks to accept the new timeout kwarg.
|
Closing as a duplicate of #15113 (opened ~45 minutes earlier for the same unbounded-requests class). The 16 plugin file patches are byte-identical to #15113. The deltas are scanner wording, where the checks-manifest entry is inserted, and extra unit tests. #15113 already has Failure-Class: none and Hygiene green. This PR's Hygiene and PR Metadata Preflight fail with missing_declaration (fix: commit, no Failure-Class in the body). Continue on #15113 rather than a second 20-file timeout sweep. |
|
Hey @glmbugbounty 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
What
requestsapplies no default timeout. An upstream that completes the TCP handshake and then stops answering keeps the caller blocked forever — exactly what a wedged provider, a silently dropped connection, or a blackholed route looks like.76 of the 108
requestscalls underplugins/passed notimeout, and 19 of those sit insideasync defhandlers, so a stalled upstream blocks the entire event loop for every route on that worker (most are OAuth token exchanges against third parties we don't control).This PR adds
REQUEST_TIMEOUT = (5, 30)to the 16 affected plugin files and passes it to each of those 76 calls (5s connect / 30s between bytes, matching the budgetdropbox_client.pyalready uses for downloads). Calls that already retry onrequests.exceptions.Timeoutkeep their tenacity policy.omi-github-appomi-clickup-appcomposioomi-dropbox-appomi-twitter-chat-tools-appomi-google-calendar-appomi-shopify-appomi-shipbob-appomi-notion-appomi-linear-appomi-twitter-app/omi-slack-app/importWhy a guard this time
This exact bug class has been fixed one app at a time three times already (#14278 whoop, #14255 zapier, #14257 oauth). Per AGENTS.md that is the point where it should become a reusable guard instead of a fourth instance fix, so this PR also adds:
scripts/check_plugin_request_timeouts.py— a stdlib-onlyastscanner that fails the build when anyrequests.<verb>()orrequests.Session().<verb>()call underplugins/omitstimeout.scripts/test_check_plugin_request_timeouts.py— 13 unit tests covering flagged/clean cases (timeout present, named-constant timeout, session methods, non-requests calls, multi-line calls, keyword-only positional, syntax-error sources)..github/checks-manifest.yamlwired onplugins/**/*.py(local + ci lanes).How tested
python scripts/check_plugin_request_timeouts.py→ 0 violations (exit 0).python -m unittest test_check_plugin_request_timeouts(inscripts/) → 13 tests OK.python -m unittest discover -s <plugin> -p "test_*.py"passes for all 13 affected plugin dirs (composio, clickup, dropbox, github, google-calendar, linear, notion, shipbob, shopify, slack, twitter, twitter-chat-tools, import).timeoutkeyword (previously strictfake_post(url, headers, json)/get(url, headers, params)signatures).Bounty: $150 proposed, given the 16 files and the guard.