Skip to content

fix: BED-10664 recover GitHub team pagination after gateway failures - #111

Merged
jaredcatkinson merged 1 commit into
mainfrom
fix/BED-10664-recover-team-pagination
Nov 20, 2026
Merged

jaredcatkinson merged 1 commit into
mainfrom
fix/BED-10664-recover-team-pagination

Conversation

@jaredcatkinson

@jaredcatkinson jaredcatkinson commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

GitHub gateway failures previously stopped team pagination for the rest of an organization, leaving teams and dependent relationships uncollected. Reuse adaptive pagination to retry the failed cursor with smaller team pages while preserving emitted teams and independent member overflow pagination.

If recovery is exhausted, log the organization, cursor, final page size, and retained team count, then continue with the next organization. Document the recovery behavior in the README.

Validation: 658 tests passed; Ruff and git diff --check passed. Regression coverage includes first and later page HTTP 502/504 recovery, bounded exhaustion, continuation across organizations, non-gateway errors, and 101-member overflow after recovery.

Summary by CodeRabbit

  • Bug Fixes
    • Organization team collection now retries gateway failures with progressively smaller pages while resuming from the same point.
    • Teams collected before a failure are retained, and member lists can continue beyond the first 100 members.
    • If recovery is unsuccessful, a collection-gap message reports the affected organization and collection progress, and processing continues with the next organization.
  • Documentation
    • Updated the README with details on team pagination recovery.

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Organization team collection now retries gateway failures with smaller GraphQL page sizes while keeping the failed cursor. It retains teams already emitted, logs unrecovered page gaps, and continues collection with the next organization.

Changes

Organization Team Pagination Recovery

Layer / File(s) Summary
Team page recovery and validation
src/openhound_github/resources/organization.py, tests/test_graphql_retry_budget.py, README.md
The team collector uses adaptive pagination and handles exhausted retries by logging the failed cursor, final page size, and emitted team count. Tests cover recovery, exhausted retries, non-gateway failures, and member overflow. The README documents this behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant OrganizationTeams
  participant adaptive_graphql_paginate
  participant GitHubGraphQL
  participant Logger
  OrganizationTeams->>adaptive_graphql_paginate: request organization team pages
  adaptive_graphql_paginate->>GitHubGraphQL: request page at cursor
  GitHubGraphQL-->>adaptive_graphql_paginate: gateway failure
  adaptive_graphql_paginate->>GitHubGraphQL: retry same cursor with smaller page size
  alt Page recovered
    adaptive_graphql_paginate-->>OrganizationTeams: yield teams and continue pagination
  else Retries exhausted
    adaptive_graphql_paginate-->>OrganizationTeams: report failed cursor and page size
    OrganizationTeams->>Logger: log collection gap and emitted team count
  end
Loading

Possibly related PRs

Suggested reviewers: d3vzer0, eladshamir

Merge Risk: Minimal · up to 58a19

Organization team collection now retries gateway failures at smaller page sizes and keeps teams already collected. If recovery is exhausted, it logs the gap and moves to the next organization. No concrete merge-blocking defect was found, and the change is covered by new tests and README documentation.

Security architecture risk: Minimal · up to 58a19

The change adds bounded recovery without expanding credentials, organization access, or the public API. Unrecoverable collection can still leave incomplete relationships, but that behavior predates this PR; the change improves recovery and makes the remaining gap explicit.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The inspected failure path affects remaining team observations and dependent relationships within the failed organization. Retry state and emitted-team accounting are initialized separately for each organization; exhaustion does not prevent collection of the next organization.

Trust Boundaries and Controls

  • observed — The new caller retains organization-specific client selection and the organization login in request variables. GraphQL errors and invalid pagination remain terminal errors rather than recovery successes; only HTTP 502/504 activate smaller-page retries. Regression assertions cover HTTP 401, access-denied responses, and missing cursors without smaller-page retries.

Resilience and Maintainability Implications

  • observed — The newly reused retry budget is scoped to each page and activated only around the request. Its context is reset in a finally block before page emission, preventing that budget from remaining active while downstream member processing runs or after a request exits exceptionally.
Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: GitHub team pagination now recovers from gateway failures. It includes a ticket ID and a conventional commit prefix, and it matches the summary of the organization.py …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: GitHub team pagination now recovers from gateway failures. It includes a ticket ID and a conventional commit prefix, and it matches the summary of the organization.py change, the README update, and the added tests.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the cursor’s place,
Then tries smaller pages at a steady pace.
The teams already found stay near,
A gap is logged when none appear.
The next org waits; the burrow rolls on.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 941c179a-7599-4fc9-9ad7-51942067b48a
Commits

Reviewing files that changed from the base of the PR and between 6c9e2f8 and 58a195a.

Files selected for processing: 3

  • README.md
  • src/openhound_github/resources/organization.py
  • tests/test_graphql_retry_budget.py

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@jaredcatkinson
jaredcatkinson merged commit 8d1de47 into main Nov 20, 2026
3 checks passed
@jaredcatkinson
jaredcatkinson deleted the fix/BED-10664-recover-team-pagination branch November 20, 2026 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants