Skip to content

improve: reduce dashboard GitHub API reads - #382

Merged
steipete merged 3 commits into
openclaw:mainfrom
brokemac79:codex/dashboard-status-cache
Jul 4, 2026
Merged

steipete merged 3 commits into
openclaw:mainfrom
brokemac79:codex/dashboard-status-cache

Conversation

@brokemac79

@brokemac79 brokemac79 commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resolves an operational problem where the ClawSweeper live dashboard spends extra GitHub API budget while building a status snapshot. Duplicate or per-item dashboard hydration can add latency and rate-limit pressure when the dashboard reads active workflow runs, live PR CI state, cluster repair metadata, recent closes, and automerge timing.

Why This Change Was Made

This adds a per-status-snapshot GitHub REST reader that memoizes exact API paths and passes it through the dashboard hydration paths that run during one snapshot. Authenticated recent automerge timing now hydrates the small search page with one GraphQL request instead of per-PR REST detail calls, while preserving the existing REST fallback when GraphQL is unavailable.

The current-main rewrite also routes the newer apply-health and cluster-repair marker reads through the same snapshot cache.

User Impact

Operators should see the same dashboard data with fewer redundant GitHub API requests during cache misses. That reduces rate-limit pressure and keeps dashboard status refreshes cheaper without changing the visible dashboard contract.

Evidence

Exact reviewed head: 69162849c609b4c4417302a1928062be7f6d7353

  • node --test test/dashboard-worker.test.ts passed: 53/53.
  • pnpm run check passed: build, lint, 599 unit tests, 595 repair tests, changed/full coverage, and formatting.
  • Full-branch AutoReview found no actionable defects: patch is correct (0.85 confidence).

Live dashboard status proof, redacted: ran the real dashboard/worker.ts status handler locally against live GitHub API with a wrapped fetch that counted GitHub paths. The token came from gh auth token and was not printed. This proves the authenticated recent-automerge path hydrated four live automerge items with one search and one GraphQL request, instead of the previous 2 * item_count REST PR/comment detail shape.

{
  "status": 200,
  "generated_at": "2026-07-04T09:22:32.804Z",
  "automerge_item_numbers": [99099, 99098, 89671, 92667],
  "automerge_samples": 4,
  "recent_automerge_search_requests": 1,
  "recent_automerge_graphql_requests": 1,
  "rest_detail_requests_for_automerge_items": 0,
  "previous_rest_detail_shape_for_same_items": 8,
  "duplicate_exact_rest_paths_observed": [],
  "graphql_operation_counts": {
    "WorkerTargetTitles": 2,
    "RecentAutomerge": 1
  },
  "github_call_count": 76
}

@clawsweeper

clawsweeper Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 4, 2026, 5:37 AM ET / 09:37 UTC.

Summary
The branch adds a cached GitHub REST reader for one dashboard status snapshot, batches recent automerge hydration through GraphQL with REST fallback, updates focused dashboard-worker tests, and adds an unreleased changelog note.

Reproducibility: not applicable. as a performance/operational PR rather than a bug report. Current-main source shows the existing direct reads, and the PR body includes live request-count proof for the changed path.

Review metrics: 3 noteworthy metrics.

  • Changed surface: 3 files changed, +441/-78. The implementation is concentrated in the dashboard worker, its focused tests, and one unreleased changelog line.
  • Focused tests: 2 dashboard-worker tests added. The new coverage exercises the GraphQL automerge batch path and per-snapshot live CI hydration reuse.
  • Live request proof: 4 automerge items: 8 prior REST details reduced to 1 search + 1 GraphQL. The copied live output directly supports the claimed GitHub API read reduction.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Next step before merge

  • No automated repair is needed; maintainers should complete normal review and let required checks gate the exact head.

Security
Cleared: The diff adds no dependencies, workflows, package-resolution changes, token storage, or broader permissions; it reuses existing GitHub REST and GraphQL authentication paths.

Review details

Best possible solution:

Land the narrow dashboard request cache and GraphQL batch hydration after normal maintainer review and required checks, preserving the REST fallback and focused dashboard-worker coverage.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a performance/operational PR rather than a bug report. Current-main source shows the existing direct reads, and the PR body includes live request-count proof for the changed path.

