Repository navigation
feat: 15112 - #20510
feat: 15112#20510monopolymummat-cmyk wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
8 issues found across 2 files
Confidence score: 1/5
scripts/check_plugin_request_timeouts.pyhas literal<content>wrapper lines, so Python cannot run the checker. Remove both lines.tests/test_check_plugin_request_timeouts.pyalso has invalid wrapper lines, so pytest cannot collect the tests. Remove both lines.- The checker can report success without checking every plugin when a file cannot be read or parsed. Record scan errors and exit nonzero.
- The tests don't reliably exercise their temporary fixtures: the subprocess path resolves under
temp_dir, while the checker scanspluginsunder its working directory. Use an absolute script path and run against an isolatedpluginsdirectory.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="tests/test_check_plugin_request_timeouts.py">
<violation number="1" location="tests/test_check_plugin_request_timeouts.py:1">
P1: The `<content>` and `</content>` wrapper lines are invalid Python syntax, so pytest fails while collecting this module; remove both wrapper lines.</violation>
<violation number="2" location="tests/test_check_plugin_request_timeouts.py:25">
P1: These subprocesses cannot find the script because `cwd=temp_dir` makes its relative path resolve inside the temporary directory; invoke the script by an absolute path in both tests.</violation>
<violation number="3" location="tests/test_check_plugin_request_timeouts.py:28">
P2: The passing fixture is never scanned: the checker reads `plugins` under `cwd=os.getcwd()`, not the temporary directory where `plugin_file` is written. Run the checker against an isolated temporary `plugins` directory so this test verifies the fixture.</violation>
</file>
<file name="scripts/check_plugin_request_timeouts.py">
<violation number="1" location="scripts/check_plugin_request_timeouts.py:1">
P0: The `<content>` and `</content>` delimiters are literal source lines, so Python raises `SyntaxError` before this checker can run; remove both delimiters.</violation>
<violation number="2" location="scripts/check_plugin_request_timeouts.py:28">
P2: This check misses valid imports such as `import requests as req; req.get(...)` and `from requests import get; get(...)`, allowing those calls to bypass the timeout gate; recognize imported aliases and directly imported functions.</violation>
<violation number="3" location="scripts/check_plugin_request_timeouts.py:32">
P2: This treats `timeout=None` as compliant, although Requests waits forever for that value. Reject a literal `None` so the checker cannot certify an unbounded request.</violation>
<violation number="4" location="scripts/check_plugin_request_timeouts.py:35">
P2: A `requests` call still blocks the event loop when it has a timeout; count async-context calls independently of the missing-timeout check so the event-loop total is accurate.</violation>
<violation number="5" location="scripts/check_plugin_request_timeouts.py:67">
P1: A plugin that cannot be parsed or read is skipped without affecting the exit status, so the checker can report success without checking every plugin; record scan errors and exit nonzero.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| @@ -0,0 +1,96 @@ | |||
| <content> | |||
There was a problem hiding this comment.
P0: The <content> and </content> delimiters are literal source lines, so Python raises SyntaxError before this checker can run; remove both delimiters.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At scripts/check_plugin_request_timeouts.py, line 1:
<comment>The `<content>` and `</content>` delimiters are literal source lines, so Python raises `SyntaxError` before this checker can run; remove both delimiters.</comment>
<file context>
@@ -0,0 +1,96 @@
+<content>
+#!/usr/bin/env python3
+
</file context>
|
|
||
| # Run the script | ||
| result = subprocess.run( | ||
| ["python", "scripts/check_plugin_request_timeouts.py"], |
There was a problem hiding this comment.
P1: These subprocesses cannot find the script because cwd=temp_dir makes its relative path resolve inside the temporary directory; invoke the script by an absolute path in both tests.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At tests/test_check_plugin_request_timeouts.py, line 25:
<comment>These subprocesses cannot find the script because `cwd=temp_dir` makes its relative path resolve inside the temporary directory; invoke the script by an absolute path in both tests.</comment>
<file context>
@@ -0,0 +1,97 @@
+
+ # Run the script
+ result = subprocess.run(
+ ["python", "scripts/check_plugin_request_timeouts.py"],
+ capture_output=True,
+ text=True,
</file context>
| @@ -0,0 +1,97 @@ | |||
| <content> | |||
There was a problem hiding this comment.
P1: The <content> and </content> wrapper lines are invalid Python syntax, so pytest fails while collecting this module; remove both wrapper lines.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At tests/test_check_plugin_request_timeouts.py, line 1:
<comment>The `<content>` and `</content>` wrapper lines are invalid Python syntax, so pytest fails while collecting this module; remove both wrapper lines.</comment>
<file context>
@@ -0,0 +1,97 @@
+<content>
+import os
+import subprocess
</file context>
| check_for_requests_calls(tree, filepath) | ||
|
|
||
| except SyntaxError as e: | ||
| print(f"Syntax error in {filepath}: {e}") |
There was a problem hiding this comment.
P1: A plugin that cannot be parsed or read is skipped without affecting the exit status, so the checker can report success without checking every plugin; record scan errors and exit nonzero.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At scripts/check_plugin_request_timeouts.py, line 67:
<comment>A plugin that cannot be parsed or read is skipped without affecting the exit status, so the checker can report success without checking every plugin; record scan errors and exit nonzero.</comment>
<file context>
@@ -0,0 +1,96 @@
+ check_for_requests_calls(tree, filepath)
+
+ except SyntaxError as e:
+ print(f"Syntax error in {filepath}: {e}")
+ except Exception as e:
+ print(f"Error processing {filepath}: {e}")
</file context>
| ["python", "scripts/check_plugin_request_timeouts.py"], | ||
| capture_output=True, | ||
| text=True, | ||
| cwd=os.getcwd() |
There was a problem hiding this comment.
P2: The passing fixture is never scanned: the checker reads plugins under cwd=os.getcwd(), not the temporary directory where plugin_file is written. Run the checker against an isolated temporary plugins directory so this test verifies the fixture.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At tests/test_check_plugin_request_timeouts.py, line 28:
<comment>The passing fixture is never scanned: the checker reads `plugins` under `cwd=os.getcwd()`, not the temporary directory where `plugin_file` is written. Run the checker against an isolated temporary `plugins` directory so this test verifies the fixture.</comment>
<file context>
@@ -0,0 +1,97 @@
+ ["python", "scripts/check_plugin_request_timeouts.py"],
+ capture_output=True,
+ text=True,
+ cwd=os.getcwd()
+ )
+
</file context>
| kw.arg == "timeout" for kw in node.keywords | ||
| ) | ||
|
|
There was a problem hiding this comment.
P2: This treats timeout=None as compliant, although Requests waits forever for that value. Reject a literal None so the checker cannot certify an unbounded request.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At scripts/check_plugin_request_timeouts.py, line 32:
<comment>This treats `timeout=None` as compliant, although Requests waits forever for that value. Reject a literal `None` so the checker cannot certify an unbounded request.</comment>
<file context>
@@ -0,0 +1,96 @@
+ ):
+ # Check if 'timeout' is a keyword argument
+ has_timeout = any(
+ kw.arg == "timeout" for kw in node.keywords
+ )
+
</file context>
| kw.arg == "timeout" for kw in node.keywords | |
| ) | |
| has_timeout = any( | |
| kw.arg == "timeout" | |
| and not (isinstance(kw.value, ast.Constant) and kw.value.value is None) | |
| for kw in node.keywords | |
| ) |
| kw.arg == "timeout" for kw in node.keywords | ||
| ) | ||
|
|
||
| if not has_timeout: |
There was a problem hiding this comment.
P2: A requests call still blocks the event loop when it has a timeout; count async-context calls independently of the missing-timeout check so the event-loop total is accurate.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At scripts/check_plugin_request_timeouts.py, line 35:
<comment>A `requests` call still blocks the event loop when it has a timeout; count async-context calls independently of the missing-timeout check so the event-loop total is accurate.</comment>
<file context>
@@ -0,0 +1,96 @@
+ kw.arg == "timeout" for kw in node.keywords
+ )
+
+ if not has_timeout:
+ REQUESTS_WITHOUT_TIMEOUT += 1
+ # Check if this is inside an async function
</file context>
| if ( | ||
| isinstance(node.func, ast.Attribute) and | ||
| isinstance(node.func.value, ast.Name) and | ||
| node.func.value.id == "requests" |
There was a problem hiding this comment.
P2: This check misses valid imports such as import requests as req; req.get(...) and from requests import get; get(...), allowing those calls to bypass the timeout gate; recognize imported aliases and directly imported functions.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At scripts/check_plugin_request_timeouts.py, line 28:
<comment>This check misses valid imports such as `import requests as req; req.get(...)` and `from requests import get; get(...)`, allowing those calls to bypass the timeout gate; recognize imported aliases and directly imported functions.</comment>
<file context>
@@ -0,0 +1,96 @@
+ if (
+ isinstance(node.func, ast.Attribute) and
+ isinstance(node.func.value, ast.Name) and
+ node.func.value.id == "requests"
+ ):
+ # Check if 'timeout' is a keyword argument
</file context>
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for the quick turnaround on #15112 — a guard that keeps timeouts from regressing is a sensible companion to the actual fixes, and the AST approach (parent-walk to flag requests calls without timeout= inside async def) is the right shape for it. I verified the script locally: run against a synthetic plugins/ tree it correctly counts missing-timeout calls, flags the event-loop ones, and exits 1.
Blocking issues:
-
tests/test_check_plugin_request_timeouts.py — test_check_plugin_request_timeouts_pass never creates a plugins/ directory in its temp dir (the plugin_file it writes is unused) and runs the script with cwd=os.getcwd(), i.e. the repo root, so it scans the real plugins/ tree. main still has ~76 timeout-less calls (e.g. plugins/omi-shopify-app/main.py lines 110-116 and 418), so this test fails as written — it looks like it was never executed. Tests 2 and 3 correctly use cwd=temp_dir with their own plugins/ fixture; please give test 1 the same treatment.
-
scripts/check_plugin_request_timeouts.py is not referenced by any workflow, CI job, or pre-commit config, so as merged it would never run and wouldn't prevent anything. If the intent is a regression ratchet, it needs wiring into CI — and since the checker exits 1 while main still has 76 violations, it has to be sequenced after the fix work, not before.
-
Scope: #15112 asks to bound the 76 unbounded requests calls (the event-loop-blocking OAuth callbacks especially). This PR adds a detector but fixes none of them — #15113 is the fix PR. A detector-only PR is still useful, but the description should say what it is rather than 'Addresses the bounty'.
Minor notes on the script: REQUEST_TIMEOUT_PATTERN, is_async_function, and the os import are dead code; and the matcher only catches literal requests.<method>(...) — import requests as req, from requests import get, and session-object calls (s.get(...)) slip through. Fine for a first pass if documented, worth tightening later.
Happy to help scope the CI wiring. Whether this qualifies for the bounty on its own and how it should be sequenced with #15113 is a maintainer call — leaving that decision to them.
This review was produced by an AI reviewer operating on David's behalf as part of Omi's automated maintainer tooling. Human maintainer sign-off required before merge.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
|
Closing this PR — it was opened by an autonomous agent and a quality review found an issue with the content: PLACEHOLDER LEAK: "" found in committed code. Apologies for the noise. No action needed from maintainers. The agent's quality gates have been tightened to prevent this from recurring. |
|
Hey @monopolymummat-cmyk 👋 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! |
Summary
Addresses the bounty.
Disclosed: authored with AI assistance (Z.ai).