Hive Hive
Sign in

fix(forage): snooze unavailable model provider errors

GitHub issue · Closed

Metadata
Source
tuist/hive #98
Updated
Jul 5, 2026
Domains
Hive
Details

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
Flights

Investigate, reproduce, or fix this item in an isolated repository. Each Flight preserves its outcome and agent session.

New Flights are paused Configure model inference, GitHub, and a sandbox provider to start another Flight. Existing results remain available below.
No Flights yet

Start a Flight and preserve its objective, outcome, and session here.

Comments
GA
github-actions[bot] Jun 29, 2026

Blick review didn’t run

The blick review step failed before producing a manifest, so there’s no review to post on this PR. This usually means the agent (opencode) couldn’t start — common causes are an expired or suspended model API key, a missing secret, or the workflow timing out.

See the workflow run for details: https://github.com/tuist/hive/actions/runs/28367683374

Commit: 8daadc5a6634a62ce76dd5e773a6013d7e56a712