Skip to content

fix(github-app): page through repository chooser results - #13184

Merged
kodjima33 merged 1 commit into
BasedHardware:mainfrom
goodguypeci-design:fix/github-repo-pagination-13168
Sep 9, 2026
Merged

kodjima33 merged 1 commit into
BasedHardware:mainfrom
goodguypeci-design:fix/github-repo-pagination-13168

Conversation

@goodguypeci-design

@goodguypeci-design goodguypeci-design commented Sep 8, 2026 •

Copy link
Copy Markdown

What changed and why

Fixes #13168.

The GitHub integration cached only the first /user/repos page, so the repository picker could hide repositories for accounts with more than 100 accessible repos. list_user_repos now follows GitHub's next pagination while keeping the same returned repo shape and fail-closed error behavior.

Product invariants affected

none

How it was verified

  • python plugins\omi-github-app\test_github_client.py — 4 tests passed.
  • git diff --check — no whitespace or conflict marker problems.
  • python .github\scripts\pr_preflight.py --lane local --base origin/main --pr-body-file C:\Users\Fantamanbg\Desktop\Bounty-Work\omi-pr-body-13168.md — local PR contract checks passed.

I did not exercise the OAuth setup UI locally because this plugin environment is not configured with a GitHub OAuth app and an account with more than 100 repositories; the production method is covered with request-level fixtures.

Tests

  • plugins/omi-github-app/test_github_client.py::GitHubClientTests.test_list_user_repos_follows_next_page
  • plugins/omi-github-app/test_github_client.py::GitHubClientTests.test_list_user_repos_accepts_empty_complete_page
  • plugins/omi-github-app/test_github_client.py::GitHubClientTests.test_list_user_repos_returns_empty_on_api_error
  • plugins/omi-github-app/test_github_client.py::GitHubClientTests.test_list_user_repos_discards_partial_results_on_later_page_error

Failure class (fixes)

Failure-Class: none

Review in cubic

Failure-Class: none

Verification:

- python plugins\\omi-github-app\\test_github_client.py

- git diff --check

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@Git-on-my-level Git-on-my-level added positive-signal Automation verified a genuine fix/quality contribution python labels Sep 8, 2026
@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks @goodguypeci-design — nice, tightly-scoped fix for #13168.

What I verified:

plugins/omi-github-app/github_client.py — list_user_repos now follows the Link rel=next header ("next" in response.links) with an incrementing page param instead of stopping after the first /user/repos page, while keeping the same repo dict shape and the fail-closed error path (non-200 logs the status and returns []). I checked all three call sites in main.py (the chat tool handler, OAuth setup, and Refresh Repos) — each guards on the empty list, so the pagination change is drop-in compatible.

plugins/omi-github-app/test_github_client.py — good request-level coverage: multi-page follow-through, error-to-empty, empty complete page, and discarding partial results when a later page errors. Mocking github_client.requests keeps the suite hermetic.

Two non-blocking notes for a follow-up, neither required for this fix:

  • requests.get here (like the rest of this client) has no timeout; fine to address repo-wide rather than in this PR.
  • the warning print on page errors only surfaces the status code — if the picker ever looks empty unexpectedly, including the page number would help debugging.

Leaving for human maintainer review before merge.


This is AI-generated feedback posted 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 need human response.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scoped backend/plugin bug fix (GitHub repo-list pagination), tests added, CI clean (pending), not yet fixed on main.

@kodjima33
kodjima33 merged commit f557301 into BasedHardware:main Sep 9, 2026
1 check passed
@goodguypeci-design

Copy link
Copy Markdown
Author

Thanks for merging this. This closes #13168, where I had proposed the US$25 bounty for the fix.

Could you point me to the payout or claim path for that when you have a chance?

ajanraj added a commit to ajanraj/omi that referenced this pull request Sep 12, 2026
Three endpoints now page through `next` links (user repos since
BasedHardware#13184, both label fetchers as of the previous commit) — the
duplicated skeleton is what let two of them ship unpaginated. Extract
_get_paginated so the next list endpoint cannot silently truncate;
callers keep their own transform. Behavior is unchanged: same params,
same discard-partial-results error semantics, pinned by the existing
tests plus a new discard case for the details fetcher.

Tests: 8 tests in test_github_client.py pass.

Failure-Class: none
ajanraj added a commit to ajanraj/omi that referenced this pull request Sep 13, 2026
Three endpoints now page through `next` links (user repos since
BasedHardware#13184, both label fetchers as of the previous commit) — the
duplicated skeleton is what let two of them ship unpaginated. Extract
_get_paginated so the next list endpoint cannot silently truncate;
callers keep their own transform. Behavior is unchanged: same params,
same discard-partial-results error semantics, pinned by the existing
tests plus a new discard case for the details fetcher.

Tests: 8 tests in test_github_client.py pass.

Failure-Class: none
Git-on-my-level pushed a commit that referenced this pull request Sep 14, 2026
* fix(github-app): page through repository labels

Both get_repo_labels and get_repo_labels_with_details fetched a single
page of 100 — on repositories with more labels, AI label selection
silently missed every label past the first page and the list-labels
tool undercounted. Same class as the repository-chooser pagination
fix: follow `next` links, and discard partial results on a later-page
error rather than returning a truncated list.

Tests: regression tests assert both fetchers follow a second page and
that a page-2 failure yields [] instead of partial data. All 7 tests
in test_github_client.py pass (`python test_github_client.py`).

Failure-Class: none

* refactor(github-app): share one pagination loop across list fetchers

Three endpoints now page through `next` links (user repos since
#13184, both label fetchers as of the previous commit) — the
duplicated skeleton is what let two of them ship unpaginated. Extract
_get_paginated so the next list endpoint cannot silently truncate;
callers keep their own transform. Behavior is unchanged: same params,
same discard-partial-results error semantics, pinned by the existing
tests plus a new discard case for the details fetcher.

Tests: 8 tests in test_github_client.py pass.

Failure-Class: none

* fix(github-app): keep item projections inside the pagination error boundary

Review feedback on #13546: the refactor moved per-item mapping out of
the try/except that used to cover it, so a malformed item in a
successful page escaped as KeyError/TypeError instead of returning [] —
breaking the fetchers' fail-closed contract. _get_paginated now takes a
project callable and applies it inside the boundary, so page failures
and malformed items share one owner.

Tests: malformed-item cases for the dict-building projections assert []
instead of a raised KeyError; both raise on the pre-fix code. uv run
--with requests --with python-dotenv --no-project python
test_github_client.py — 10 tests pass.

* ci(github-app): run the client test suite from the check manifest

The suite ran in no CI lane, so the pagination regression it guards
could have shipped silently again. Stub the module-level requests/dotenv
imports during module load the way the sibling plugin suites do — the
tests patch requests.get per case and perform no real I/O — then
register github-app-client-tests in checks-manifest.yaml (local + ci
lanes).

Verified: python3 plugins/omi-github-app/test_github_client.py — 10
tests pass on a stdlib-only interpreter; python3
.github/scripts/run_checks.py --lane ci --check-id
github-app-client-tests --base origin/main -> PASS; --lane local --list
selects it via plugins/omi-github-app/** on this diff.
@goodguypeci-design

Copy link
Copy Markdown
Author

Quick follow-up on the payout path for this merged fix.

This PR closed #13168, where I had proposed the US$25 bounty for the issue. If Omi is not using a formal bounty flow for this, no problem — I just want to close the loop correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

positive-signal Automation verified a genuine fix/quality contribution python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GitHub integration repository chooser stops at the first 100 repositories (bounty proposal)

3 participants