What changed
The GitHub issue classification worker now treats model-provider account and quota failures as delayed retries instead of failed jobs. It sanitizes provider request and response errors before logging or returning them, and it handles both returned errors and raised provider exceptions.
The existing revision-summary worker now reuses the same sanitizer so provider error handling stays consistent across agent-backed workers. The self-hosting inference guide documents that billing, quota, suspension, and rate-limit provider responses keep classification work scheduled with a backoff.
Why
The production Sentry issue HIVE-K was firing repeatedly while the model provider account was unavailable. Immediate retries could not fix the account state, and returning the raw provider error to Oban kept generating noisy production failure events.
Root cause
Hive.Forage.GitHubIssueClassificationWorker returned raw model-provider failures directly to Oban. For provider billing, spending-limit, suspension, or rate-limit responses, the job exhausted attempts while the issue remained unclassified, and the scheduled sweeper kept the classification path active.
Approach
A shared Hive.Agents.Errors module now normalizes provider request and response errors into short, sanitized reasons. The forage classification worker uses that helper to distinguish provider availability failures from unexpected provider failures.
Availability failures return {:snooze, 3_600}, which leaves the job scheduled for a later retry instead of marking it failed. Unexpected provider failures still return an error, but only with sanitized metadata.
Impact
Provider account or quota outages no longer create repeated Sentry events for each classification job. Affected GitHub issues remain eligible for classification when the provider recovers. The worker still surfaces unexpected failures, without leaking prompt or request body content into logs or background job errors.
Validation
mise exec -- mix format lib/hive/agents/errors.ex lib/hive/specs/revision_summary_worker.ex
mise exec -- mix test test/hive/forage/github_issue_classification_worker_test.exs test/hive/specs/revision_summary_worker_test.exs
mise exec -- mix compile --warnings-as-errors
mise exec -- mix test
- Full test result:
793 passed