Skip to content

fix(github): list default issues via REST so account mismatches surface errors (#16244) - #16294

Open
adityachaudhary99 wants to merge 1 commit into
stablyai:mainfrom
adityachaudhary99:fix/issue-16244
Open

adityachaudhary99 wants to merge 1 commit into
stablyai:mainfrom
adityachaudhary99:fix/issue-16244

Conversation

@adityachaudhary99

Copy link
Copy Markdown
Contributor

Closes #16244

After switching/re-logging-in gh accounts, the Tasks issues panel went silently empty: the Search API answers HTTP 200 with zero items when the active account cannot see the repo, which read as "no issues".

Default (unfiltered) issue listing now uses the REST repo-issues endpoint instead, whose 403/404 flow through the existing classified-error envelope so failures become visible errors rather than an empty panel. Queried search and PR listing untouched.

@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds buildRecentIssueListRequest for cached, paginated REST issue requests. listRecentWorkItems uses this builder for issue listings. New tests verify the endpoint, query parameters, cache argument positions, issue identifier mapping, and classified errors from rejected requests. The updated code still references recentQuery after removing its initialization.

Merge Risk: 🔴 Critical · up to bb995

The current change references an undeclared query while constructing the PR request, creating a build/type-check blocker. Define a valid query before merging.

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the bug, change, rationale, and linked issue, but omits the required template sections and testing details. Complete the required sections, including ELI5, What Changed, Why, Visual Proof with N/A if applicable, Testing, AI Disclosure, Review, Notes, and Checklist.
Linked Issues check ⚠️ Warning The change targets the linked account-mismatch bug, but listRecentWorkItems references undefined recentQuery, preventing the implementation from meeting the objective. Define or remove recentQuery and update the request flow so default issue listing uses the REST endpoint and classified 403/404 errors surface correctly.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary change: using the REST issues endpoint so account mismatch errors surface.
Out of Scope Changes check ✅ Passed The added request builder, list-path change, and focused tests are directly related to the linked issue and stated objectives.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/main/github/client/list/work-item-list-request.ts (1)

103-108: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Reduce this comment to one concise rationale.

Keep the repository-access error rationale. Remove the detailed behavior walk-through.

Proposed change
-// Why REST instead of Search for the default (no-query) listing: the Search
-// API answers HTTP 200 with zero items when the authenticated gh account
-// cannot see the repo, so an account switch or re-login silently empties the
-// Tasks list with nothing to act on (`#16244`). The REST listing fails with a
-// classifiable 403/404 instead, letting the existing error envelope explain
-// the empty state.
+// Why: REST surfaces repository-access errors instead of silently returning an empty list (`#16244`).

As per coding guidelines, comments must be concise, non-obvious, and brief—prefer one line; do not explain obvious behavior or walk through code.

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dff6c024-c052-4447-a714-31760e8c78e6

📥 Commits

Reviewing files that changed from the base of the PR and between 7e76bb3 and bb995a5.

📒 Files selected for processing (3)
  • src/main/github/client/list/list-recent-work-items-rest-issues.test.ts
  • src/main/github/client/list/work-item-list-request.ts
  • src/main/github/client/list/work-item-pages.ts

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

Comment on lines 37 to +38
const issueRequest = issueOwnerRepo
? buildWorkItemListRequest({
kind: 'issue',
ownerRepo: issueOwnerRepo,
limit,
query: recentQuery,
page
})
? buildRecentIssueListRequest({ ownerRepo: issueOwnerRepo, limit, page })

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu

file="src/main/github/client/list/work-item-pages.ts"

printf '%s\n' '--- outline ---'
ast-grep outline "$file" 2>/dev/null || true

printf '%s\n' '--- relevant source ---'
cat -n "$file" | sed -n '1,90p'

printf '%s\n' '--- query/request symbols ---'
rg -n --glob '*.{ts,tsx,js,jsx}' \
  'recentQuery|parseTaskQuery|buildRecentIssueListRequest|buildRecentPullRequestListRequest|prRequest' \
  src/main/github/client src/main | head -200

printf '%s\n' '--- changed-file summary ---'
git diff --stat -- "$file"

Repository: stablyai/orca

Length of output: 8303


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- request builder ---'
cat -n src/main/github/client/list/work-item-list-request.ts | sed -n '1,180p'

printf '%s\n' '--- ParsedTaskQuery definition and parser ---'
rg -n -A100 -B15 \
  'export (type|interface).*ParsedTaskQuery|type ParsedTaskQuery|interface ParsedTaskQuery|function parseTaskQuery|const parseTaskQuery' \
  src shared 2>/dev/null | head -240

printf '%s\n' '--- all declarations and uses of recentQuery ---'
python3 - <<'PY'
from pathlib import Path
needle = "recentQuery"
for p in Path(".").rglob("*"):
    if p.is_file() and any(part in {"node_modules", ".git", "dist", "build"} for part in p.parts):
        continue
    try:
        text = p.read_text()
    except (UnicodeDecodeError, OSError):
        continue
    for n, line in enumerate(text.splitlines(), 1):
        if needle in line:
            print(f"{p}:{n}:{line}")
PY

Repository: stablyai/orca

Length of output: 23131


Restore the PR query initialization.

recentQuery is undeclared, but buildWorkItemListRequest requires it. Define a valid ParsedTaskQuery before building prRequest.

This branch has not been deployed

No deployments
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.

[Bug] Cannot load Github Issues when using multiple account on cli

1 participant