Repository navigation
fix(security-worker): don't fail shards on recovered claim errors - #4803
Conversation
A transient claim error that succeeded on retry still incremented totalFailed, and any totalFailed > 0 sets exit code 1. Since the Convex claim "Server Error" bursts began on 2026-11-15, nearly every Security Scan Codex Worker run was marked failed even though its scans completed. Count a claim failure toward totalFailed only when it stops claiming (retries exhausted or a non-transient error). totalClaimFailures still records every failed call for claim-health reporting.
|
🦞👀 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.
|
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
Codex review: needs maintainer review before merge. What this changesThis PR counts only terminal claim errors as worker failures while preserving every failed claim in health counters. Example: Two scans complete successfully after two transient claim errors recover.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review Keep this maintainer-authored PR open: main still falsely fails workers after recovered claim errors, and the focused patch introduces no identified correctness findings. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe GitHub Actions security worker claims and hydrates Convex scan jobs, processes leased work, and produces health summaries and a process exit status. flowchart TD
A[GitHub Actions] --> B[Bun worker entry point]
B --> C[Refilled worker pool]
C --> D[Convex claim API]
D --> C
C --> E[Process leased scans]
E --> F[Health counters]
C --> F
F --> G[Summary and exit status]
Technical reviewBest possible solution: Keep failure classification in the existing worker pool, retaining raw claim telemetry and terminal scan failures. Do we have a high-confidence way to reproduce the issue? Yes by source inspection: a transient rejected claim increments main's failure counter, a successful retry does not clear it, and the entry point consequently selects exit code 1; no target code was executed. Is this the best way to solve the issue? Best-fix verdict: best. Correcting classification in the pool preserves its single owner; filtering claim errors at the final exit check would lose the distinction between recovered and terminal claims, while changing retries would address a different problem. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a83aceea4249. Provenance checked
TestingProof path: unit tests only. 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 16, 2026, 12:37 AM ET / 05:37 UTC. |
Summary
Since about 18:14 UTC on 2026-11-15, Production Security Scan Codex Worker shards get bursts of
[Request ID: …] Server Errorfrom Convex when they claim jobs. The worker already retries these. But every failed claim also added 1 tototalFailed, even when the next retry succeeded, and anytotalFailed > 0sets exit code 1. So nearly every run was markedfailureeven though its scans completed. Inworker-summary,totalFailed == totalClaimFailuresandtotalRetryableFailed == 0.This PR counts a claim failure toward
totalFailedonly when it stops claiming: retries are exhausted, or the error isn't transient.totalClaimFailuresstill counts every failed call, so claim health stays visible in the summary.specs/security-moderation.mdnow records this rule.This doesn't fix the underlying Convex Server Errors. That root cause is being investigated separately.
Tests
VITE_CONVEX_URL=https://example.invalid bunx vitest run scripts/security/run-codex-scan-worker.test.ts scripts/security/security-scan-worker-summary.test.ts scripts/security/run-codex-scan-worker-clawscan.test.ts: 128 passed. Claim-retry tests now asserttotalFailed: a recovered error gives 0, exhausted retries give 1, and a claim window that closes during backoff gives 0.bun run ci:static: passed.