Is this the best way to solve the issue?

Yes. The implementation is a narrow maintainable path: reuse one exact-path REST reader per snapshot and batch recent automerge detail hydration when authenticated while preserving the REST fallback.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against d3ad07b3efdd.

Label changes

Label justifications:

  • P2: This is a normal-priority dashboard performance improvement with limited blast radius and no outage, security, or data-loss signal.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body includes redacted live output from the real dashboard status handler showing the after-fix request shape and reduced REST detail calls.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes redacted live output from the real dashboard status handler showing the after-fix request shape and reduced REST detail calls.
Evidence reviewed

What I checked:

  • Repository policy read: Full target AGENTS.md was read; its narrow, automation-safe review guidance and release-owned changelog guidance were applied to this review. (AGENTS.md:1, d3ad07b3efdd)
  • Current main still uses direct dashboard GitHub reads: Current main calls githubJson directly from statusSnapshot and recentAutomerge still performs per-item REST pull/comment detail reads; the cache/GraphQL helper symbols are absent on main. (dashboard/worker.ts:1738, d3ad07b3efdd)
  • PR source: per-snapshot cached reader: The PR head creates one cached GitHub JSON reader in statusSnapshot and passes it through the dashboard hydration sections. (dashboard/worker.ts:1730, 69162849c609)
  • PR source: GraphQL automerge batch with fallback: The PR head hydrates recent automerge items through one GraphQL query when authenticated and falls back to the existing REST detail path when GraphQL is unavailable. (dashboard/worker.ts:3527, 69162849c609)
  • Focused PR tests: The PR adds dashboard-worker tests for authenticated GraphQL automerge batching and live PR CI hydration reuse within one status snapshot. (test/dashboard-worker.test.ts:1997, 69162849c609)
  • Real behavior proof: The PR body includes redacted live output from the real dashboard status handler showing four recent automerge items hydrated with one search request, one GraphQL request, zero REST detail requests for those items, and no duplicate exact REST paths. (69162849c609)

Likely related people:

  • vincentkoc: Current-main blame and symbol history show Vincent Koc introduced the dashboard status snapshot/recent automerge API-read paths that this PR optimizes. (role: introduced behavior and dashboard API-pressure area contributor; confidence: high; commits: 1566ad6a0a5b; files: dashboard/worker.ts)
  • brokemac79: Recent current-main history shows brokemac79 added apply-health dashboard telemetry adjacent to the same status snapshot surface. (role: recent adjacent dashboard contributor; confidence: medium; commits: ead7d6461a6c, 5f4af592da57, baf9ddb48ab1; files: dashboard/worker.ts, test/dashboard-worker.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (1 earlier review cycle)
  • reviewed 2026-07-01T13:51:13.706Z sha 5ecff35 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal priority bug or improvement with limited blast radius. labels Jul 1, 2026
@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 1, 2026
@steipete steipete self-assigned this Jul 4, 2026
@steipete
steipete merged commit ebddd6c into openclaw:main Jul 4, 2026
9 checks passed
@steipete

steipete commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Landed in ebddd6c.

The current-main rewrite keeps one exact-path REST cache per status snapshot, includes the newer apply-health and cluster-repair reads, and batches recent automerge hydration through GraphQL with the previous REST path as fallback.

Proof on exact head 69162849c609b4c4417302a1928062be7f6d7353:

  • Dashboard tests passed 53/53; full pnpm run check passed locally (599 unit tests, 595 repair tests, coverage, formatting).
  • Authenticated live status proof hydrated four automerge items with one search + one GraphQL request, zero per-item REST detail calls, and no duplicate REST paths.
  • Full-branch AutoReview found no actionable issues.
  • All required GitHub checks passed; pnpm check completed in 8m36s.

Thank you @brokemac79 for the original implementation and live-proof work.

azaj01 pushed a commit to azaj01/clawsweeper that referenced this pull request Sep 21, 2026
Cache exact GitHub REST reads within one dashboard status snapshot and hydrate recent automerge timing in one authenticated GraphQL batch with a REST fallback.

Co-authored-by: brokemac79 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants