Repository navigation
Description
Task
T-040a· Milestone M3 — Oracles + runner + store · Size M · Priority P0 · Epic #3Implements FR-RUN-001 · FR-RUN-003 · FR-RUN-005 · FR-RUN-006
Branch
feat/t-040a-workerprocess-pipeline-claim-materialise-run— one task = one branch = one PR (doc 32 §6)
Summary
Implement runner/worker.py WorkerProcess.claim/execute (doc 05 §5.2, doc 14 §4) single-slot, with timeouts, artefact upload and outcome persistence; backend errors map to INVALID with infra_error.
Context / motivation
The worker turns queued scenarios into judged runs — the execution half of the intelligent loop.
Scope
In scope
- States
IDLE → CLAIMING → PREPARING → RUNNING → EVALUATING → UPLOADING → IDLE. - Per-run workdir under
storage.workdir_root/<run_id>, cleaned after upload. - Wall-clock timeout (
worker.default_wall_timeout_s) and sim-time budget, campaign overrides honoured. - Persist: run fields, oracle results, metrics, artefacts (trace, log, materialised files) in one UoW.
- Logs
run.claimed/started/finished; metricsroboprobe_runs_total,roboprobe_run_duration_seconds.
Out of scope
- Heartbeat thread & registration (T-040b)
- Signal handling/drain (T-040c)
- Manifest builder (T-043)
Implementation guidance
- Constructor-injected collaborators only (backend, uow_factory, artifact store, verdict engine, clock, settings). Expected robot failures are data, not exceptions (doc 34 §5).
- 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).
worker.default_wall_timeout_sworker.default_sim_time_budget_sworker.poll_interval_sstorage.workdir_root
Acceptance criteria
- With FakeBackend + in-memory fakes: a claimed run ends DONE with verdict and artefacts.
- Backend exception → run ERROR/INVALID with
infra_error, worker continues. - Integration test with Postgres + k2d backend completes 20 runs.
- 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_worker_pipeline.py,tests/integration/runner/test_worker_k2d.py.
Dependencies
Blocked by: #64 (T-012), #66 (T-013a), #48 (T-035a), #77 (T-039a)
Blocks: #81 (T-040b), #88 (T-043), #91 (T-045b), #94 (T-046)
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/worker.py
T-040b/T-040c extend this module afterwards — keep heartbeat & signal logic behind small hooks to minimise conflicts.
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-040a (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.2 · doc 14 §4 · doc 11 §5 · doc 34 §5 · doc 34 §8
Requirements: FR-RUN-001 · FR-RUN-003 · FR-RUN-005 · FR-RUN-006 (traceability: doc 28)
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsBacklog
Activity
manifest.json, schema v1) #88run --inline#91roboprobe.bootstrap) and plugin entry-point registries #94