You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(gh): resolve infinite pagination loop and unhandled timeout in _build_paginated_url and run_gh #228
priority/p1-highPriority P1: high-impact work for the next planned milestonescope/cliCore CLI framework, Typer subcommands, options, and tablestype/bugType bug: the code does not do what it must
When run_gh processes paginated API requests (such as devops gh project sync fetching repository issues via repos/{repo}/issues?state=all&per_page=100), _build_paginated_url checks if "page=" in endpoint:. Because "per_page=100" contains "page=", it executes re.sub(r"([?&])page=\d+", rf"\g<1>page={page}", endpoint).
However, r"([?&])page=\d+" does NOT match per_page=100 (the preceding character is _, not ? or &). As a result:
_build_paginated_url returns the original endpoint unchanged without appending &page=1 or &page=2.
Every pagination iteration repeatedly fetches page 1.
len(data) < per_page is never satisfied, trapping execution in an infinite pagination loop that burns hundreds of API requests over hours until a subprocess timeout or rate limit exhaustion occurs.
run_subprocess does not catch subprocess.TimeoutExpired when check=False, allowing the timeout exception to escape unhandled.
Root Cause
In src/devops_cli/github/rate_limiter.py:826, if "page=" in endpoint: falsely triggers on per_page=.
_run_gh_paginated lacks a safety cap on maximum pages (MAX_PAGINATED_PAGES).
run_subprocess does not trap subprocess.TimeoutExpired when check=False to return a CompletedProcess(returncode=124).
Remediation Plan
Update _build_paginated_url in src/devops_cli/github/rate_limiter.py to use re.search(r"([?&])page=\d+", endpoint).
Introduce a maximum page boundary (CONST_MAX_PAGINATION_PAGES = 500 or similar) in _run_gh_paginated.
Update run_subprocess in src/devops_cli/core/process.py to catch subprocess.TimeoutExpired when check=False and record telemetry.
Add unit tests for _build_paginated_url with per_page query parameters and timeout containment.
priority/p1-highPriority P1: high-impact work for the next planned milestonescope/cliCore CLI framework, Typer subcommands, options, and tablestype/bugType bug: the code does not do what it must
Activity