fix: bound native scan claim queue reads - #3662
Conversation
|
🦞👀 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. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Codex review: blocked before merge. Reviewed September 10, 2026, 8:51 PM ET / September 11, 2026, 00:51 UTC. ClawSweeper reviewWhat this changesReduce ClawScan worker queue reads to the requested claim capacity, expanding pagination only when blocked legacy jobs require it, with regression tests and a documented invariant. Merge readiness⛔ Blocked before merge - 3 items remain Keep open: current main still overfetches native queue rows, and this focused patch has no blocking findings. The author explicitly requests retaining draft status during the production investigation. Priority: P2 Review scores
Verification
How this fits togetherClawScan workers request queued security scans from Convex. The claim handler selects eligible jobs in priority order and issues leases before workers retrieve artifacts and run scans. flowchart TD
A[Worker requests capacity] --> B[Authenticate worker]
B --> C[Read ready queue by source]
C --> D{Job allowed by rollout?}
D -->|No| E[Expand next page]
E --> C
D -->|Yes| F[Validate job and catalog admission]
F --> G[Issue scan leases]
Decision needed
Why: The author explicitly requested a draft hold; source review cannot override that investigation boundary. Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain capacity-sized native pagination and the existing legacy/catalog exceptions, with production contention treated as a separate diagnostic question. Do we have a high-confidence way to reproduce the issue? Yes: current main requests 512 queue rows for a one-job native claim with GitHub rollout disabled; the supplied local experiment reports corresponding read-budget failures. This review verified the source path without running tests or backend code. Is this the best way to solve the issue? Yes, for native queue overfetch: changing page size in the shared claim helper preserves existing callers and eligibility rules. Raising transaction budgets would retain unnecessary reads, while changing indexes or rollout policy would broaden the fix without supporting evidence. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 385669695b1a. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Found 2 test failures on Blacksmith runners: Failures
|
Native ClawScan workers requesting one job currently fetch up to 512 ready queue rows when generic GitHub rollout is disabled. Start each source page at the worker's remaining capacity, expanding to the existing bounded window only after encountering blocked legacy GitHub jobs. Preserve priority ordering, rollout restrictions, catalog admission and lease behavior.
Before/after proof on a disposable local Convex backend (
http://127.0.0.1:3318) with 600 queued native bulk-rescan jobs:The existing 513-blocked-GitHub-job fallback still reaches the allowed NVIDIA job in at most three source pages. All 116 security-scan tests pass. Temporary seed/proof functions were deployed only locally, excluded from this PR, and the disposable backend was stopped.
This is a read-efficiency fix, not a demonstrated scanner throughput fix. Local burst tests with 128 one-job requests at concurrency 16 and 32 still encountered heavy OCC contention before and after; there was no consistent throughput improvement. Production workers remain at concurrency four. Production claim errors are sanitized and backend diagnostics require a Convex login, so the production root cause remains unverified. Keep this draft while that investigation continues; no deployment or capacity increase is part of this PR.
Validation:
bunx vitest run convex/securityScan.test.ts— 116 passed; new regression cases fail on the original code.bun run ci:unit— 6,613 passed, 3 skipped; coverage gate passed.bun run ci:static— passed.bun run ci:types-build— passed.bunx tsc -p convex/tsconfig.json --noEmit— passed.