Skip to content

chore(registry): prune finished durable jobs and embedding attempts - #691

Merged
harlan-zw merged 1 commit into
mainfrom
chore/prune-finished-jobs
Nov 12, 2026
Merged

harlan-zw merged 1 commit into
mainfrom
chore/prune-finished-jobs

Conversation

@harlan-zw

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

Related to #126 (daily check-in: database capacity incident). Follows #688.

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

nuxt-cf-jobs soft-completes a job, so every hourly sync left up to 250 jobs rows behind, with payloads and retry reasons, forever. Nothing in this site called the package's prune methods.

Measured on 2026-11-12 in production: jobs 146,816 rows, failed_jobs 2,672, job_batches 3,332, embedding_attempts 25,578. A sampled jobs row carries about 230 bytes of payload and retry text.

This adds one hourly scheduled task, prune-finished-jobs (40 * * * *), that deletes:

  • completed jobs after 7 days;
  • failed_jobs after 30 days;
  • finished job_batches once no job names them;
  • embedding_attempts after 30 days.

Each DELETE seeks an existing index and removes at most 500 rows. A run issues at most 40 batches per table, so a backlog drains over a few runs and a run stays inside its 4-minute policy. The predicates match the package's own prune methods: a member of an unfinished batch stays, and batches go after their members, so the jobs.batch_id foreign key holds.

docs/arch/cron.md is regenerated and pnpm cron:parity passes.

🤖 AI disclosure: Harlan Agent Kit modified this description. My AI open-source policy.

🤖 Generated with Claude Code

nuxt-cf-jobs soft-completes a job, so every hourly sync left up to 250
rows in `jobs` forever, with payloads and retry reasons. D1 is a 10 GB
store and reached its limit on 2026-11-04. On 2026-11-12 `jobs` held
146,816 rows, `failed_jobs` 2,672, `job_batches` 3,332, and
`embedding_attempts` 25,578, none of them pruned.

A new hourly task deletes completed jobs after 7 days, failed jobs and
embedding attempts after 30 days, and finished batches once no job
names them, in bounded index-seeking batches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@harlan-github-agent harlan-github-agent Bot added harlan-agent-running An Agent holds a Task on this issue or pull request right now. harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit. labels Nov 12, 2026
@harlan-github-agent

harlan-github-agent Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

🤖 MERGED

Harlan Agent Kit posted this automated review. It is not Harlan's personal review or approval. AI open source policy. Last updated: 2026-11-12 02:06 UTC.

GitHub merged this pull request.

  • Logged (50/100): Embedding cleanup adds recurring scans of the retained attempt history. View code Optional follow-up: Optional follow-up: add an index beginning with started_at so the retention query can seek its cutoff.
    • Ask an agent to verify and fix this finding

f0f65b60-5cfe-43e5-a63a-53aa0ef1dbd7

Selected findings run after merge and open separate pull requests.

@harlan-github-agent harlan-github-agent Bot added harlan-agent-ready The automated Review passed every gate on this head commit. and removed harlan-agent-running An Agent holds a Task on this issue or pull request right now. harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit. labels Nov 12, 2026

@harlan-github-agent harlan-github-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Harlan Agent Kit posted this automated review. AI open source policy.

Automated Review: READY.

Read the Review results

@harlan-zw
harlan-zw merged commit 9428c83 into main Nov 12, 2026
8 checks passed
@harlan-zw
harlan-zw deleted the chore/prune-finished-jobs branch November 12, 2026 02:01
@harlan-github-agent harlan-github-agent Bot removed the harlan-agent-ready The automated Review passed every gate on this head commit. label Nov 12, 2026
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.

1 participant