Repository navigation
Description
Task
T-042a· Milestone M3 — Oracles + runner + store · Size S · Priority P0 · Epic #3Implements FR-RUN-002
Branch
feat/t-042a-reaper-loop-re-queue-stale— one task = one branch = one PR (doc 32 §6)
Summary
Implement runner/reaper.py Reaper.reap(now) -> int called every runner.reaper_interval_s in the orchestrator, using RunQueue.reap; logs run.requeued and emits worker.updated (OFFLINE) events.
Context / motivation
FR-RUN-002 AC is literally a fake-clock test reproducing the transitions for default and overridden values.
Scope
In scope
- Reaper + schedule helper; marks workers OFFLINE when heartbeat stale.
Implementation guidance
- Pure scheduling logic with an injected
Clock; SQL already in T-012. - Standards: respect the layering contracts (doc 16 §2) and conventions in doc 34; no hard-coded tunables — thresholds/defaults come from typed settings (doc 27); no magic numbers (ruff
PLR2004); public APIs typed (mypy strict) and documented.
Configuration keys
From the configuration reference (doc 27). Keys marked (new) must be added to the typed settings models and appear in the generated reference (T-003c).
runner.reaper_interval_srunner.heartbeat_timeout_srunner.max_attempts
Acceptance criteria
- Fake-clock tests for default (30 s / 3 attempts) and overridden values.
- Runbook RB-05 command
runs requeue --stuckuses the same code path (CLI in T-045b). - Tests listed below added and green in CI; coverage of new code meets the gate in doc 18 §3.
- Docs, config reference and CHANGELOG
Unreleasedupdated where behaviour, keys or interfaces changed. - Definition of Done (doc 32 §3) satisfied.
Tests required
tests/unit/runner/test_reaper.py.
Dependencies
Blocked by: #64 (T-012), #18 (T-002d)
Blocks: #83 (T-040c), #95 (T-048)
Parallelization notes
Files / paths owned by this task — avoid editing other paths; shared files (pyproject.toml entry points, cli/main.py, api/routers/__init__.py, router.tsx, docker/compose.yaml, ci.yml) are append-only:
backend/src/roboprobe/runner/reaper.py
Independent.
Definition of Done
Per doc 32 §3 and AGENTS.md §5: lint, format, mypy strict and import-linter green; tests added and passing; docs updated; PR template completed with Closes #<this issue>; Conventional Commit messages referencing T-042a (doc 16 §6); commits authored only by the repository owner identity (AGENTS.md §4); CI green; reviewer checklist (doc 32 §5.1) satisfied.
References
Design docs: doc 05 §5.3 · doc 14 §5 · doc 30 §RB-05
Requirements: FR-RUN-002 (traceability: doc 28)
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsBacklog
Activity