Skip to content

[T-040a] WorkerProcess pipeline: claim → materialise → run episode → judge → persist #80

Closed

Description

@CodewithJha

Task T-040a · Milestone M3 — Oracles + runner + store · Size M · Priority P0 · Epic #3

Implements 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; metrics roboprobe_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_s
  • worker.default_sim_time_budget_s
  • worker.poll_interval_s
  • storage.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 Unreleased updated 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)

Activity

  1. added
    area:runnerQueue, workers, campaign orchestration
    priority:P0Critical path / blocks others
    milestone:M3M3 — Oracles + runner + store
    taskChild task of a milestone epic
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:runnerQueue, workers, campaign orchestrationmilestone:M3M3 — Oracles + runner + storepriority:P0Critical path / blocks otherssize:M1-3 daystaskChild task of a milestone epictype:featureNew functionality

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions