Repository navigation
fix: default plugin intelligence report exceeds its daily-row scan budget - #4946
Conversation
The default plugin report scans 30 days of daily facts for both sources. Production passed the 200-page, 100,000-row budget, so every default report failed. Count rows instead of pages, read 4,000-row pages, and raise the budget to 400,000 rows, which the 64 MB action can still hold.
…medy A scan that exceeds the row budget reads the same rows on every retry. Record report_scan_budget_exceeded, skip the two pointless retries, and have Management say that a single source narrows the selection instead of offering a refresh that cannot succeed.
…report memory Rows alone do not bound memory: each daily row may introduce a new query, and production already holds up to 86,000 distinct plugin queries in the 30-day window. Keep numeric counters per query (210 bytes measured, down from about 440 for a full row), build full rows only for the returned shortlist, and fail explicitly past 120,000 distinct queries.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Real-browser proof from a local ClawHub (local Convex backend, dev-auth admin persona, After (this PR): the default view completes on the first attempt After, pushed past the query budget (240,800 rows, 120,400 queries): one attempt, then the remedy Before (main at 11f9359), same fixture: three attempts, then the generic failure |
|
Codex review: needs maintainer review before merge. What this changesThis PR increases report scan capacity, reduces retained query memory, and gives over-budget reports a terminal outcome with source-filter guidance. Example: Staff opens the default Plugins report with 173,400 daily rows across both sources.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: current main still has the demonstrated default-report failure, and this maintainer-authored PR provides a focused repair. No blocking findings. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherStaff dashboard requests enter the saved-report Workpool; its evidence collector reads paginated daily aggregates through the shared report reader and returns ranked counts and current catalog associations. flowchart TD
A[Staff dashboard] --> B[Saved report owner]
B --> C[Workpool job]
C --> D[Shared report reader]
E[Daily search aggregates] --> D
D --> F[Ranked report evidence]
F --> A
Technical reviewBest possible solution: Land the bounded repair in the existing shared reader and retain the documented per-query rollup as the future capacity path. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically rejects a window needing more than 200 pages of 500 rows, and the supplied baseline browser capture shows the reported failure with the large fixture; no target code was executed during this review. Is this the best way to solve the issue? This is an acceptable immediate capacity repair at the shared owner: larger bounded pages and compact counters preserve complete results, while deterministic budget failures stop retrying; changing only dashboard retries would leave the cause intact, and introducing a rollup now would require a broader storage change. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 11f935929080. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 23, 2026, 10:14 PM ET / November 24, 2026, 03:14 UTC. |






Summary
The staff ClawHub intelligence page fails on its default view (Plugins, both sources) with "The report could not be completed. Refresh to retry." Refreshing cannot help: the report reads 30 days of daily search facts in 500-row pages and stops at 200 pages, and plugin demand across both sources is now about 173,000 rows. Each of the three Workpool attempts reads the same 100,000 rows and fails the same way.
What changed
report_scan_budget_exceededinstead of retrying twice under the genericreport_collection_failed.specs/search-insights.mdrecords both budgets, the measurements behind them, and the point at which a per-query rollup should replace reading daily facts.Output is unchanged: same rows, ranking, tie order, totals and truncation. The synchronous
GET /api/v1/search-insightsand the weekly digest share this reader and get the same budgets.Evidence
Production, 2026-11-23 UTC, before this change:
failed,report_collection_failed, 3 attempts; logs showlistDailyInternalcalled exactly 600 times (3 x 200 pages).Local, real Convex backend and real browser, fixture of 173,400 plugin daily rows and 86,700 distinct queries:
11f93592908)report_scan_budget_exceededScreenshots are in the first comment.
Tests
convex/searchInsights.test.ts: a 173,000-row combined-source window reads completely (fails on main with "Search aggregate scan budget exceeded"); the row budget and the query budget each stop on the first page past the limit; a window at both budgets reads.convex/searchReports.test.ts: an over-budget scan through the real report owner, evidence collector and reader throws a non-retryable error, recordsreport_scan_budget_exceededonce, and leaks no query text. The database boundary is simulated there because the budget is far larger than a fixture.src/routes/-management/SearchInsightsPage.test.tsx: the failure code selects the remedy message.Commands run on this head:
bun run ci:unitlocally: 10,514 passed, 13 failed, all in fivescripts/security/*files that timed out while the browser proof ran alongside; those five files pass in isolation on this head (164 tests). Autoreview (Codex, P3) reported one P2 on the first head, that rows did not bound memory; the third commit addresses it and the re-review is clean.Limits