Skip to content

fix(work-items): read the list-items frontier over REST in a GraphQL-refusing session - #12262

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-12224-41385217251-1
Nov 2, 2026
Merged

melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-12224-41385217251-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #12224

Summary

Opened by the work-resolve-issue lane. The run's own summary:

In a session whose GitHub proxy refuses GraphQL (CLAUDE_CODE_REMOTE=true), the GitHub adapter's list-items now reads the REST issues endpoint instead of exiting 3. It pages at 100, drops pull requests, sends --label as the labels parameter, and reads /issues /{n}/dependencies/blocked_by only for an issue whose issue_dependencies_summary.total_blocked_by is non-zero (or missing). The blockers map onto the same blockedBy nodes WIT_ITEM_JQ reads, so blocked_by_count, blocked_by_wont_do_count and truncated match the GraphQL path, and list-frontier, and with it the work-loop cycle, reaches admission. The dispatcher's list-items gate now asks only that gh be present in such a session. Of the issue's two options, I chose the REST path over a clean 'frontier unreadable' exit: the REST docs show both fields the frontier needs, the dependency summary and the blocked_by issue objects with state, state_reason and labels.

Not verified

  • list-items.test.sh and work-item-tracker.test.sh were not executed here: this lane runs only the named wrappers, so the shell test suites are left to the PR's CI
  • The ai-slop detector (detect.sh) in tidy pass 5 could not run in this lane; only the rubric read ran over the changed markdown lines and found no tells. Tidy recorded as skipped for that pass
  • The REST path was not exercised against the live GitHub API from a real cloud session; the endpoint shapes come from the cited REST docs and the stubbed tests
  • The comma-in-label fallback (list unfiltered, core exact-match filters) has no dedicated test

Fix

  • plugins/work-items/tools/work-item-tracker/adapters/github/list-items.sh: REST path when wit_gh_session_refuses_graphql. It pages the issues endpoint, drops PRs, trims rows to the needed fields, reads blockers only where the dependency summary counts any, and emits the same envelope. Accumulators re
  • plugins/work-items/tools/work-item-tracker/work-item-tracker.sh: the github gate for list-items (and so list-frontier) calls check_gh_present in a GraphQL-refusing session and keeps check_gh_version otherwise.
  • plugins/work-items/tools/work-item-tracker/adapters/github/list-items.test.sh: no-GraphQL session tests. They cover a REST-only gh stub (no gh issue list), dropping PRs, blocker counts for no blocker, not_planned, open, completed and a won't-do label, no blocker read for an item with a zero summar
  • plugins/work-items/tools/work-item-tracker/work-item-tracker.test.sh: a remote session's list-frontier now dispatches (exit 0); list-frontier --parent stays gated (exit 3).
  • plugins/work-items/tools/work-item-tracker/adapters/github/README.md: documents the cloud-session list-items REST path under 'List items' and corrects the two passages that listed list-items/list-frontier as unavailable in cloud sessions.
  • .changes/work-items/work-resolve-issue-issue-12224-41385217251-1-c9a4403f.md: patch fragment (Fixed) for work-items.

Verification

The runner ran each check from the base copy against f254972:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

  • read https: //docs.github.com/en/rest/issues /issue-dependencies: GET /repos/{owner}/{repo}/issues /{issue_number}/dependencies/blocked_by returns an array of Issue objects (state, state_reason enum completed|reopened|not_planned|duplicate|null, labels as strings or objects), per_page max 100
  • read https: //docs.github.com/en/rest/issues /issues#list-repository-issues: GET /repos/{owner}/{repo}/issues takes state, labels (comma-separated), per_page (max 100) and page; each issue carries issue_dependencies_summary (blocked_by, total_blocked_by, blocking, total_blocking), type, parent_issue
  • .lane/checks/bin/check-changelog-fragments: all 18 fragments valid (run before tidy, after tidy, and after the review fix)
  • .lane/checks/bin/check-changed-skills: no changed skills, nothing to gate (three runs)
  • .lane/checks/bin/check-affected: 12 passed, 6 skipped, 0 failed over 6 changed files (three runs; the last after the review fix)
  • fresh-context review subagent: found a high-severity bug, since fixed. Accumulated REST rows and blocker maps passed to jq via --argjson would exceed the 128 KiB per-argument limit on a second page, so the script printed an empty frontier with exit 0. It traced the test section by hand and found it
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/41385217251

Left out: the items under Not verified.

Related

#12224

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

claude-security-review reviewed f2549728c7c7fac3c73713150b4dcadb531138df: read 6 of 6 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #12262, no security issues found

I read every hunk in all 6 changed files. None of them is on a trusted path. The change adds a REST fallback to the GitHub adapter's list-items for sessions that refuse GraphQL, and relaxes the dispatcher's gate in those sessions from check_gh_version to check_gh_present.

