Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Heuristic:AIScientists Dev WorldSeed Stuck Verification Requeue

From Leeroopedia
Knowledge Sources
Domains Error_Handling, State_Management
Last Updated 2026-10-26 19:00 GMT

Overview

On worker or server restart, scan for papers stuck in `verifying` status and re-enqueue their verification jobs, since the in-memory pending queue was lost.

Description

The autoresearch pending queue is in-memory. If the server or worker restarts (crash, deploy, manual stop), all queued `VerifyRequest` items are lost. Papers that were in `verifying` status remain stranded — no worker item exists to process them.

The `_requeue_stuck_verifications()` method, called at worker startup, scans all papers with `status == "verifying"`, checks that `method_commit` and `expected_val_loss` are present, and re-enqueues a `VerifyRequest` with the next attempt number. Papers that have exhausted `VERIFY_MAX_ATTEMPTS` are marked `verify_failed`.

Usage

Use this pattern whenever an in-memory queue backs a stateful workflow. On restart, reconcile the persistent state store with the (empty) queue by re-enqueuing items for any work that was in-flight.

The Insight (Rule of Thumb)

  • Action: Call `_requeue_stuck_verifications()` at worker `start()`, before the main loop begins.
  • Value: Scan `store.query_by_type("paper")` for `status == "verifying"`. Re-enqueue with `attempt = existing_attempts + 1`. Cap at `VERIFY_MAX_ATTEMPTS=3`.
  • Trade-off: A paper may get verified twice if the restart happens while a verification is in-flight (but the daemon deduplicates by job state). The extra GPU time is negligible.
  • Compatibility: Requires the state store to be persistent (event-sourcing `RunRecorder`). If the store is also in-memory, the requeue is a no-op.

Reasoning

The pending queue is intentionally in-memory for simplicity and speed — no external broker (Redis, RabbitMQ) is needed. The trade-off is that restarts lose the queue. But the paper state is persistent (written to the event log and state store), so the system has enough information to reconstruct the queue.

Without this requeue, a restart permanently strands every paper that was mid-verification. Authors would have no way to recover — the paper is stuck in `verifying`, a non-terminal state that blocks both peer review (`under_review`) and re-submission.

The attempt counter is preserved and incremented, so the global retry budget (`VERIFY_MAX_ATTEMPTS=3`) is respected across restarts. A paper that already failed twice before the restart gets one final attempt, not a fresh 3.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment