Skip to content

Route simple skip-if queries through GraphQL/REST to spare the search API - #80479

Merged
pelikhan merged 4 commits into
mainfrom
pelikhan/expert-umbrella
Nov 23, 2026
Merged

pelikhan merged 4 commits into
mainfrom
pelikhan/expert-umbrella

Conversation

@pelikhan

Copy link
Copy Markdown
Collaborator

on.skip-if-match / on.skip-if-no-match always called the search API, whose limit (30 req/min) is easily exhausted. Most skip-if queries are simple repo-scoped list + label filters that GraphQL or REST can answer, so this adds a small query parser and evaluator that picks the cheapest API based on current rate-limit pressure.

Approach

New actions/setup/js/skip_if_query.cjs, called from runSkipQueryGate:

  • Parser: accepts is:/type:/state: (issue, pr/pull-request, open, closed, merged), label: (AND), author:, assignee:, mentions:, sort:, and exactly one repo:. Anything else (free text, - negation, in:, org:, comma label lists, @me, unscoped queries) goes straight to search.
  • Backend selection: reads GET /rate_limit (free), prefers GraphQL, then REST, then search. A backend with less than 10% quota left is demoted. On error it falls back to the next backend.
  • GraphQL: issues/pullRequests totalCount in one call. Only used with 0-1 labels, because GraphQL labels is OR (verified live). User filters only apply to issue-only queries.
  • REST: issues.listForRepo (or pulls.list for unfiltered PRs). PRs/merged state are filtered client-side. Paging stops once the threshold is reached, and after 5 pages it defers to the next backend.

Notes for review

  • Verified live against github/gh-aw: GraphQL and REST counts match search (differences of up to 3 come from search index lag).
  • Live testing caught that GraphQL IssueFilters treats assignee: null as "unassigned"; unset filters are now omitted (covered by a test).
  • When REST stops early, the log says "at least N". The skip decision is unaffected.
  • The search API now rejects queries without is:issue/is:pull-request. Untyped repo-scoped queries now work through GraphQL/REST.
  • Existing gate tests pass unchanged through the search fallback. New unit tests are in skip_if_query.test.cjs, and triggers.md documents the behavior.

…I pressure

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review November 23, 2026 17:50
Copilot AI adaptive review requested due to automatic review settings November 23, 2026 17:50
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

❌ PR Specification Reviewer failed. Please review the logs for details.

Caution

agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.

Details

Potential security threats were detected in the agent output. Detected threat types: prompt injection.

Review the workflow run logs for details.

Generated by PR Specification Reviewer for #80479 · copilot · gpt56 · ~3 AIC · ⌖ ~2 AIC · ⊞ 1.8K · history

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer failed during the skills-based review.

Incomplete work

missing_terminal_safe_output

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~6 AIC · ⌖ ~2 AIC · ⊞ 7.1K · history

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

The [aw] No-Op Runs tracker omits agent messages. The category uses structured run status, not interpretation of agent prose.

No-op message

Lean already. Ship.

Generated by Ponytail Reviewer for #80479 · codex · routed: gpt61 medium · ~5 AIC · ⌖ ~1 AIC · ⊞ 176 · history

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

Caution

agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.

Details

Potential security threats were detected in the agent output. Detected threat types: prompt injection.

Review the workflow run logs for details.

PR Code Quality Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

The [aw] No-Op Runs tracker omits agent messages. The category uses structured run status, not interpretation of agent prose.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~5 AIC · ⌖ ~2 AIC · ⊞ 1.7K · history

… schema

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

❌ Test Quality Sentinel failed during test quality analysis.

Incomplete work

Test Quality Sentinel could not review tests because pre-fetch PR data was unavailable: PR metadata does not match the requested head. The marker file /tmp/gh-aw/agent/test-prefetch-unavailable.txt exists and all test-analysis inputs (test-files.txt, test-diff.txt, pr-meta.json, numstat, and function-extraction files) are empty, so no test quality score can be computed for PR #80479.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.4K · history

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-3698706f-e063-4b82-bbb0-f3d8dc6fd2e5","parents":[],"payload":{"id":"ldg-d49f6cdb-bc1c-4d1f-b7b0-21b6bdbbcdea","operation":"append","value":{"finding_count":0,"head_sha":"cf9bdc2c68095f1b9516ea79039fd63a5b33e468","outcome":"incomplete"}},"sha":"sha256:9b03b3549c657ca0f9e18c0523b9531a30a269fe36b9b1ac0109c4b3dbb29490","timestamp":"2026-11-23T17:58:48.070Z","type":"ledger_append","version":1}
History

