Repository navigation
fix(plugins): bound every requests call with a timeout - #15113
Conversation
|
Verified on this head:
Two non-blocking notes:
Good reliability work — the event-loop framing in the description matches the code (19 unbounded calls inside 🤖 Automated review on behalf of the maintainers. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
aryanorastar
left a comment
There was a problem hiding this comment.
Verified on 6e343d2 against origin/main 1ef3b91.
origin/main still has 76 unbounded requests calls under plugins/ (19 inside async def). scripts/check_plugin_request_timeouts.py is a real AST scanner; on this tip it reports 210 file(s) checked, no unbounded calls. plugin-request-timeouts and plugin-request-timeout-check-tests are in .github/checks-manifest.yaml. Scanner tests 4/4 OK. Production hunks are timeout=REQUEST_TIMEOUT plus the (5, 30) constants; test_clickup_client.py only updates call kwargs.
Hygiene is already green. I am not merging. #15124 stays closed as a duplicate of this vehicle.
29ed922 to
7b8b52e
Compare
|
Rebased onto fdcae0a. Two conflicts with main, both resolved: the dropbox token refresh had picked up a literal The Dart Tests (Pacific/Kiritimati) failure on the previous head was not from this diff, which touches no Dart. It was the tearDown in app/test/unit/local_recordings_owner_test.dart racing the filesystem: That line does After the rebase: scanner reports 218 files checked, no unbounded calls; scanner tests 4/4; dropbox suites pass. |
|
Hygiene was failing on Checked main's copy directly, running it under a python without requests or tenacity: Same failure, so the check only passes where tenacity happens to be installed. This branch triggers it because it touches the dropbox files. Fixed in a66fadd: added a tenacity stub, bound
|
kodjima33
left a comment
There was a problem hiding this comment.
5/5 confidence: real bug (missing timeouts on 75+ requests calls across 16 plugin files, some blocking the async event loop), root cause well-documented with reproduction, scoped to timeout-only changes plus a reusable CI guard script, fixes referenced issue #15112, all CI green.
|
Verified on This stays the timeout vehicle for #15112. The scanner is still missing on main, and origin/main still has unbounded I am not approving or merging this SHA. GitHub reports CONFLICTING/DIRTY on Please rebase onto current main, drop My earlier approve was on |
aryanorastar
left a comment
There was a problem hiding this comment.
Re-reviewed current head a66fadd899f0 (prior APPROVE was 6e343d2bd8fb). origin/main requests calls in composio/plugins still have no timeout. Scanner + tests pin the bound. Hygiene SUCCESS. Not merging.
|
The touched plugin clients on main still call — Astar, on behalf of @aryanorastar |
requests has no default timeout, so an upstream that accepts the connection and then stops answering pins the caller. 19 of the 76 unbounded calls sat in async handlers, where the blocking call holds the event loop and the app stops answering everyone.
The same class was fixed one app at a time in BasedHardware#14278, BasedHardware#14255 and BasedHardware#14257. The scanner is stdlib only, follows requests.Session aliases, and reports which findings sit in an async handler.
a66fadd to
dbcc7af
Compare
|
Request timeouts are the right class, but — Astar, on behalf of @aryanorastar |
aryanorastar
left a comment
There was a problem hiding this comment.
Slack OAuth requests.post still has no timeout. This head sets timeout= on the plugin request calls. Hygiene passed on dbcc7af7ed27.
|
Verified this end to end from the head commit: ran The plugin diffs are purely additive Two minor, non-blocking notes on the scanner for future hardening:
The new checks-manifest entries only execute the repo-local python3 scripts added here, so no CI-surface risk. Thanks for fixing the whole class and landing the guard instead of a fourth per-app patch — the AGENTS.md trigger reasoning and the PR writeup are exactly right.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
kodjima33
left a comment
There was a problem hiding this comment.
fix(plugins): every requests call in plugins/ now has a (5,30) timeout to stop event-loop-blocking hangs on OAuth callbacks — root cause well documented (75/108 unbounded calls, 19 on the event loop), linked issue #15112, adds reusable CI guard script + tests, CI fully green, already approved twice each by kodjima33 and aryanorastar. Diff is large (309+62) but mechanical/repeated across files; confidence 4/5, merging.
Fixes #15112.
requestsapplies no default timeout, so an upstream that completes the TCP handshake and then stops answering keeps the caller waiting forever. 75 of the 108requestscalls inplugins/have no timeout on current main (one of the original 76 picked up a literaltimeout=10in the meantime), and 19 of those sit inasync defhandlers, where the blocking call holds the event loop and the app stops answering everyone, not just the caller.Every call now passes a
timeout. Each file gets aREQUEST_TIMEOUT = (5, 30)constant, 5 seconds to connect and 30 between bytes, which is the valuedropbox_client.pyalready used for its downloads. The 16 files are: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,importThe event-loop ones are mostly OAuth token exchanges:
shopify_callback,linear_callback,twitter_callback,auth_callback(dropbox),handle_shipbob_callback,google_callback,notion_callback, plus composio's page extraction and clickup'screate_task.This class has been fixed one app at a time three times already: #14278 (whoop), #14255 (zapier) and #14257 (oauth). That is the trigger in AGENTS.md for a reusable guard rather than a fourth instance fix, so
scripts/check_plugin_request_timeouts.pylands with it. It is stdlib only, followsrequests.Session()aliases, and reports whether each finding sits in anasync def. Two manifest entries run it and its own tests onplugins/**/*.py.Verified by running, from the repo root:
The event-loop claim is not theory. Against a socket that accepts and never answers, with a FastAPI app whose
async def /callbackcallsrequests.geton it, an unrelated/healthrequest on the same worker:Sizing: the connect budget is 5s and the read budget 30s, matching
DropboxClient.DEFAULT_DOWNLOAD_TIMEOUT, which already transfers the same files. Calls that retry onrequests.exceptions.Timeout(dropbox upload and download) keep their existing tenacity policy, so a slow-but-alive upstream still gets its retries instead of one unbounded wait.Merged main in. Two follow-up commits came out of that:
test_clickup_client.pygot a new due-date double in fix(clickup): keep the instant an ISO due date names #15157; this PR gives that call atimeout, so the double now accepts the kwarg.dropbox-token-refresh-and-tools-testswas red on main when this was opened, and this PR selects it. test(dropbox-app): make test_token_refresh_and_tools runnable without tenacity #15186 has since made that suite hermetic on main (tenacity stub,DropboxClientimported inside the stub context), which is the same repair this branch carried, so on rebase those two test commits are dropped and the suite is main's own. It passes against this branch's timeout changes under barepython3and the venv, 6 tests each.Failure-Class: none