Conversation
- Response with 'data: null' did not change pagination state, so the same query was sent again forever. Raise GraphQlQueryError with the query instead. - Page reporting another page without a cursor reset the cursor to 'None', so pagination started again from the first page. Stop pagination of the field with a warning. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
iLLiCiTiT
reviewed
Sep 14, 2026
iLLiCiTiT
reviewed
Sep 14, 2026
iLLiCiTiT
reviewed
Sep 14, 2026
iLLiCiTiT
reviewed
Sep 14, 2026
iLLiCiTiT
reviewed
Sep 14, 2026
iLLiCiTiT
reviewed
Sep 14, 2026
Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
BigRoy
requested review from
iLLiCiTiT
and
a lite review from Copilot
and removed request for
iLLiCiTiT
September 14, 2026 17:39
BigRoy
marked this pull request as ready for review
September 14, 2026 17:39
There was a problem hiding this comment.
🟡 Changes recommended
Resolve the empty-data loop and missing-cursor pagination failure.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This pull request hardens GraphQL query handling against unexpected responses that could cause infinite request or pagination loops.
Changes:
- Centralizes query execution and validates response data.
- Updates pagination handling for missing cursors.
- Adds regression tests for malformed responses.
File summaries
| File | Summary | Final review findings |
|---|---|---|
tests/test_graphql_infinite_loop.py |
Adds regression coverage for malformed responses and pagination termination. | None. |
ayon_api/graphql.py |
Implements shared response handling and pagination safeguards. | Critical (3 votes, line 365): Empty data mappings can still loop; reject them as invalid. Moderate (3 votes, line 948): Missing-cursor pagination raises instead of stopping with a warning while preserving parsed output. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| raise GraphQlQueryFailed(response.errors, query_str, variables) | ||
|
|
||
| data = response.data.get("data") | ||
| if data is None: |
BigRoy
commented
Sep 14, 2026
BigRoy
commented
Sep 14, 2026
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.
Bug
Two unexpected (but valid-JSON) GraphQl responses make
GraphQlQuery.query()/continuous_query()loop forever, sending the same request to the server again and again:dataisnull(or missing).hasNextPage: truewithout anendCursor(e.g. an empty page).Neither is produced by a healthy server in normal use, but when it happens the client hangs (and hammers the server) instead of failing with an error that can be debugged.
Cause
parse_result(None, ...)returns immediately, so no field changes itsneed_querystate and thewhile self.need_queryloop repeats the identical query.None, which means "start from the beginning", so pagination restarted from the first page. (On the very first page it instead raised the misleading "Cursor didn't change" error.)Fix
_query_datahelper (it was copy-pasted three times). It raisesGraphQlQueryErrorincluding the response, query and variables whendatais missing.Reproduce
Not reproducible against a healthy server.
tests/test_graphql_infinite_loop.pyuses a scripted fake connection returning these responses; on develop the fake connection raises "Infinite query loop" after 10 identical requests.Testing notes
pytest tests/test_graphql_infinite_loop.py.get_folders,get_versions,get_eventsreturn the same results as before.🤖 Generated with Claude Code