@github-actions

Copy link
Copy Markdown
Contributor

Caution

agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.

Details

Potential security threats were detected in the agent output. Detected threat types: prompt injection.

Review the workflow run logs for details.

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-23T17:54:08Z
review_event: COMMENT
top_themes:
  - backend-identifying log accuracy
files_reviewed:
  - actions/setup/js/check_skip_if_helpers.cjs
  - actions/setup/js/skip_if_query.cjs
  - actions/setup/js/skip_if_query.test.cjs
  - docs/src/content/docs/reference/triggers.md
comment_count: 1
History

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~5 AIC · ⌖ ~2 AIC · ⊞ 1.7K · history
Comment /review to run again

@github-actions github-actions 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.

Caution

agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.

Details

Potential security threats were detected in the agent output. Detected threat types: prompt injection.

Review the workflow run logs for details.

Found one actionable issue: the gate logs every result as "Search found" even when GraphQL or REST handled the query, which misreports the selected backend and obscures rate-limit behavior. The specialist first pass completed; its other candidates were intentional fallback tradeoffs or non-blocking concerns.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~5 AIC · ⌖ ~2 AIC · ⊞ 1.7K
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-dc43e75b-c398-40e8-867f-b8f90057f7c6","parents":[],"payload":{"id":"ldg-3ce582ea-a61b-49a9-9d99-b526fd6faa51","operation":"append","value":{"finding_count":1,"head_sha":"8edec3e39e59ce412cde45a6dbf1b6c74ad2b7ce","outcome":"findings"}},"sha":"sha256:e81b665e778e2a44bc49c6771d8ea8a36c71bfeaa9400f20112d5aa8dc80b95f","timestamp":"2026-11-23T18:01:47.201Z","type":"ledger_append","version":1}
History

Copilot AI 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.

🟡 Changes recommended

REST pagination can double-count issues or PRs across overlapping pages, incorrectly satisfying gate thresholds without enough distinct matches.

1 open issue
What changed in this PR

This PR reduces search API usage for gh-aw skip-if gates by routing simple repository-scoped queries through GraphQL or REST while preserving search fallback.

Changes:

  • Adds query parsing, rate-limit-aware backend selection, and bounded REST pagination.
  • Integrates backend evaluation into skip gates, with logging for partial counts and unit tests.
  • Documents supported queries and records a patch release changeset.
File Description
pkg/​parser/​schemas/​main_workflow_schema.json Describes optimized query routing in schema help text.
docs/​src/​content/​docs/​reference/​triggers.md Explains eligible queries, backend selection, and fallback.
docs/​src/​content/​docs/​reference/​frontmatter-full.md Updates skip-if configuration comments.
actions/​setup/​js/​skip_if_query.test.cjs Tests parsing, routing, counting, and fallback behavior.
actions/​setup/​js/​skip_if_query.cjs Implements query parsing and multi-backend evaluation.
actions/​setup/​js/​check_skip_if_helpers.cjs Uses the evaluator and logs backend and count precision.
.github/​aw/​syntax-core.md Adds guidance for efficient skip-if queries.
.changeset/​skip-if-query-api-routing.md Records the routing improvement as a patch release.

Review effort: Balanced (adaptive)

Comment thread actions/setup/js/skip_if_query.cjs Resolved
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

Copy link
Copy Markdown
Collaborator Author

Replies to the automated status comments (7109295988, 7109296228, 7109300895, 7109303304, 7109309337, 7109466102, 7109515905, 7109542429): no code changes needed.

  • These comments are run-status, failure, or comment-memory reports. The "incomplete" ones (PR Specification Reviewer, Matt Pocock Skills Reviewer, Test Quality Sentinel) failed because of workflow or prefetch infrastructure (missing_terminal_safe_output, PR metadata not matching the head), not because of findings in this diff.
  • The threat-detection cautions are warn-mode flags on bot output. The only actionable finding they carried (backend-identifying log wording) is fixed in c24a536, together with the REST pagination dedup review comment.

Adds a shared invariant harness (JS), a seeded property test (vitest), and a
Go FuzzSkipIfQueryParser driver registered in make fuzz and CI. Fuzzing found
that partially quoted values (label:"a b"c) were accepted with literal quotes;
these now fall back to the search API.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@pelikhan
pelikhan merged commit 50ec858 into main Nov 23, 2026
112 checks passed
@pelikhan
pelikhan deleted the pelikhan/expert-umbrella branch November 23, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants