Skip to content

fix(security-worker): don't fail shards on recovered claim errors - #4803

Merged
roboclaw-bot merged 1 commit into
mainfrom
fix/security-worker-recovered-claim-exit
Nov 16, 2026
Merged

roboclaw-bot merged 1 commit into
mainfrom
fix/security-worker-recovered-claim-exit

Conversation

@jesse-merhi

Copy link
Copy Markdown
Member

Summary

Since about 18:14 UTC on 2026-11-15, Production Security Scan Codex Worker shards get bursts of [Request ID: …] Server Error from Convex when they claim jobs. The worker already retries these. But every failed claim also added 1 to totalFailed, even when the next retry succeeded, and any totalFailed > 0 sets exit code 1. So nearly every run was marked failure even though its scans completed. In worker-summary, totalFailed == totalClaimFailures and totalRetryableFailed == 0.

This PR counts a claim failure toward totalFailed only when it stops claiming: retries are exhausted, or the error isn't transient. totalClaimFailures still counts every failed call, so claim health stays visible in the summary. specs/security-moderation.md now 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 assert totalFailed: a recovered error gives 0, exhausted retries give 1, and a claim window that closes during backoff gives 0.
  • bun run ci:static: passed.

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.
Copilot AI balanced review requested due to automatic review settings November 16, 2026 05:24
@clawsweeper

clawsweeper Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@vercel

vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
clawhub Ready Ready Preview Nov 16, 2026 5:26am UTC

Request Review

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 16, 2026
@clawsweeper

clawsweeper Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This 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.

  • Before: totalClaimFailures is 2, totalFailed is 2, and the worker exits with code 1.
  • After: totalClaimFailures remains 2, totalFailed is 0, and the worker exits successfully.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch is focused, source-correct, and supported by passing checks, but mocked scenarios do not establish the changed production-worker behavior.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Operators see failed security-worker runs even when transient claim errors recover and scans complete.
Reason: Accurate worker status has clear operational value, and the maintainer-authored direction preserves visibility into the underlying Convex errors.

Regression provenance

Possible 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
Reviewed head: 6203c8599af31adb4b708481f60028331c7995ac

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Attach redacted worker CLI logs showing a transient Convex claim error, successful retry and scan completion, retained raw claim counts, and exit 0; remove IPs, API keys, and non-public endpoints.
Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

  • Claim failure classification changes intended behavior with a stated reason (8c14d84: The continuously refilled pool counted rejected claims as failures when claims stopped immediately; the later retry repair retained that accounting while allowing recovery.)
  • Bounded claim retries and telemetry keeps the original intent (327c26e: Recover transient claim failures without changing leases, deadlines, job caps, terminal scan outcomes, or raw error visibility.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

Likely related people:

  • Patrick Erichsen: Raw commit 327c26e adds scripts/security/run-codex-scan-worker.ts:2230 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 327c26e45b3e; files: scripts/security/run-codex-scan-worker.ts)
  • Vincent Koc: Raw commit f96ae4a adds scripts/security/run-codex-scan-worker.ts:1267 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: f96ae4a54ec9; files: scripts/security/run-codex-scan-worker.ts)
  • Jesse Merhi: Raw commit 2deb1b7 adds scripts/security/run-codex-scan-worker.ts:1146 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 2deb1b75e997; files: scripts/security/run-codex-scan-worker.ts)

Preflight source

Source 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

Metric Value Why it matters
Patch scope Production +4/-1; tests +17/-4; specification +3/-0 The change reuses existing retry decisions and strengthens existing scenarios without adding machinery.

Labels

Label changes:

  • add P2: False production-worker failures obscure operational health, but the reported scans complete and this patch does not change delivery or scan verdicts.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: False production-worker failures obscure operational health, but the reported scans complete and this patch does not change delivery or scan verdicts.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 16, 2026, 12:37 AM ET / 05:37 UTC.

@roboclaw-bot
roboclaw-bot merged commit 84909d5 into main Nov 16, 2026
81 of 83 checks passed
@roboclaw-bot
roboclaw-bot deleted the fix/security-worker-recovered-claim-exit branch November 16, 2026 23:30

This branch was successfully deployed

1 active deployment
Preview – clawhub — 6203c859 Deployed Nov 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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.

3 participants