What I checked:

  • Command and argument injection. --label goes to gh api as a separate argv element (-f "labels=…"). It never reaches a shell string. state is checked against open|closed|all before use. target_repo comes from the existing wit_resolve_repo. The issue number in the blocked_by URL is jq output of the REST .number field, which is an integer. Untrusted issue fields (titles, labels, blocker objects) go to jq on stdin or through --arg/--argjson. They are never put into the jq program text. The only value put into the program text is $WIT_ITEM_JQ, and the GraphQL path already does the same (list-items.sh#L96).
  • What untrusted input reaches the frontier. The REST issues endpoint also returns pull requests, and the new path drops them with select(has("pull_request") | not) (L64), so pull requests from outside authors don't become frontier items. A label containing a comma is sent unfiltered. The core still applies its exact-match wit_filter_label whenever --label is given (work-item-tracker.sh#L328-L329), so the frontier's label narrowing is unchanged. Labels and assignees still flow through WIT_ITEM_JQ, so the downstream provenance and lease checks see the same fields as on the GraphQL path.
  • Failure handling. If a blocked_by read fails, wit_run_gh exits. If jq fails, the script exits with EX_INTERNAL. Neither case prints an empty or under-counted frontier with exit 0.
  • Gate change. Only list-items and list-frontier move from exit 3 to running in remote sessions. list-frontier --parent stays gated, and the test checks that. No token, permission, trusted-actor or merge-hold control is touched.
  • Other surfaces. No plugin manifest, workflow or instruction file is changed, and no standing instruction is deleted or softened.

Prior findings: none (0 rounds, cap 3, not past the cap). The PR context file has no embedded directives to the lane.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

claude-review reviewed f2549728c7c7fac3c73713150b4dcadb531138df: read 6 of 6 changed file(s); 0 finding(s), 0 as inline comments.

Code review: PR #12262, no findings

This PR fixes list-items and list-frontier on the GitHub adapter so they read REST in a session whose proxy refuses GraphQL. I read every hunk of all 6 changed files in .claude-lane/pr.diff. I also checked the code the change relies on: common.sh (WIT_ITEM_JQ, wit_run_gh, wit_gh_load_wont_do_labels, wit_gh_annotate_blocker_reasons), the dispatcher's gate and its label filter in work-item-tracker.sh, and capabilities.json.

Correctness: what I traced

  • Paging. The loop fetches another page while the last page was full (100 rows) and the non-PR rows number at most limit. Trimming to limit + 1 then makes truncated exact, the same way the gh issue list --limit N+1 path does. Dropping pull requests before counting keeps the ceiling counting issues only.
  • Accumulators. They reach jq on stdin. printf is a bash builtin, so the per-argument execve limit that broke the earlier --argjson version no longer applies. A failed jq exits EX_INTERNAL instead of printing an empty frontier.
  • When a blocker read is made. (.issue_dependencies_summary.total_blocked_by // 1) > 0 is right: jq's // treats only null and false as missing, so a count of 0 skips the read and a missing summary forces one. It uses total_blocked_by, not open-only blocked_by, which is needed so blockers closed as not planned or duplicate still count.
  • Mapping blocker nodes. A blocker's REST state and state_reason are upper-cased into the CLOSED, NOT_PLANNED and DUPLICATE values WIT_ITEM_JQ checks. Every node gets reasonRead: true. Won't-do labels are matched case-insensitively, accepting labels as plain strings or as objects. This matches the GraphQL path: a closed blocker with a null reason and no listed label resolves. A blocker read that fails exits the verb rather than returning zeros, so it fails closed.
  • Merging --paginate output. .[1:] | add // [] correctly joins the arrays --paginate concatenates. The test feeds deps-5.json two arrays to cover this.
  • Labels containing a comma. These list unfiltered, and the dispatcher's exact-match wit_filter_label applies to both list-items and list-frontier (work-item-tracker.sh#L326-L330), so the comment's claim holds.
  • Dispatcher gate. It asks only that gh be present in a refusing session. list-frontier --parent still goes to list-sub-items and stays gated (exit 3), and the updated dispatcher test checks this.

Closing issue #12224

  • "list-items has a REST path used when wit_require_graphql_session would refuse, returning the same fields the frontier read needs": met. The new tests in list-items.test.sh would fail if the per-item blocked_by_count/blocked_by_wont_do_count, the field mapping or truncated broke.
  • "A test covers the no-GraphQL session": met (list-items.test.sh, REST-session block).
  • "A .changes/ fragment for work-items": met (bump: patch, Fixed). Patch is the right level for a fix.

Notes (not counted as findings)

  • Request volume. In a cloud session, list-frontier now makes one sequential blocked_by REST call for each listed issue that has any blocker, up to list_items_max (1000). The GraphQL path batches these. This spends REST rate-limit budget per work-loop cycle, but no money.
  • Stale comment. The dispatcher comment at work-item-tracker.sh#L162-L163 still says "list-items stays gated". That is now only true outside a refusing session.
  • Author-claimed, not run by me. The PR's checks (check-changelog-fragments, check-changed-skills, check-affected) are the author's claims. I had no shell and did not run the test suites. The PR itself says the REST path was not exercised against the live API.

Other checks

  • No plugin manifest changed, so the manifest checks don't apply.
  • No .claude/rules/ path glob matches a changed file.
  • No changed file matches a trusted-path glob.
  • No embedded instructions in the PR context. Prior findings: none (0 rounds, cap 3, not past it).

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head f2549728c7c7fac3c73713150b4dcadb531138df.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit 7534418 Nov 2, 2026
43 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-12224-41385217251-1 branch November 2, 2026 04:31
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 75344183a6830b941a39d5ee8331e59a2ac6b201; later checks count it verified from this comment.

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.

fix(work-items): read the work-loop frontier without GraphQL so a cloud session reaches admission

0 participants