Skip to content

dev-lead fix-reviews reads reviewThreads(first:50) with no pagination — open threads past the first 50 are invisible, so the pass does nothing #2056

Closed

Description

@don-petry

Summary

scripts/dev-lead-fix-reviews.sh reads a PR's review threads with reviewThreads(first:50) and no pagination, then filters to unresolved ones. On a PR with more than 50 threads, any open thread beyond the first 50 is invisible to the pass: OPEN_THREADS_JSON comes out empty and dev-lead concludes there is nothing to address.

Evidence — PR #1953 (2026-10-04)

  • The PR has 66 review threads, 65 resolved and 1 open (Codex P1, scripts/canary_report.sh:214, posted 02:13Z).
  • A fix-reviews pass dispatched at 05:21Z (dev-lead-reviews-retry, intent_type=fix-reviews, run 37179647099) logged: "OPEN_THREADS_JSON is empty, so there was nothing to address or reply to", then "No changes to commit", "Addressed 0 threads".
  • The thread is real and unresolved. GraphQL with a larger window returns it: isResolved:false, isOutdated:false, line:214, author chatgpt-codex-connector (Bot).
  • A plain PR comment asking dev-lead to take the thread was skipped as reason=self-comment (it was posted from the owner account), so there is no other route to it.

Resolved threads sort first, so the longer a PR lives, the more likely its newest open thread falls past the window. This is one cause of the "bot review threads never get a reply" pattern in #2046.

Locations

Both call sites use the same query:

  • scripts/dev-lead-fix-reviews.sh (~L2658, the fix-reviews / bot-comment branch)
  • scripts/dev-lead-fix-reviews.sh (~L2870, the human-pr / review-changes branch)

Proposed fix

Paginate reviewThreads with pageInfo { hasNextPage endCursor } until exhausted (the repo already has cursor-pagination helpers elsewhere, e.g. the outdated-thread scrub near L581), or fetch only unresolved threads. Fail closed if a page fetch errors, so a transient failure never looks like "nothing to do".

Acceptance criteria

  • A PR with more than 50 threads, where the only open thread is past the first 50, is seen by fix-reviews.
  • Both call sites share one paginated helper.
  • A failed page fetch is treated as an error, not as an empty list.
  • bats coverage with a fixture of more than 50 threads (page boundary at 50 and 100).

Generated by Claude Code

Activity

  1. don-petry commented on Oct 4, 2026

    @don-petry
    CollaboratorAuthor

    Dev-Lead Implementation Plan

    Issue: #2056 — dev-lead fix-reviews reads reviewThreads(first:50) with no pagination

    Scope

    Replace both unpaginated reviewThreads(first:50) reads in scripts/dev-lead-fix-reviews.sh with one shared cursor-paginated, fail-closed helper.

    Implementation Checklist

    • New scripts/lib/open-review-threads.sh exposing ort_fetch_open_threads <owner/repo> <pr>: paginates reviewThreads(first:N, after:$cursor) with pageInfo{hasNextPage endCursor} until exhausted, emits a JSON array of unresolved threads (same node shape as today). Returns non-zero (no stdout) when any page fetch fails, returns GraphQL errors, lacks the reviewThreads.nodes array, or claims hasNextPage without a cursor.
    • scripts/dev-lead-fix-reviews.sh: source the lib; fix-reviews and human-pr|review-changes call the helper; on failure log ::error:: and exit 1 instead of passing on an empty list.

    Tests to Write

    • tests/dev-lead/unit/test_open_review_threads.bats (cursor-aware gh stub serving a fixture): 51 threads with the only open one at Compliance: unpinned-actions-pr-review.yml #51 (page size 50); 101 threads with the open one at chore: remove frameworks directory #101 (page size 100); boundaries at exactly 50/100; failure on page 2 → non-zero + no output; GraphQL errors → non-zero; missing nodes → non-zero; hasNextPage w/o cursor → non-zero.
    • tests/dev-lead/unit/test_fix_reviews.bats: both call sites use the helper (no reviewThreads(first:50) left); a failed thread fetch makes fix-reviews / review-changes exit non-zero instead of running on an empty list.

    Test Command

    bats tests/dev-lead/unit/test_open_review_threads.bats tests/dev-lead/unit/test_fix_reviews.bats + bash .dev-lead/scripts/dev-lead-lint.sh

  2. don-petry commented on Oct 4, 2026

    @don-petry
    CollaboratorAuthor

    Dev-Lead: Progress (in progress — not yet durable)

    Provisional. Nothing is pushed yet; the automation posts the authoritative
    completion record (with PR number + head SHA) after the push. Treat the notes
    below as intent, not delivered results.

    Plan Execution (intended)

    • New shared helper ort_fetch_open_threads paginates reviewThreads (100/page, pageInfo{hasNextPage endCursor}) and fails closed.
    • Both OPEN_THREADS_JSON call sites (fix-reviews, human-pr|review-changes) now use it; a failed read logs ::error:: and exits 1 before the engine runs.

    Files touched (this workspace, not yet pushed)

    Notes

    • Behaviour change: a thread-fetch failure now aborts the pass (exit 1) where it used to run on [], as the issue asks.
    • Some unrelated bats files (engine fallback/chain, batch fallback, review-one-pr claim/force-re-review, fix-issue escalation) fail locally in this runner environment. The same tests fail on an unmodified checkout.
  3. don-petry commented on Oct 4, 2026

    @don-petry
    CollaboratorAuthor

    Dev-Lead: Implementation Complete — PR #2057

    The implementation for issue #2056 is durable: commits are pushed and a pull request is open. This record is backed by verifiable artifacts you can confirm in one click.

    Review happens on the PR. Acceptance criteria and test results are evidenced by the PR's diff and CI checks — not asserted here. If a later stage fails, this claim is retracted in place.

  4. added 2 commits that reference this issue on Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug reportsdev-leadFor dev-lead agent pickup

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions