Skip to content

fix(api): retry files whose classification failed - #1341

Merged
Zach Dunn (zachdunn) merged 1 commit into
mainfrom
cursor/retry-failed-classifier-7cce
Oct 29, 2026
Merged

Zach Dunn (zachdunn) merged 1 commit into
mainfrom
cursor/retry-failed-classifier-7cce

Conversation

@zachdunn

Copy link
Copy Markdown
Member

In plain terms

A provider timeout stores ai.classifier=failed and does not hold the file. Those rows stay failed forever, which is what Zach Dunn (@zachdunn) reported. The daily API cron now retries them. A retry that gets a decision follows the normal classification path, including a hold when the classifier says the file should be held.

What it does / what it is not

  • The 06:00 UTC cron classifies the oldest failed files, at most 25 per run.
  • A successful retry stores labels the same way an upload does, and places a hold when the decision calls for one.
  • A retry that fails stays failed. Its timestamp moves back so the next run can reach other files.
  • A missing object, a deleted workspace, or classification that is turned off stays failed and moves back the same way.
  • This does not change the fail-open upload path. A timeout still does not fail the upload, and it still does not hold the file at upload time.
  • There is no backoff counter and no new hold rule.

How to try it

No CLI change. After this deploys, the existing daily cron logs classifier_retry_sweep with how many files it scanned, tried, and resolved.

Technical notes

The sweep calls classifyAndStore with holds enforced. Holds stay D1 rows (ai.hold, blob_hold, and read_gate). The run reads up to 100 failed rows so a dead row cannot occupy the 25-call cap.

Test plan

  • pnpm --filter @uploads/api exec vitest run src/classifier-retry-sweep.test.ts test/index-scheduled.test.ts (9 tests: hold on retry, the cap, ineligible rows, a provider error, the daily cron, and the Monday cron leaving the row failed)
  • oxlint on the changed API files, and tsc --noEmit for @uploads/api
  • Confirm classifier_retry_sweep in the API worker logs after the 06:00 UTC cron

Closes #1339

Open in Web Open in Cursor 

A provider timeout stores ai.classifier=failed and does not hold the file.
The daily cron now retries those rows, oldest first, at most 25 per run.
A decision that should hold the file goes through the normal hold path.

Co-authored-by: Zach Dunn <zachdunn@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Oct 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one): 2
  • coderabbit:review
  • review
🚫 Excluded labels (none allowed): 1
  • wip

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 999d5810-7bbb-431a-8dcb-366b887b4a2d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@changeset-bot

changeset-bot Bot commented Oct 29, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: b4417de

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@zachdunn
Zach Dunn (zachdunn) merged commit 1494aa0 into main Oct 29, 2026
4 checks passed
@zachdunn
Zach Dunn (zachdunn) deleted the cursor/retry-failed-classifier-7cce branch October 29, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Files whose classification failed are never re-checked

2 participants