agent-orchestrator/docs
Deepak Veluvolu 852f1f93c8
fix: added GraphQL batch PRfeat: add GraphQL batch PR enrichment for orchestrator polling enrichment for orchestrator polling (fixes #608) (#637)
## Approach

  The orchestrator polling loop previously made individual API calls for each PR's
  state, CI status, and review decision - 3 separate calls per PR per poll.
  With multiple PRs being monitored, this quickly exhausted GitHub's 5,000-point
  hourly rate limit.

  This PR implements GraphQL batching using aliases, which allows fetching data
  for up to 25 PRs in a single GraphQL query. Additionally, a 2-Guard ETag
  strategy is used to skip queries entirely when nothing has changed.

  ## Implementation

  ### GraphQL Batching
  - `generateBatchQuery()` creates a single GraphQL query with unique aliases (pr0, pr1, pr2...)
  - Each PR gets the same set of fields: state, CI status, review decision, mergeability
  - Uses inline fragments for union types (CheckRun/StatusContext)
  - Variable types: String! for owner/repo, Int! for PR numbers

  ### 2-Guard ETag Strategy
  Before running expensive GraphQL queries, two lightweight REST ETag checks detect if
  anything changed:

  **Guard 1 (PR List ETag):**
  - Checks `/repos/{owner}/{repo}/pulls` with If-None-Match header
  - Returns 304 if no changes → skips GraphQL (0 points)
  - Detects: New commits, title/body edits, labels, reviews, state changes

  **Guard 2 (Commit Status ETag):**
  - Checks `/repos/{owner}/{repo}/commits/{sha}/status` per cached PR
  - Returns 304 if no changes → skips GraphQL (0 points)
  - Detects: CI status transitions (failing → passing, passing → failing, etc.)

  ### Caching
  - LRU caches for PR metadata (max 200 entries), ETags (100/500 entries)
  - Cache misses trigger individual API fallback via lifecycle-manager
  - No placeholder caching on errors - allows proper fallback behavior

  ## Impact

  - **API reduction:** ~88% fewer REST calls (216 vs 1,800 calls/hour for 5 PRs)
  - **GraphQL efficiency:** Batch query fetches 25 PRs for ~40 points vs ~400 for individual calls
  - **Polling interval:** Still 30s, but most polls return cached data (0 cost)
  - **Fallback:** Individual SCM calls still work for edge cases (permissions, cache misses)

  ## Testing

  - Unit tests for query generation and parsing helpers
  - Integration tests for real GraphQL API calls (skipped by default)
  - Covers batch failures, partial success, empty arrays, edge cases
2026-03-30 00:31:04 +05:30
..
assets Add Composio banner to README 2026-03-03 22:43:23 +05:30
design fix: added GraphQL batch PRfeat: add GraphQL batch PR enrichment for orchestrator polling enrichment for orchestrator polling (fixes #608) (#637) 2026-03-30 00:31:04 +05:30
specs fix(web): runtime terminal port resolution + project-id hardening 2026-03-28 19:23:15 +05:30
CLI.md docs: move CLI reference out of README, focus on user experience 2026-03-19 07:23:32 +05:30
DEVELOPMENT.md docs: add CONTRIBUTING.md, expand development guide, fix broken CLAUDE.md links (#448) 2026-03-12 22:32:33 +05:30
SECURITY-AUDIT-SUMMARY.md fix: migrate to hash-based project isolation architecture 2026-02-18 00:19:55 +05:30
design-cli-redesign-analysis.html Update design doc: spawn no longer accepts project arg 2026-03-17 14:34:11 +05:30
design-npm-global-install-fixes.html docs: sync install-flow design doc with current start/preflight behavior 2026-03-26 16:05:59 +05:30
design-onboarding-improvements.html Expand design doc section on ao-web npm publishing 2026-03-14 19:04:57 +05:30
observability.md feat: add end-to-end observability across core, web, and terminal (#436) 2026-03-12 16:57:40 +05:30
openclaw-plugin-setup.md fix: address CodeRabbit review comments 2026-03-26 21:58:19 +05:30
opencode-workflows-spec.md feat: OpenCode session lifecycle and CLI controls (#315) 2026-03-08 09:55:44 +05:30