Skip to content

fix(artifact): stop run checks filling D1 and prune old Resolutions - #688

Merged
harlan-zw merged 1 commit into
mainfrom
fix/d1-resolution-retention
Nov 12, 2026
Merged

harlan-zw merged 1 commit into
mainfrom
fix/d1-resolution-retention

Conversation

@harlan-zw

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

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

❓ Type of change

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

📚 Description

skilld-db reached D1's 10 GB limit on 2026-11-04. Writes have failed since then: 22 scheduled tasks are stale and ingestion has stopped.

The cause is the sweep-skill-runs task. It re-checked each of about 140 runnable Skills roughly every 50 minutes. Each check wrote a new Resolution with its attestation (about 34 KB) and a second copy in artifact_attestations (about 24 KB). Nothing deleted these rows. artifact_resolutions and artifact_attestations hold an estimated 6 GB, from sampled row sizes.

This change does two things:

  • The sweep checks a ready Skill weekly and a failing Skill daily. Unchecked Skills and transient failures stay due at once.
  • Before each sweep, pruneSettledResolutions deletes up to 500 settled public Resolutions older than three days. It keeps any Resolution that a run check, a download grant, or the newest attestation of an Artifact still needs. Cascades remove the attestation, check results, and requester rows.

The prune runs before the observed run inserts its start row. That way it can free space while the database is full. The CLI uses a Resolution ID only while it polls one run, so a three-day window is safe.

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

🤖 Generated with Claude Code

The skilld run sweep re-checked every runnable Skill about hourly. Each
check wrote a Resolution with about 60 KB of attestations, and nothing
deleted them. The 10 GB database filled on 2026-11-04 and every write
since has failed.

Check a ready Skill weekly and a failing one daily. Before each sweep,
delete one batch of settled public Resolutions older than three days
that no run check, grant, or newest Artifact attestation needs. The
prune runs before the observed run records its start, so it frees space
while the database is full.

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 01:38 UTC.

GitHub merged this pull request.

  • Logged (62/100): Transient failures after a known failure incorrectly restart the daily retry delay. View code Optional follow-up: Optional follow-up: track whether the latest attempt was retryable separately from the retained failure state, and keep that attempt due immediately.
    • Ask an agent to verify and fix this finding

49682fcd-ad6f-4c5f-bda8-b7e24ca48eab

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

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