Repository navigation
ci: skip live-provider tests on fork pull requests - #2036
Conversation
Co-authored-by: Hassieb Pakzad <hassiebp@users.noreply.github.com>
Co-authored-by: Hassieb Pakzad <hassiebp@users.noreply.github.com>
|
@claude review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
|
||
| @pytest.mark.asyncio | ||
| async def test_async_nested_openai_chat_stream(): | ||
| from langfuse.openai import AsyncOpenAI |
There was a problem hiding this comment.
The new module imports AsyncOpenAI inside test_async_nested_openai_chat_stream. The repository rule requires imports at the top of the module. Move this import beside the other langfuse imports before merging to satisfy that requirement.
Rule Used: Move imports to the top of the module instead of placing them within functions or methods. (source)
Learned From
langfuse/langfuse-python#1387
Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/live_provider/test_decorators.py
Line: 126
Comment:
**Import is inside the test**
The new module imports `AsyncOpenAI` inside `test_async_nested_openai_chat_stream`. The repository rule requires imports at the top of the module. Move this import beside the other `langfuse` imports before merging to satisfy that requirement.
**Rule Used:** Move imports to the top of the module instead of placing them within functions or methods. ([source](https://app.greptile.com/personal-org-4986/-/custom-context?memory=c960fc07-9928-409f-a18b-a780cbdded12))
**Learned From**
[langfuse/langfuse-python#1387](https://github.com/langfuse/langfuse-python/pull/1387)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
What does this PR do?
Fork PRs turn CI red even when the change is fine. GitHub does not expose repository secrets to pull requests from forks, so every test that calls OpenAI fails with an authentication error. On #2030, for example, "E2E shard 2" failed 2 tests and "E2E live-provider" failed 35, all because the OpenAI key was missing.
This PR keeps provider secrets away from fork code and makes those PRs green on everything that can actually run:
live_providermatrix entry skips the Langfuse server startup and the test run when the PR comes from a fork, and posts a notice explaining why. Same-repo PRs, pushes tomain, tags and manual dispatches are unchanged. They still run the full suite, so a missing key there still fails loudly.test_decorators_langchainandtest_async_nested_openai_chat_streammove fromtests/e2e/test_decorators.pyintotests/live_provider/test_decorators.py. They make real OpenAI calls, so they belong in the live suite, not in the e2e shards that fork PRs still run. The code moves unchanged, along with the helpers it uses.AGENTS.mdandCONTRIBUTING.mdnow describe the fork skip and the rule that provider-calling tests live intests/live_provider.The trade-off: if a fork PR breaks provider-facing behavior, the live suite catches it on
mainafter merge rather than on the PR. The longer-term fix is replaying recorded provider responses, so contributors get that coverage without keys.Type of change
Verification
This PR is same-repo, so its own CI run should still run the live-provider suite in full. The fork-skip branch only runs on a fork PR, so it is checked by expression review rather than an actual run.
Checklist
code_review.md..env.templateif needed.The fork skip and test move appear sound, but the import must be moved to satisfy the repository rule before merging.
Summary
This PR skips live-provider setup and tests on fork pull requests while keeping the e2e shards enabled.
Acknowledged trade-off: hassiebp states that provider-facing regressions from forks will be caught on
mainafter merge; recorded responses are deferred.Reviews (1) · Last reviewed commit: "ci: skip live-provider tests on fork pul..." · Reviewed by Greptile