Official Codebase of 3DCodeVerse
Python
the stdlib leaf trio joins proc.py; two contracts pairs merge
gaoypengd993e93ad30c
diff --git a/harness/codeverse/cli/_common.py b/harness/codeverse/cli/_common.pyindex 8d8672d7..992b0657 100644--- a/harness/codeverse/cli/_common.py+++ b/harness/codeverse/cli/_common.py@@ -196,7 +196,7 @@ def make_slug(prompt: str, track: str, language: str, explicit: str | None = Nondef mutating(target: Any, *, what: str, action: str = "enter") -> Iterator[None]:"""The run mutex (``runlock.exclusive``) around anything that writes into a rundirectory, reported as a typed exit. ``target`` is a Workspace or a run root."""- from codeverse.runlock import RunLocked, exclusive+ from codeverse.proc import RunLocked, exclusiveroot = target if isinstance(target, (str, Path)) else target.root # NB: Path.root is "/"stack = ExitStack()diff --git a/harness/codeverse/cli/flywheel_cmd.py b/harness/codeverse/cli/flywheel_cmd.pyindex 752990ed..a51e2c66 100644--- a/harness/codeverse/cli/flywheel_cmd.py+++ b/harness/codeverse/cli/flywheel_cmd.py@@ -91,7 +91,7 @@ def caption_cmd(from codeverse.flywheel.captions import CaptionError, caption_samplefrom codeverse.flywheel.export import load_captionsfrom codeverse.flywheel.record import iter_runs, load_record- from codeverse.runlock import RunLocked, exclusive+ from codeverse.proc import RunLocked, exclusiveif all_runs:targets = [(fr.ws, fr.record, fr.run_id.slug)diff --git a/harness/codeverse/cli/inspect_cmd.py b/harness/codeverse/cli/inspect_cmd.pyindex d15f2578..c9c38a2b 100644--- a/harness/codeverse/cli/inspect_cmd.py+++ b/harness/codeverse/cli/inspect_cmd.py@@ -37,9 +37,8 @@ def status(events: Annotated[int, typer.Option("--events", help="tail N events")] = 8,) -> None:"""Show spec / run_state / record / recent events of a run."""- from codeverse.events import EventLogfrom codeverse.flywheel.record import RecordError, load_record- from codeverse.runlock import holder_of+ from codeverse.proc import EventLog, holder_ofws = C.open_workspace(slug, runs_dir)spec = C.load_spec(ws)diff --git a/harness/codeverse/cli/main.py b/harness/codeverse/cli/main.pyindex 71c1ad3a..26ce68f3 100644--- a/harness/codeverse/cli/main.py+++ b/harness/codeverse/cli/main.py@@ -300,7 +300,7 @@ def _ground_in_reference(spec: Spec, ws, *, n_views: int) -> Spec:"""from codeverse.cost import Role, Stage, call_contextfrom codeverse.cost.instrument import run_ledger- from codeverse.events import EventLog+ from codeverse.proc import EventLogfrom codeverse.reference import ground_specevents = EventLog(ws.events_path)@@ -452,7 +452,7 @@ def resume(f"(that re-plans, re-scores and overwrites the final state).")if raised:- from codeverse.events import EventLog+ from codeverse.proc import EventLogspec = spec.model_copy(update={"budget": spec.budget.model_copy(update=raised)})ws.write_json(ws.spec_path, spec)diff --git a/harness/codeverse/contracts/__init__.py b/harness/codeverse/contracts/__init__.pyindex 8b39e5ed..0be15c53 100644--- a/harness/codeverse/contracts/__init__.py+++ b/harness/codeverse/contracts/__init__.py@@ -16,6 +16,9 @@ from codeverse.contracts.artifacts import (BuildResult,GateFinding,GateReport,+ ImprovementItem,+ JudgeIssue,+ Judgment,Measurement,PartMeasure,RenderSet,@@ -46,7 +49,6 @@ from codeverse.contracts.common import (Vec3,code_file,)-from codeverse.contracts.judgment import ImprovementItem, JudgeIssue, Judgmentfrom codeverse.contracts.plan import (AcceptanceItem,ArticulatedPlan,diff --git a/harness/codeverse/contracts/artifacts.py b/harness/codeverse/contracts/artifacts.pyindex 5fa6b5b9..8921ffdb 100644--- a/harness/codeverse/contracts/artifacts.py+++ b/harness/codeverse/contracts/artifacts.py@@ -3,11 +3,11 @@from __future__ import annotationsfrom enum import StrEnum-from typing import Any+from typing import Any, Literalfrom pydantic import BaseModel, Field-from codeverse.contracts.common import Vec3+from codeverse.contracts.common import Usage, Vec3class Severity(StrEnum):@@ -131,3 +131,41 @@ class RenderSet(BaseModel):console_errors: list[str] = Field(default_factory=list, description="(scenes) JS/WebGL errors seen")fps: float | None = Noneout_dir: str = Field(default="", description="directory the views (+ views.json/metrics.json) were written to")+++# ===================================================================== judgment+# (merged from codeverse/contracts/judgment.py, 2026-08-28)+class JudgeIssue(BaseModel):+ target: str = Field(description="part / zone / joint / asset / 'overall'")+ kind: Literal[+ "geometry", "proportion", "detail", "material", "assembly", "articulation",+ "lighting", "composition", "animation", "effect", "fidelity", "scale", "bug",+ ]+ severity: Literal["critical", "major", "minor"]+ detail: str = Field(description="what is wrong, observable in the renders")+ evidence: str = Field(default="", description="which view(s) / measurement show it")+++class ImprovementItem(BaseModel):+ target: str+ kind: Literal["geometry", "material", "assembly", "articulation", "lighting", "composition", "animation", "effect", "bug"]+ instruction: str = Field(description="concrete, actionable change for the builder")+ priority: int = Field(ge=1, le=5, description="1 = do first")+ expected_gain: float = Field(default=0.0, ge=0.0, le=1.0)+++class Judgment(BaseModel):+ rubric: str+ judge_backend: str = ""+ scores: dict[str, float] = Field(description="criterion → 0..1")+ overall: float = Field(ge=0.0, le=1.0, description="weighted by the rubric (computed in code)")+ passed: bool+ summary: str = ""+ strengths: list[str] = Field(default_factory=list)+ issues: list[JudgeIssue] = Field(default_factory=list)+ improvement_plan: list[ImprovementItem] = Field(default_factory=list)+ acceptance_results: dict[str, bool] = Field(default_factory=dict, description="acceptance item id → verified")+ n_samples: int = 1+ score_std: float = 0.0+ usage: Usage = Field(default_factory=Usage)+ raw: str = ""diff --git a/harness/codeverse/contracts/judgment.py b/harness/codeverse/contracts/judgment.pydeleted file mode 100644index 2cec2cd2..00000000--- a/harness/codeverse/contracts/judgment.py+++ /dev/null@@ -1,45 +0,0 @@-"""Judge outputs: rubric scores + structured, targeted improvement plan."""--from __future__ import annotations--from typing import Literal--from pydantic import BaseModel, Field--from codeverse.contracts.common import Usage---class JudgeIssue(BaseModel):- target: str = Field(description="part / zone / joint / asset / 'overall'")- kind: Literal[- "geometry", "proportion", "detail", "material", "assembly", "articulation",- "lighting", "composition", "animation", "effect", "fidelity", "scale", "bug",- ]- severity: Literal["critical", "major", "minor"]- detail: str = Field(description="what is wrong, observable in the renders")- evidence: str = Field(default="", description="which view(s) / measurement show it")---class ImprovementItem(BaseModel):- target: str- kind: Literal["geometry", "material", "assembly", "articulation", "lighting", "composition", "animation", "effect", "bug"]- instruction: str = Field(description="concrete, actionable change for the builder")- priority: int = Field(ge=1, le=5, description="1 = do first")- expected_gain: float = Field(default=0.0, ge=0.0, le=1.0)---class Judgment(BaseModel):- rubric: str- judge_backend: str = ""- scores: dict[str, float] = Field(description="criterion → 0..1")- overall: float = Field(ge=0.0, le=1.0, description="weighted by the rubric (computed in code)")- passed: bool- summary: str = ""- strengths: list[str] = Field(default_factory=list)- issues: list[JudgeIssue] = Field(default_factory=list)- improvement_plan: list[ImprovementItem] = Field(default_factory=list)- acceptance_results: dict[str, bool] = Field(default_factory=dict, description="acceptance item id → verified")- n_samples: int = 1- score_std: float = 0.0- usage: Usage = Field(default_factory=Usage)- raw: str = ""diff --git a/harness/codeverse/contracts/run.py b/harness/codeverse/contracts/run.pyindex f0fe515c..2dfbd6a1 100644--- a/harness/codeverse/contracts/run.py+++ b/harness/codeverse/contracts/run.py@@ -1,4 +1,9 @@-"""The run record: one entry per run, the unit the flywheel indexes."""+"""What a round did with its skills — the record shape, kept in contracts with the rest.++Lives here rather than in ``codeverse/skills`` so ``contracts`` stays a leaf package that+``flywheel``, ``gallery`` and the CLI can import without pulling the router in, and so a+stored ``record.json`` can be re-read by a build that has no skill library at all.+"""from __future__ import annotations@@ -9,13 +14,70 @@ from typing import Anyfrom pydantic import BaseModel, ConfigDict, Field-from codeverse.contracts.artifacts import BuildResult, GateReport, Measurement, RenderSet+from codeverse.contracts.artifacts import BuildResult, GateReport, Judgment, Measurement, RenderSetfrom codeverse.contracts.common import Usage-from codeverse.contracts.judgment import Judgmentfrom codeverse.contracts.plan import ArticulatedPlan, GraphicsPlan, ScenePlan, StaticPlan-from codeverse.contracts.skills import SkillsUsagefrom codeverse.contracts.spec import Spec++class SkillRead(BaseModel):+ """The read probe's verdict for one materialised bundle (design §6.4)."""++ name: str+ surfaced: bool = Field(default=False, description="SKILL.md atime > mtime: opened by someone (a discovery scan counts)")+ deep: bool = Field(default=False, description="a references/*.md atime > mtime: the body was read and followed")+ deep_measurable: bool = Field(default=True, description="False when the bundle ships no references/ file to probe")+ body_tokens: int = 0+ first_seen_turn: int | None = Field(default=None, description="historical (pre-2026-08-28) api-agent runs only: exact turn of the first read")+ reason: str = Field(default="", description="which route attached it, and which finding")+++class SkillsUsage(BaseModel):+ """``RoundRecord.skills`` — listed vs read vs what it cost, per round.++ The metric that replaces "0 of 16 read_cookbook calls" is :attr:`deep_read_rate`.+ """++ listed: list[str] = Field(default_factory=list)+ reads: list[SkillRead] = Field(default_factory=list)+ index_tokens: int = 0+ body_tokens_read: int = Field(default=0, description="tokens of the bodies the probe says were read deep")+ inlined: str = Field(default="", description="single-shot: the body inlined into the prompt, '' otherwise")+ control_read: bool = Field(+ default=False,+ description="the never-routed control bundle was 'read' too, so this session's atime "+ "evidence proves nothing and every rate below is an upper bound")+ control_present: bool = Field(default=False, description="a control bundle was materialised at all")++ @property+ def probe_trustworthy(self) -> bool:+ """False when the control fired — the only honest reading of the numbers below.++ A run computes ``files_changed`` through ``git add -A -N`` + ``git diff``, and git+ reads every untracked file to do it, which bumps atime on the whole bundle tree.+ CLI activation opens ``references/`` too. Either way the probe says "read" when+ nobody chose to read, and only the control can tell you which session you are in.+ """+ return self.control_present and not self.control_read++ @property+ def surfaced(self) -> list[str]:+ return [r.name for r in self.reads if r.surfaced]++ @property+ def deep(self) -> list[str]:+ return [r.name for r in self.reads if r.deep]++ @property+ def deep_read_rate(self) -> float | None:+ """None when there is nothing listed, or when the control says the probe is blind."""+ if not self.listed or (self.control_present and self.control_read):+ return None+ return len(self.deep) / len(self.listed)+++# ===================================================================== run+# (merged from codeverse/contracts/run.py, 2026-08-28)# --------------------------------------------------------------------------- identity#: battery-layout path segments that are pure plumbing, never part of a run's identityRUN_PATH_NOISE = frozenset({"arms", "cells", "runs"})diff --git a/harness/codeverse/contracts/skills.py b/harness/codeverse/contracts/skills.pydeleted file mode 100644index 8fa944b6..00000000--- a/harness/codeverse/contracts/skills.py+++ /dev/null@@ -1,69 +0,0 @@-"""What a round did with its skills — the record shape, kept in contracts with the rest.--Lives here rather than in ``codeverse/skills`` so ``contracts`` stays a leaf package that-``flywheel``, ``gallery`` and the CLI can import without pulling the router in, and so a-stored ``record.json`` can be re-read by a build that has no skill library at all.-"""--from __future__ import annotations--from pydantic import BaseModel, Field---class SkillRead(BaseModel):- """The read probe's verdict for one materialised bundle (design §6.4)."""-- name: str- surfaced: bool = Field(default=False, description="SKILL.md atime > mtime: opened by someone (a discovery scan counts)")- deep: bool = Field(default=False, description="a references/*.md atime > mtime: the body was read and followed")- deep_measurable: bool = Field(default=True, description="False when the bundle ships no references/ file to probe")- body_tokens: int = 0- first_seen_turn: int | None = Field(default=None, description="historical (pre-2026-08-28) api-agent runs only: exact turn of the first read")- reason: str = Field(default="", description="which route attached it, and which finding")---class SkillsUsage(BaseModel):- """``RoundRecord.skills`` — listed vs read vs what it cost, per round.-- The metric that replaces "0 of 16 read_cookbook calls" is :attr:`deep_read_rate`.- """-- listed: list[str] = Field(default_factory=list)- reads: list[SkillRead] = Field(default_factory=list)- index_tokens: int = 0- body_tokens_read: int = Field(default=0, description="tokens of the bodies the probe says were read deep")- inlined: str = Field(default="", description="single-shot: the body inlined into the prompt, '' otherwise")- control_read: bool = Field(- default=False,- description="the never-routed control bundle was 'read' too, so this session's atime "- "evidence proves nothing and every rate below is an upper bound")- control_present: bool = Field(default=False, description="a control bundle was materialised at all")-- @property- def probe_trustworthy(self) -> bool:- """False when the control fired — the only honest reading of the numbers below.-- A run computes ``files_changed`` through ``git add -A -N`` + ``git diff``, and git- reads every untracked file to do it, which bumps atime on the whole bundle tree.- CLI activation opens ``references/`` too. Either way the probe says "read" when- nobody chose to read, and only the control can tell you which session you are in.- """- return self.control_present and not self.control_read-- @property- def surfaced(self) -> list[str]:- return [r.name for r in self.reads if r.surfaced]-- @property- def deep(self) -> list[str]:- return [r.name for r in self.reads if r.deep]-- @property- def deep_read_rate(self) -> float | None:- """None when there is nothing listed, or when the control says the probe is blind."""- if not self.listed or (self.control_present and self.control_read):- return None- return len(self.deep) / len(self.listed)---__all__ = ["SkillRead", "SkillsUsage"]diff --git a/harness/codeverse/cost/context.py b/harness/codeverse/cost/context.pyindex 9e0620fe..b45763d1 100644--- a/harness/codeverse/cost/context.py+++ b/harness/codeverse/cost/context.py@@ -25,7 +25,7 @@ nothing and never displaces anything.The **run binding** (:func:`bind_run`, the run slug) is a ``ContextVar`` with aprocess-wide fallback: a nested run (a bench worker that opens its own ledger inits own thread) gets its own binding, while a plain worker thread that inherits-nothing — ``codeverse.fanout`` does not copy context — still sees the process's+nothing — ``codeverse.proc`` does not copy context — still sees the process'sone run."""diff --git a/harness/codeverse/events.py b/harness/codeverse/events.pydeleted file mode 100644index 3c80133e..00000000--- a/harness/codeverse/events.py+++ /dev/null@@ -1,38 +0,0 @@-"""Append-only JSONL event log per run (one line per stage/tool/model event).--Events are the audit trail that the flywheel, the CLI ``status`` view and-tests read. Keep payloads small (paths + numbers, not file contents).-"""--from __future__ import annotations--import logging-import threading-import time-from pathlib import Path-from typing import Any--from codeverse.proc import append_jsonl_line, read_jsonl_lenient--log = logging.getLogger(__name__)---class EventLog:- def __init__(self, path: Path):- self.path = Path(path)- self._lock = threading.Lock()- self.path.parent.mkdir(parents=True, exist_ok=True)-- def emit(self, event: str, **data: Any) -> None:- """Append one event. ``event`` is the event name (e.g. ``round.start``);- ``data`` may use any keys, including ``kind``."""- append_jsonl_line(self.path, {"t": round(time.time(), 3), "event": event, **data}, self._lock)-- def read(self) -> list[dict[str, Any]]:- """Read the log, skipping unparseable lines with a debug log.-- ``emit`` appends one buffered ``write``, so a SIGKILL / OOM kill / reboot- leaves a partial trailing line — and a killed run is exactly when someone- types ``3dcv status``. A truncated last line must never lose the rest of- the file (same contract as ``cost.ledger.load_ledger``)."""- return read_jsonl_lenient(self.path, log=log)diff --git a/harness/codeverse/fanout.py b/harness/codeverse/fanout.pydeleted file mode 100644index a9a5a0af..00000000--- a/harness/codeverse/fanout.py+++ /dev/null@@ -1,118 +0,0 @@-"""Bounded parallel fan-out with per-item timing and error capture.--``fan_out`` never raises for a failing item: the result list holds either the-item's return value or the exception, in input order, so callers decide what a-partial failure means (a failed asset is skipped; a failed part task is-retried). Exceptions that are ``BaseException`` but not ``Exception``-(KeyboardInterrupt, SystemExit) propagate.-"""--from __future__ import annotations--import contextvars-import logging-import time-from collections.abc import Callable, Iterable, Sequence-from concurrent.futures import ThreadPoolExecutor-from dataclasses import dataclass, field-from typing import TypeVar--log = logging.getLogger(__name__)--T = TypeVar("T")-R = TypeVar("R")---@dataclass-class FanOutReport:- """Timing/outcome per item, for events and logs."""-- label: str- n_items: int- n_ok: int- n_failed: int- durations_s: list[float] = field(default_factory=list)- total_s: float = 0.0---def _in_caller_context(snapshot: contextvars.Context, fn: Callable[[int], None], i: int) -> None:- """Run ``fn(i)`` with the values the caller's context held at fan-out time.-- ``Context.run`` cannot be re-entered from several threads, so each worker- replays the snapshot's variables into its own (already fresh) context.- """- for var, value in snapshot.items():- var.set(value)- fn(i)---def fan_out[T, R](- items: Sequence[T] | Iterable[T],- fn: Callable[[T], R],- max_workers: int = 8,- *,- label: str = "fanout",- item_name: Callable[[T], str] | None = None,- on_done: Callable[[int, T, R | Exception, float], None] | None = None,-) -> list[R | Exception]:- """Run ``fn`` over ``items`` in a thread pool; return results in input order.-- Each result is the return value or the raised ``Exception``. ``on_done``- (if given) is called from the worker thread with ``(index, item, result,- seconds)`` — keep it cheap and thread-safe (e.g. an EventLog.emit).-- ``max_workers`` is a *fallback*: every caller in the harness states its own,- sized from the measured ceilings in ``docs/COST.md`` Part III- (``Settings.limits`` for the subprocess side, ``Settings.rate.max_in_flight``- for model calls). 8 is the largest width that is inside both knees.- """- items = list(items)- # Workers inherit the caller's context so ambient state set with contextvars- # (the cost ledger's run/stage/role attribution) follows a parallel judge- # sample, best-of-N candidate or bench cell instead of falling back to the- # process default.- ctx_snapshot = contextvars.copy_context()- results: list[R | Exception] = [None] * len(items) # type: ignore[list-item]- if not items:- return results- workers = max(1, min(max_workers, len(items)))- t_all = time.time()- durations = [0.0] * len(items)-- def _run(i: int) -> None:- item = items[i]- name = item_name(item) if item_name else str(i)- t0 = time.time()- try:- out: R | Exception = fn(item)- except Exception as e: # noqa: BLE001 — captured per item by design- out = e- log.warning("%s[%s] failed: %s: %s", label, name, type(e).__name__, e)- dt = time.time() - t0- durations[i] = dt- results[i] = out- log.info("%s[%s] done in %.1fs (%s)", label, name, dt, "error" if isinstance(out, Exception) else "ok")- if on_done is not None:- on_done(i, item, out, dt)-- if workers == 1:- for i in range(len(items)):- _run(i)- else:- with ThreadPoolExecutor(max_workers=workers, thread_name_prefix=label) as pool:- list(pool.map(lambda i: contextvars.copy_context().run(_in_caller_context, ctx_snapshot, _run, i),- range(len(items))))-- n_failed = sum(1 for r in results if isinstance(r, Exception))- report = FanOutReport(label, len(items), len(items) - n_failed, n_failed, durations, time.time() - t_all)- log.info("%s: %d/%d ok in %.1fs", label, report.n_ok, report.n_items, report.total_s)- return results---def split_results[R](results: Sequence[R | Exception]) -> tuple[list[R], list[Exception]]:- """Separate successes from failures (order preserved within each list)."""- ok: list[R] = []- bad: list[Exception] = []- for r in results:- (bad if isinstance(r, Exception) else ok).append(r) # type: ignore[arg-type]- return ok, baddiff --git a/harness/codeverse/flywheel/migrate.py b/harness/codeverse/flywheel/migrate.pyindex c0aa5fbe..2cb3b39c 100644--- a/harness/codeverse/flywheel/migrate.py+++ b/harness/codeverse/flywheel/migrate.py@@ -23,7 +23,7 @@ from pathlib import Pathfrom pydantic import BaseModel, Fieldfrom codeverse.flywheel.record import RecordError, load_record, package_run-from codeverse.runlock import RunLocked, exclusive+from codeverse.proc import RunLocked, exclusivefrom codeverse.workspace import Workspacelog = logging.getLogger(__name__)diff --git a/harness/codeverse/judges/base.py b/harness/codeverse/judges/base.pyindex 4f703bcc..46cc3d4e 100644--- a/harness/codeverse/judges/base.py+++ b/harness/codeverse/judges/base.py@@ -6,8 +6,7 @@ from typing import Any, Protocolfrom pydantic import BaseModel, Field-from codeverse.contracts.artifacts import GateReport, Measurement, RenderSet-from codeverse.contracts.judgment import Judgment+from codeverse.contracts.artifacts import GateReport, Judgment, Measurement, RenderSetfrom codeverse.contracts.plan import AcceptanceItemfrom codeverse.contracts.spec import Specfrom codeverse.workspace import Workspacediff --git a/harness/codeverse/judges/calibration.py b/harness/codeverse/judges/calibration.pyindex 805f8e13..8928dbb7 100644--- a/harness/codeverse/judges/calibration.py+++ b/harness/codeverse/judges/calibration.py@@ -26,9 +26,8 @@ from typing import Anyfrom pydantic import BaseModel, Field-from codeverse.contracts.artifacts import RenderSet+from codeverse.contracts.artifacts import Judgment, RenderSetfrom codeverse.contracts.common import TRACK_INFO-from codeverse.contracts.judgment import Judgmentfrom codeverse.contracts.plan import AcceptanceItemfrom codeverse.contracts.run import RoundRecordfrom codeverse.contracts.spec import Specdiff --git a/harness/codeverse/judges/pairwise.py b/harness/codeverse/judges/pairwise.pyindex 3290c47a..7072a4b5 100644--- a/harness/codeverse/judges/pairwise.py+++ b/harness/codeverse/judges/pairwise.py@@ -1,7 +1,7 @@"""``PairwiseJudge``: which of two candidates better satisfies the spec?Position bias is real, so the comparison runs TWICE with A/B swapped (the two-orderings run in parallel via ``codeverse.fanout``); the winner is declared+orderings run in parallel via ``codeverse.proc``); the winner is declaredonly when both orderings agree, otherwise ``tie``. Each call sees the brief,the rubric's criteria (titles + descriptions) and ONE 2×2 montage per candidate(the 4 most informative views — never a big sheet: VLM judges flip with many@@ -26,7 +26,6 @@ from codeverse.contracts.artifacts import RenderSetfrom codeverse.contracts.chat import ChatMessage, ChatRequest, ImagePart, TextPartfrom codeverse.contracts.common import Usagefrom codeverse.contracts.spec import Spec-from codeverse.fanout import fan_outfrom codeverse.judges.prompt_builder import (MONTAGE_TILE_PX,brief_section,@@ -39,6 +38,7 @@ from codeverse.judges.prompt_builder import (from codeverse.judges.rubrics import JudgeParseError, Rubric, load_rubricfrom codeverse.models.base import ChatModel, ModelErrorfrom codeverse.models.schema_utils import JsonParseError, parse_json_lenient+from codeverse.proc import fan_outlog = logging.getLogger(__name__)diff --git a/harness/codeverse/judges/prompt_builder.py b/harness/codeverse/judges/prompt_builder.pyindex 14f3aa3c..0e896830 100644--- a/harness/codeverse/judges/prompt_builder.py+++ b/harness/codeverse/judges/prompt_builder.py@@ -21,9 +21,15 @@ from typing import TYPE_CHECKING, Literalfrom PIL import Image, ImageDrawfrom codeverse.config import get_settings-from codeverse.contracts.artifacts import GateReport, Measurement, RenderSet, RenderView, Severity+from codeverse.contracts.artifacts import (+ GateReport,+ Judgment,+ Measurement,+ RenderSet,+ RenderView,+ Severity,+)from codeverse.contracts.chat import ChatMessage, ImagePart, TextPart-from codeverse.contracts.judgment import Judgmentfrom codeverse.contracts.plan import AcceptanceItemfrom codeverse.contracts.spec import Specfrom codeverse.conventions import OBJECT_VIEWS, SCENE_VIEWS, ViewPresetdiff --git a/harness/codeverse/judges/rubrics.py b/harness/codeverse/judges/rubrics.pyindex 2767fade..a7d9a720 100644--- a/harness/codeverse/judges/rubrics.py+++ b/harness/codeverse/judges/rubrics.py@@ -37,9 +37,16 @@ from pydantic import (model_validator,)-from codeverse.contracts.artifacts import GateFinding, GateReport, RenderView, Severity+from codeverse.contracts.artifacts import (+ GateFinding,+ GateReport,+ ImprovementItem,+ JudgeIssue,+ Judgment,+ RenderView,+ Severity,+)from codeverse.contracts.common import Usage-from codeverse.contracts.judgment import ImprovementItem, JudgeIssue, Judgmentfrom codeverse.contracts.plan import AcceptanceItemfrom codeverse.models.schema_utils import JsonParseError, parse_json_lenientdiff --git a/harness/codeverse/judges/vlm_judge.py b/harness/codeverse/judges/vlm_judge.pyindex 70bd8e53..e9c68d51 100644--- a/harness/codeverse/judges/vlm_judge.py+++ b/harness/codeverse/judges/vlm_judge.py@@ -4,7 +4,7 @@ Per sample: one ``ChatRequest`` with a per-rubric JSON schema (criteria scored0..1 with evidence, the rubric's binary defect checklist, issues, improvementplan, acceptance verdicts); samples differ by montage/tile order (shuffle seed)so n-sample mean/std measures judge noise. With ``n_samples > 1`` the model-calls run in parallel (``codeverse.fanout``); results accumulate in sample order. Score/defect penalties/floors/caps+calls run in parallel (``codeverse.proc``); results accumulate in sample order. Score/defect penalties/floors/caps/pass are computed in code (``scoring.py``). Images are ≤2×2 montages(``montage.py``); tracks may pass a clay/normals ``geometry_views`` RenderSet. Retries: up to``max_attempts`` per sample on ``ModelError`` / parse failure, all of them inside one@@ -27,11 +27,9 @@ from pathlib import Pathfrom typing import Any, Literalfrom codeverse.config import get_settings-from codeverse.contracts.artifacts import RenderSet, RenderView+from codeverse.contracts.artifacts import Judgment, RenderSet, RenderViewfrom codeverse.contracts.chat import ChatRequest, ChatResponsefrom codeverse.contracts.common import Usage-from codeverse.contracts.judgment import Judgment-from codeverse.fanout import fan_outfrom codeverse.judges.base import JudgeInputfrom codeverse.judges.prompt_builder import build_judge_messages, judge_prompt_hashfrom codeverse.judges.rubrics import (@@ -45,6 +43,7 @@ from codeverse.judges.rubrics import (wire_schema,)from codeverse.models.base import ChatModel, ModelError+from codeverse.proc import fan_outlog = logging.getLogger(__name__)diff --git a/harness/codeverse/orchestrator.py b/harness/codeverse/orchestrator.pyindex 5d9e524c..cb3aead4 100644--- a/harness/codeverse/orchestrator.py+++ b/harness/codeverse/orchestrator.py@@ -22,14 +22,13 @@ from typing import Any, Literal, TypeVarfrom pydantic import BaseModel, Field, ValidationError-from codeverse.contracts.artifacts import GateReport+from codeverse.contracts.artifacts import GateReport, Judgmentfrom codeverse.contracts.common import Budget, Usage-from codeverse.contracts.judgment import Judgmentfrom codeverse.contracts.plan import AcceptanceItem, Planfrom codeverse.contracts.run import RoundRecord, RunStatusfrom codeverse.conventions import to_snakefrom codeverse.cost.billing import bills_usd-from codeverse.events import EventLog+from codeverse.proc import EventLogfrom codeverse.workspace import Workspacelog = logging.getLogger(__name__)diff --git a/harness/codeverse/proc.py b/harness/codeverse/proc.pyindex a7c958df..94826457 100644--- a/harness/codeverse/proc.py+++ b/harness/codeverse/proc.py@@ -14,6 +14,8 @@ callers; it will become a re-export of this module.from __future__ import annotationsimport contextlib+import contextvars+import fcntlimport jsonimport loggingimport os@@ -22,10 +24,12 @@ import subprocessimport threadingimport timefrom collections import deque-from collections.abc import Callable, Iterator, Mapping, Sequence-from dataclasses import dataclass+from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence+from concurrent.futures import ThreadPoolExecutor+from contextlib import contextmanager+from dataclasses import dataclass, fieldfrom pathlib import Path-from typing import IO, Any+from typing import IO, Any, TypeVar@dataclass(frozen=True)@@ -504,3 +508,247 @@ def append_jsonl_line(path: Path | str, rec: Any, lock: threading.Lock) -> None:line = json.dumps(rec, ensure_ascii=False, default=str)with lock, Path(path).open("a", encoding="utf-8") as fh:fh.write(line + "\n")+++# ===================================================================== events+# (merged from codeverse/events.py, 2026-08-28 — same stdlib-leaf layer as proc)+log = logging.getLogger(__name__)+++class EventLog:+ def __init__(self, path: Path):+ self.path = Path(path)+ self._lock = threading.Lock()+ self.path.parent.mkdir(parents=True, exist_ok=True)++ def emit(self, event: str, **data: Any) -> None:+ """Append one event. ``event`` is the event name (e.g. ``round.start``);+ ``data`` may use any keys, including ``kind``."""+ append_jsonl_line(self.path, {"t": round(time.time(), 3), "event": event, **data}, self._lock)++ def read(self) -> list[dict[str, Any]]:+ """Read the log, skipping unparseable lines with a debug log.++ ``emit`` appends one buffered ``write``, so a SIGKILL / OOM kill / reboot+ leaves a partial trailing line — and a killed run is exactly when someone+ types ``3dcv status``. A truncated last line must never lose the rest of+ the file (same contract as ``cost.ledger.load_ledger``)."""+ return read_jsonl_lenient(self.path, log=log)+++# ===================================================================== runlock+# (merged from codeverse/runlock.py, 2026-08-28 — same stdlib-leaf layer as proc)+#: directory (beside the run dirs, never inside one) holding the flock files+LOCKS_DIR = ".locks"+++class RunLocked(RuntimeError):+ """Another live holder — process or thread — is already running this run."""+++def _held_message(run_root: Path | str, held: dict, *, action: str) -> str:+ started = time.strftime("%H:%M:%S", time.localtime(held.get("started", 0)))+ name = Path(run_root).name+ return (+ f"refusing to {action} run {name}: it is being run right now by pid {held.get('pid', '?')} "+ f"(started {started}: {held.get('what') or '3dcv'}). Two processes on one run "+ f"corrupt each other's state. Look at it with `3dcv status {name}`, or stop that "+ f"ONE process with `kill {held.get('pid', '?')}` — never `pkill -f 3dcv`, which kills every "+ f"other run on this machine too."+ )+++def flock_path(run_root: Path | str) -> Path:+ """The flock file for this run: ``<runs>/.locks/<slug>.lock``."""+ root = Path(run_root).resolve()+ return root.parent / LOCKS_DIR / f"{root.name}.lock"+++_HELD: dict[str, list] = {} # flock path -> [fd, owning thread ident] held by THIS process+_HELD_GUARD = threading.Lock()+++def _record_of(fd: int) -> dict | None:+ try:+ os.lseek(fd, 0, os.SEEK_SET)+ raw = os.read(fd, 4096).decode("utf-8", "replace").strip()+ rec = json.loads(raw) if raw else None+ except (OSError, ValueError):+ return None+ return rec if isinstance(rec, dict) else None+++def _write_record(fd: int, rec: dict) -> None:+ os.ftruncate(fd, 0)+ os.lseek(fd, 0, os.SEEK_SET)+ os.write(fd, json.dumps(rec).encode())+ os.fsync(fd)+++def holder_of(run_root: Path | str) -> dict | None:+ """The ``{pid, started, what}`` of whoever holds this run — without taking it.++ ``None`` when nobody does, including after a SIGKILL: the kernel dropped the flock but+ the record is still in the file, so a probe (shared, non-blocking, released at once)+ tells the difference and ``3dcv status`` never names a pid that is already gone."""+ try:+ fd = os.open(flock_path(run_root), os.O_RDONLY)+ except OSError:+ return None+ try:+ try:+ fcntl.flock(fd, fcntl.LOCK_SH | fcntl.LOCK_NB)+ except OSError:+ return _record_of(fd) # refused: somebody is holding it right now+ fcntl.flock(fd, fcntl.LOCK_UN)+ return None+ finally:+ os.close(fd)+++@contextmanager+def exclusive(run_root: Path | str, *, what: str = "", action: str = "enter") -> Iterator[None]:+ """THE mutex for one run: hold it around every mutation of the run directory.++ Raises :class:`RunLocked`, naming the holder, when anyone else has it — another+ process, or another THREAD of this one (the bench drivers run runs in a pool). Only+ the SAME thread re-enters, so the CLI can take it at the mutation boundary and the+ code under it can take it again."""+ key, me = str(flock_path(run_root)), threading.get_ident()+ with _HELD_GUARD:+ entry = _HELD.get(key)+ if entry is not None:+ if entry[1] != me:+ raise RunLocked(_held_message(run_root, holder_of(run_root) or {}, action=action))+ yield # the SAME thread re-entering: the outermost `with` owns the release+ return+ path = Path(key)+ path.parent.mkdir(parents=True, exist_ok=True)+ fd = os.open(path, os.O_CREAT | os.O_RDWR, 0o644)+ try:+ fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB)+ except OSError:+ held = _record_of(fd) or {}+ os.close(fd)+ raise RunLocked(_held_message(run_root, held, action=action)) from None+ except BaseException:+ os.close(fd)+ raise+ try: # inside the try that owns the fd: a failed write must not leak an unreleasable lock+ _write_record(fd, {"pid": os.getpid(), "started": time.time(), "what": what})+ with _HELD_GUARD:+ _HELD[key] = [fd, me]+ yield+ finally:+ with _HELD_GUARD:+ _HELD.pop(key, None)+ try:+ os.ftruncate(fd, 0) # the file stays (unlinking it races a waiter's open)+ fcntl.flock(fd, fcntl.LOCK_UN)+ except OSError:+ pass+ finally:+ os.close(fd)+++# ===================================================================== fanout+# (merged from codeverse/fanout.py, 2026-08-28 — same stdlib-leaf layer as proc)+log = logging.getLogger(__name__)++T = TypeVar("T")+R = TypeVar("R")+++@dataclass+class FanOutReport:+ """Timing/outcome per item, for events and logs."""++ label: str+ n_items: int+ n_ok: int+ n_failed: int+ durations_s: list[float] = field(default_factory=list)+ total_s: float = 0.0+++def _in_caller_context(snapshot: contextvars.Context, fn: Callable[[int], None], i: int) -> None:+ """Run ``fn(i)`` with the values the caller's context held at fan-out time.++ ``Context.run`` cannot be re-entered from several threads, so each worker+ replays the snapshot's variables into its own (already fresh) context.+ """+ for var, value in snapshot.items():+ var.set(value)+ fn(i)+++def fan_out[T, R](+ items: Sequence[T] | Iterable[T],+ fn: Callable[[T], R],+ max_workers: int = 8,+ *,+ label: str = "fanout",+ item_name: Callable[[T], str] | None = None,+ on_done: Callable[[int, T, R | Exception, float], None] | None = None,+) -> list[R | Exception]:+ """Run ``fn`` over ``items`` in a thread pool; return results in input order.++ Each result is the return value or the raised ``Exception``. ``on_done``+ (if given) is called from the worker thread with ``(index, item, result,+ seconds)`` — keep it cheap and thread-safe (e.g. an EventLog.emit).++ ``max_workers`` is a *fallback*: every caller in the harness states its own,+ sized from the measured ceilings in ``docs/COST.md`` Part III+ (``Settings.limits`` for the subprocess side, ``Settings.rate.max_in_flight``+ for model calls). 8 is the largest width that is inside both knees.+ """+ items = list(items)+ # Workers inherit the caller's context so ambient state set with contextvars+ # (the cost ledger's run/stage/role attribution) follows a parallel judge+ # sample, best-of-N candidate or bench cell instead of falling back to the+ # process default.+ ctx_snapshot = contextvars.copy_context()+ results: list[R | Exception] = [None] * len(items) # type: ignore[list-item]+ if not items:+ return results+ workers = max(1, min(max_workers, len(items)))+ t_all = time.time()+ durations = [0.0] * len(items)++ def _run(i: int) -> None:+ item = items[i]+ name = item_name(item) if item_name else str(i)+ t0 = time.time()+ try:+ out: R | Exception = fn(item)+ except Exception as e: # noqa: BLE001 — captured per item by design+ out = e+ log.warning("%s[%s] failed: %s: %s", label, name, type(e).__name__, e)+ dt = time.time() - t0+ durations[i] = dt+ results[i] = out+ log.info("%s[%s] done in %.1fs (%s)", label, name, dt, "error" if isinstance(out, Exception) else "ok")+ if on_done is not None:+ on_done(i, item, out, dt)++ if workers == 1:+ for i in range(len(items)):+ _run(i)+ else:+ with ThreadPoolExecutor(max_workers=workers, thread_name_prefix=label) as pool:+ list(pool.map(lambda i: contextvars.copy_context().run(_in_caller_context, ctx_snapshot, _run, i),+ range(len(items))))++ n_failed = sum(1 for r in results if isinstance(r, Exception))+ report = FanOutReport(label, len(items), len(items) - n_failed, n_failed, durations, time.time() - t_all)+ log.info("%s: %d/%d ok in %.1fs", label, report.n_ok, report.n_items, report.total_s)+ return results+++def split_results[R](results: Sequence[R | Exception]) -> tuple[list[R], list[Exception]]:+ """Separate successes from failures (order preserved within each list)."""+ ok: list[R] = []+ bad: list[Exception] = []+ for r in results:+ (bad if isinstance(r, Exception) else ok).append(r) # type: ignore[arg-type]+ return ok, baddiff --git a/harness/codeverse/runlock.py b/harness/codeverse/runlock.pydeleted file mode 100644index b7405132..00000000--- a/harness/codeverse/runlock.py+++ /dev/null@@ -1,136 +0,0 @@-"""One writer per run directory.--Two ``3dcv`` on one run both write ``run_state.json``, both snapshot ``src/`` into the-same git repo and both spend the budget (measured 2026-08-25: two ``3dcv resume`` ran-four minutes side by side on tsr_scn_temple_night).--:func:`exclusive` is the ONE authority: an ``fcntl.flock`` on-``<runs>/.locks/<slug>.lock``, beside the run dirs because ``--force`` ``rmtree``s the-run root and a lock deleted mid-hold is no lock. The kernel drops it when the holder-dies, so a crash never wedges a run. Its ``{pid, started, what}`` record (also read by-:func:`holder_of`, without locking) is what a refusal prints, so a human can ``kill``-THAT pid instead of ``pkill -f 3dcv`` — which took out thirteen unrelated runs.-"""--from __future__ import annotations--import fcntl-import json-import os-import threading-import time-from collections.abc import Iterator-from contextlib import contextmanager-from pathlib import Path--#: directory (beside the run dirs, never inside one) holding the flock files-LOCKS_DIR = ".locks"---class RunLocked(RuntimeError):- """Another live holder — process or thread — is already running this run."""---def _held_message(run_root: Path | str, held: dict, *, action: str) -> str:- started = time.strftime("%H:%M:%S", time.localtime(held.get("started", 0)))- name = Path(run_root).name- return (- f"refusing to {action} run {name}: it is being run right now by pid {held.get('pid', '?')} "- f"(started {started}: {held.get('what') or '3dcv'}). Two processes on one run "- f"corrupt each other's state. Look at it with `3dcv status {name}`, or stop that "- f"ONE process with `kill {held.get('pid', '?')}` — never `pkill -f 3dcv`, which kills every "- f"other run on this machine too."- )---def flock_path(run_root: Path | str) -> Path:- """The flock file for this run: ``<runs>/.locks/<slug>.lock``."""- root = Path(run_root).resolve()- return root.parent / LOCKS_DIR / f"{root.name}.lock"---_HELD: dict[str, list] = {} # flock path -> [fd, owning thread ident] held by THIS process-_HELD_GUARD = threading.Lock()---def _record_of(fd: int) -> dict | None:- try:- os.lseek(fd, 0, os.SEEK_SET)- raw = os.read(fd, 4096).decode("utf-8", "replace").strip()- rec = json.loads(raw) if raw else None- except (OSError, ValueError):- return None- return rec if isinstance(rec, dict) else None---def _write_record(fd: int, rec: dict) -> None:- os.ftruncate(fd, 0)- os.lseek(fd, 0, os.SEEK_SET)- os.write(fd, json.dumps(rec).encode())- os.fsync(fd)---def holder_of(run_root: Path | str) -> dict | None:- """The ``{pid, started, what}`` of whoever holds this run — without taking it.-- ``None`` when nobody does, including after a SIGKILL: the kernel dropped the flock but- the record is still in the file, so a probe (shared, non-blocking, released at once)- tells the difference and ``3dcv status`` never names a pid that is already gone."""- try:- fd = os.open(flock_path(run_root), os.O_RDONLY)- except OSError:- return None- try:- try:- fcntl.flock(fd, fcntl.LOCK_SH | fcntl.LOCK_NB)- except OSError:- return _record_of(fd) # refused: somebody is holding it right now- fcntl.flock(fd, fcntl.LOCK_UN)- return None- finally:- os.close(fd)---@contextmanager-def exclusive(run_root: Path | str, *, what: str = "", action: str = "enter") -> Iterator[None]:- """THE mutex for one run: hold it around every mutation of the run directory.-- Raises :class:`RunLocked`, naming the holder, when anyone else has it — another- process, or another THREAD of this one (the bench drivers run runs in a pool). Only- the SAME thread re-enters, so the CLI can take it at the mutation boundary and the- code under it can take it again."""- key, me = str(flock_path(run_root)), threading.get_ident()- with _HELD_GUARD:- entry = _HELD.get(key)- if entry is not None:- if entry[1] != me:- raise RunLocked(_held_message(run_root, holder_of(run_root) or {}, action=action))- yield # the SAME thread re-entering: the outermost `with` owns the release- return- path = Path(key)- path.parent.mkdir(parents=True, exist_ok=True)- fd = os.open(path, os.O_CREAT | os.O_RDWR, 0o644)- try:- fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB)- except OSError:- held = _record_of(fd) or {}- os.close(fd)- raise RunLocked(_held_message(run_root, held, action=action)) from None- except BaseException:- os.close(fd)- raise- try: # inside the try that owns the fd: a failed write must not leak an unreleasable lock- _write_record(fd, {"pid": os.getpid(), "started": time.time(), "what": what})- with _HELD_GUARD:- _HELD[key] = [fd, me]- yield- finally:- with _HELD_GUARD:- _HELD.pop(key, None)- try:- os.ftruncate(fd, 0) # the file stays (unlinking it races a waiter's open)- fcntl.flock(fd, fcntl.LOCK_UN)- except OSError:- pass- finally:- os.close(fd)diff --git a/harness/codeverse/skills/telemetry.py b/harness/codeverse/skills/telemetry.pyindex 36cd27bb..012ef8b5 100644--- a/harness/codeverse/skills/telemetry.py+++ b/harness/codeverse/skills/telemetry.py@@ -38,7 +38,7 @@ from collections.abc import Sequencefrom pathlib import Pathfrom typing import Any-from codeverse.contracts.skills import SkillRead, SkillsUsage+from codeverse.contracts.run import SkillRead, SkillsUsagefrom codeverse.skills.model import SkillsMaterializedfrom codeverse.skills.prompting import AGENTS_SKILL_ROOT, CLAUDE_SKILL_ROOTdiff --git a/harness/codeverse/texturing/generate.py b/harness/codeverse/texturing/generate.pyindex 2babfdbd..624a439a 100644--- a/harness/codeverse/texturing/generate.py+++ b/harness/codeverse/texturing/generate.py@@ -28,9 +28,8 @@ from PIL import Imagefrom pydantic import BaseModel, Fieldfrom codeverse.config import get_settings-from codeverse.contracts.artifacts import Measurement, RenderSet+from codeverse.contracts.artifacts import Judgment, Measurement, RenderSetfrom codeverse.contracts.common import Usage-from codeverse.contracts.judgment import Judgmentfrom codeverse.contracts.plan import AcceptanceItem, StaticPlanfrom codeverse.contracts.spec import Specfrom codeverse.conventions import OBJECT_VIEWS_QUICK, ViewPresetdiff --git a/harness/codeverse/texturing/run.py b/harness/codeverse/texturing/run.pyindex 69484e1a..f5806f4b 100644--- a/harness/codeverse/texturing/run.py+++ b/harness/codeverse/texturing/run.py@@ -31,7 +31,7 @@ from codeverse.contracts.common import TRACK_INFO, Track, Usagefrom codeverse.contracts.plan import StaticPlanfrom codeverse.contracts.spec import Specfrom codeverse.conventions import OBJECT_VIEWS_QUICK, ViewPreset-from codeverse.events import EventLog+from codeverse.proc import EventLogfrom codeverse.texturing.apply import (ApplyReport,NormaliseReport,diff --git a/harness/codeverse/tracks/candidates.py b/harness/codeverse/tracks/candidates.pyindex 324d06bc..2a581166 100644--- a/harness/codeverse/tracks/candidates.py+++ b/harness/codeverse/tracks/candidates.py@@ -30,8 +30,8 @@ from codeverse.contracts.artifacts import GateReport, RenderSetfrom codeverse.contracts.common import Usagefrom codeverse.contracts.run import RoundRecordfrom codeverse.conventions import OBJECT_VIEWS_QUICK-from codeverse.fanout import fan_outfrom codeverse.orchestrator import BestSelector, BudgetExceeded+from codeverse.proc import fan_outfrom codeverse.tracks.common import RunContextfrom codeverse.tracks.generation import GenerationTaskfrom codeverse.tracks.repair import build_with_repairdiff --git a/harness/codeverse/tracks/common.py b/harness/codeverse/tracks/common.pyindex 57ab927d..bf75dbfb 100644--- a/harness/codeverse/tracks/common.py+++ b/harness/codeverse/tracks/common.py@@ -20,8 +20,8 @@ from codeverse.contracts.common import Language, Trackfrom codeverse.contracts.plan import CameraPlan, Planfrom codeverse.contracts.run import RunRecordfrom codeverse.conventions import ViewPreset-from codeverse.events import EventLogfrom codeverse.orchestrator import BudgetGuard, RoundPolicy, RunState+from codeverse.proc import EventLogfrom codeverse.prompts import load_text, prompt_hashfrom codeverse.tracks.generation import is_single_shotfrom codeverse.workspace import Workspacediff --git a/harness/codeverse/tracks/lifecycle.py b/harness/codeverse/tracks/lifecycle.pyindex 5b73b60e..f4081c69 100644--- a/harness/codeverse/tracks/lifecycle.py+++ b/harness/codeverse/tracks/lifecycle.py@@ -25,7 +25,6 @@ from codeverse.contracts.common import Track, Usagefrom codeverse.contracts.plan import Planfrom codeverse.contracts.run import RoundRecord, RunRecord, RunStatusfrom codeverse.contracts.spec import Spec-from codeverse.events import EventLogfrom codeverse.orchestrator import (BestSelector,BudgetExceeded,@@ -45,6 +44,7 @@ from codeverse.orchestrator import (kind_for_strategy,plan_refine_groups,)+from codeverse.proc import EventLogfrom codeverse.prompts import renderfrom codeverse.tracks.candidates import choose_best_round, run_best_of_nfrom codeverse.tracks.common import (diff --git a/harness/codeverse/tracks/scene.py b/harness/codeverse/tracks/scene.pyindex 7d7291b9..4275b8dd 100644--- a/harness/codeverse/tracks/scene.py+++ b/harness/codeverse/tracks/scene.py@@ -38,8 +38,8 @@ from codeverse.contracts.common import TRACK_INFO, Trackfrom codeverse.contracts.plan import Plan, ScenePlan, ZonePlanfrom codeverse.contracts.run import RoundRecordfrom codeverse.conventions import to_snake-from codeverse.fanout import fan_outfrom codeverse.orchestrator import StageRunner, TaskGroup, compact_instructions+from codeverse.proc import fan_outfrom codeverse.prompts import renderfrom codeverse.spatial.frame_motion import motion_text_forfrom codeverse.spatial.render_scene import JUDGE_MAX_VIEWS, perf_detaildiff --git a/harness/codeverse/tracks/scene_assets.py b/harness/codeverse/tracks/scene_assets.pyindex 8909d559..73b5d5b3 100644--- a/harness/codeverse/tracks/scene_assets.py+++ b/harness/codeverse/tracks/scene_assets.py@@ -25,13 +25,12 @@ from typing import Anyfrom pydantic import BaseModel, Field+from codeverse.contracts.artifacts import Judgmentfrom codeverse.contracts.common import Language, Track-from codeverse.contracts.judgment import Judgmentfrom codeverse.contracts.plan import AssetPlan, BBox, PartPlan, ScenePlan, StaticPlanfrom codeverse.contracts.spec import Specfrom codeverse.conventions import OBJECT_VIEWS_QUICK, to_pascal, to_snake-from codeverse.fanout import fan_out-from codeverse.proc import write_json_atomic, write_text_atomic+from codeverse.proc import fan_out, write_json_atomic, write_text_atomicfrom codeverse.prompts import renderfrom codeverse.tracks.common import RunContext, language_contract, load_prompt_orfrom codeverse.tracks.generation import SINGLE_SHOT_PREFIX, GenerationTask, generate, is_single_shotdiff --git a/harness/codeverse/tracks/skills_hook.py b/harness/codeverse/tracks/skills_hook.pyindex c23a9c12..62132f15 100644--- a/harness/codeverse/tracks/skills_hook.py+++ b/harness/codeverse/tracks/skills_hook.py@@ -20,7 +20,7 @@ from typing import Anyfrom pydantic import ValidationErrorfrom codeverse.contracts.artifacts import GateReport-from codeverse.contracts.skills import SkillsUsage+from codeverse.contracts.run import SkillsUsagefrom codeverse.tracks.common import RunContextlog = logging.getLogger(__name__)diff --git a/harness/codeverse/tracks/steps.py b/harness/codeverse/tracks/steps.pyindex 84d4b242..7891ff24 100644--- a/harness/codeverse/tracks/steps.py+++ b/harness/codeverse/tracks/steps.py@@ -27,13 +27,12 @@ from datetime import UTC, datetimefrom pathlib import Pathfrom typing import Protocol-from codeverse.contracts.artifacts import BuildResult, GateReport, Measurement, RenderSet+from codeverse.contracts.artifacts import BuildResult, GateReport, Judgment, Measurement, RenderSetfrom codeverse.contracts.common import Usage-from codeverse.contracts.judgment import Judgmentfrom codeverse.contracts.plan import AcceptanceItem, Planfrom codeverse.contracts.run import RoundRecord-from codeverse.fanout import fan_outfrom codeverse.orchestrator import usage_delta+from codeverse.proc import fan_outfrom codeverse.spatial.render import RenderErrorfrom codeverse.tracks import skills_hookfrom codeverse.tracks.common import RunContextdiff --git a/harness/docs/ARCHITECTURE.md b/harness/docs/ARCHITECTURE.mdindex be5ddd26..06dd9c8a 100644--- a/harness/docs/ARCHITECTURE.md+++ b/harness/docs/ARCHITECTURE.md@@ -74,14 +74,10 @@ codeverse/default_candidates=1)contracts/ pydantic: common (Track, Language, Usage, Budget, Backends, TRACK_INFO registry,ENTRY_FILE/code_file/LANGUAGE_LABEL tables), spec (+ RunOptions), plan, artifacts- (GateFinding.as_line, RenderView.judge, RenderSet.out_dir), judgment, run, chat,- agent (typed AgentJob + ApiAgentOptions), skills.py (SkillsUsage/SkillRead on- RoundRecord: what was attached, what was read)- workspace.py run-dir layout + git snapshots ; events.py JSONL event log- runlock.py ONE writer per run dir: an fcntl.flock on <runs>/.locks/<slug>.lock- (outside the dir a --force wipe deletes; released by the kernel if- the holder dies) taken at every mutation boundary; its record NAMES- the holder (`holder_of`, printed by `3dcv status`) so a human can kill that pid+ (GateFinding.as_line, RenderView.judge, RenderSet.out_dir, + Judgment), run+ (+ SkillsUsage/SkillRead: what was attached, what was read), chat,+ agent (typed AgentJob)+ workspace.py run-dir layout + git snapshotsproc.py stdlib-only subprocess + atomic-JSON primitives (ManagedProcess owns everychild's lifecycle: group kill on ANY exception, bounded pumps, stdin writer;run_subprocess, kill_group, tail, write_json_atomic, scrub_secrets) and the tolerant readers/writer@@ -89,10 +85,12 @@ codeverse/shared by languages/spatial/cli/cost/flywheel/gallery/bench. RULE: anystdlib-only file / JSON / JSONL helper lives HERE; grep proc.py before writing atry/except read (the 2026-08-26 review found the same tolerant read written- eight times because this module had not grown it), and keep it under ~250- lines so it stays a leaf- fanout.py bounded parallel fan-out (fan_out, split_results, FanOutReport) — shared by- tracks/judges/texturing/bench+ eight times because this module had not grown it). Also home, since+ 2026-08-28, to the JSONL event log (Events), the run lock (ONE writer per+ run dir: an fcntl.flock at <runs>/.locks/<slug>.lock whose record NAMES the+ holder, printed by `3dcv status`) and the bounded parallel fan-out+ (fan_out, split_results, FanOutReport) — still a leaf: imports nothing+ from codeversemodels/ ChatModel (base.py), parts.py; gemini.py (the whole Gemini stack:request/response shapes, dead-key + free 429 rotation, the image model);anthropic.py openai.py (each with its own request/response shapes);diff --git a/harness/docs/REVIEW_2026-08-26.md b/harness/docs/REVIEW_2026-08-26.mdindex 90306490..06c9edb5 100644--- a/harness/docs/REVIEW_2026-08-26.md+++ b/harness/docs/REVIEW_2026-08-26.md@@ -120,13 +120,13 @@ with `-p no:cacheprovider -m "not live"`. After every deletion item also run `ru- Files: `codeverse/tracks/common.py:237-247` (`__getattr__` + `_PROMPTING`), `codeverse/tracks/static_object.py:33`(`MAX_SKELETON_CHARS # noqa: F401`), delete `codeverse/orchestrator/fanout.py`; redirect`tracks/steps.py:36`, `tracks/candidates.py:38`, `tracks/scene.py:41`, `tracks/scene_assets.py:33`,- `tests/orchestrator_tracks/test_orchestrator.py:17` to `from codeverse.fanout import fan_out, split_results`.+ `tests/orchestrator_tracks/test_orchestrator.py:17` to `from codeverse.proc import fan_out, split_results`.- Docs: **move** the `fanout.py` token from the orchestrator row (`docs/ARCHITECTURE.md:145`) to the top-level`codeverse/` row (~line 85, beside `proc.py`) — dropping it alone fails`tests/install/test_docs.py::test_architecture_package_map_covers_every_module`. Drop the "(lazy re-exports keepold imports working)" parenthetical at `docs/INTERFACES.md:334` and "fan-out" from `orchestrator/__init__.py`'s docstring.- Why: no importer pulls any of the 12 prompting names via `tracks.common`; `MAX_SKELETON_CHARS` is used only in- `prompting.py`; the shim forwards identical objects; judges/cost/bench already import `codeverse.fanout`.+ `prompting.py`; the shim forwards identical objects; judges/cost/bench already import `codeverse.proc`.- T: `python -m pytest tests/orchestrator_tracks tests/install/test_docs.py tests/prompts -q` (243 + 50 passed today).**A9. Delete the `gl_build` shim** · `languages-gl-build-shim` · risk low · ~−13 LOC@@ -467,7 +467,7 @@ None of the god files is split by this plan (see §4.5); A7 retires one by delet| gallery-rel-fmt-dup | `_rel` twice, `fmt` three times | gallery/index.py:52-61, detail.py:78-87, cards.py:27, page.py:34, detail.py:65 | 20 | fold into D2 if convenient || version-probe-dup | doctor re-implements record's `--version` / node pkg probes | flywheel/record.py:39-46,72-79; cli/doctor.py:42-53,95-102 | 20 | || core-dead-workspace-transcript | `Workspace.stages/diff/snapshot_src`, `Trajectory.stdout_path/stderr_path` unreferenced | workspace.py:171-173,360-367; agents/transcript.py:39-46 | 18 | grep looked clean; verify `snapshot_src` in flywheel export |-| tracks-dup-fanout-exception-unpack | post-`fan_out` BudgetExceeded unpack ×4 with local imports | tracks/steps.py:125-138, scene.py:281-292, scene_assets.py:143-152, candidates.py:78-92 | 15 | check `codeverse.fanout.split_results` first |+| tracks-dup-fanout-exception-unpack | post-`fan_out` BudgetExceeded unpack ×4 with local imports | tracks/steps.py:125-138, scene.py:281-292, scene_assets.py:143-152, candidates.py:78-92 | 15 | check `codeverse.proc.split_results` first || languages-urdf-lint-own-ast-helpers | urdf lint bypasses `_ast_lint`, not in drift test; `PASCAL_RE` ×2 | urdf/lint.py:39,268-275; blender/lint.py:70; cadquery/lint.py:42 | 15 | || spatial-union-find-twice | identical path-compressing union-find | spatial/connectivity.py:189-203, joints_sweep.py:83-101 | 15 | || cost-dup-gemini-cli-stats | reconstruct re-implements gemini_cli usage mapping | cost/reconstruct.py:149-167, agents/gemini_cli.py:101-128 | 14 | medium risk; import direction cost→agents to check |diff --git a/harness/tests/compare_bench/conftest.py b/harness/tests/compare_bench/conftest.pyindex e2f02779..29779b01 100644--- a/harness/tests/compare_bench/conftest.py+++ b/harness/tests/compare_bench/conftest.py@@ -19,13 +19,13 @@ from codeverse.contracts.artifacts import ( # noqa: E402BuildResult,GateFinding,GateReport,+ Judgment, # noqa: E402Measurement,RenderSet,RenderView,Severity,)from codeverse.contracts.common import Usage # noqa: E402-from codeverse.contracts.judgment import Judgment # noqa: E402from codeverse.contracts.run import RunRecord, RunStatus # noqa: E402from codeverse.contracts.spec import Spec # noqa: E402from codeverse.workspace import Workspace # noqa: E402diff --git a/harness/tests/core/test_events.py b/harness/tests/core/test_events.pyindex e28c8a53..124bf9ff 100644--- a/harness/tests/core/test_events.py+++ b/harness/tests/core/test_events.py@@ -10,7 +10,7 @@ from typer.testing import CliRunnerfrom codeverse.cli.main import appfrom codeverse.contracts.common import Backends, Language, Trackfrom codeverse.contracts.spec import Spec-from codeverse.events import EventLog+from codeverse.proc import EventLogfrom codeverse.workspace import Workspacerunner = CliRunner()diff --git a/harness/tests/core/test_runlock.py b/harness/tests/core/test_runlock.pyindex bea59e24..d751f888 100644--- a/harness/tests/core/test_runlock.py+++ b/harness/tests/core/test_runlock.py@@ -9,7 +9,7 @@ from pathlib import Pathimport pytest-from codeverse.runlock import (+from codeverse.proc import (LOCKS_DIR,RunLocked,exclusive,@@ -25,7 +25,7 @@ def _child_script(run_root: Path, ready: Path, go: Path) -> str:return ("import sys, time, pathlib\n"f"sys.path.insert(0, {str(HARNESS_ROOT)!r})\n"- "from codeverse.runlock import exclusive, RunLocked\n"+ "from codeverse.proc import exclusive, RunLocked\n"f"root, ready, go = pathlib.Path({str(run_root)!r}), pathlib.Path({str(ready)!r}), pathlib.Path({str(go)!r})\n""try:\n"" with exclusive(root, what='child'):\n"@@ -131,7 +131,7 @@ def test_a_failed_record_write_leaks_nothing(tmp_path: Path, monkeypatch):it — every process was refused for the lifetime of this one, by a message naming anempty holder."""- import codeverse.runlock as R+ import codeverse.proc as Rrun_root = tmp_path / "runs" / "slug"run_root.mkdir(parents=True)diff --git a/harness/tests/flywheel_cli/conftest.py b/harness/tests/flywheel_cli/conftest.pyindex ce35482e..847ad22f 100644--- a/harness/tests/flywheel_cli/conftest.py+++ b/harness/tests/flywheel_cli/conftest.py@@ -14,12 +14,14 @@ from codeverse.contracts.artifacts import (BuildResult,GateFinding,GateReport,+ ImprovementItem,+ JudgeIssue,+ Judgment,RenderSet,RenderView,Severity,)from codeverse.contracts.common import Backends, Language, Track, Usage-from codeverse.contracts.judgment import ImprovementItem, JudgeIssue, Judgmentfrom codeverse.contracts.run import RoundRecord, RunRecord, RunStatusfrom codeverse.contracts.spec import Specfrom codeverse.workspace import Workspacediff --git a/harness/tests/flywheel_cli/test_complexity_record.py b/harness/tests/flywheel_cli/test_complexity_record.pyindex 9ab46150..737d8ee2 100644--- a/harness/tests/flywheel_cli/test_complexity_record.py+++ b/harness/tests/flywheel_cli/test_complexity_record.py@@ -22,9 +22,8 @@ if str(REPO) not in sys.path:from datetime import UTC # noqa: E402from bench import complexity_report as CR # noqa: E402-from codeverse.contracts.artifacts import Measurement # noqa: E402+from codeverse.contracts.artifacts import Judgment, Measurement # noqa: E402from codeverse.contracts.common import Backends, Language, Track, Usage # noqa: E402-from codeverse.contracts.judgment import Judgment # noqa: E402from codeverse.contracts.plan import BBox, PartPlan, StaticPlan # noqa: E402from codeverse.contracts.run import RoundRecord, RunRecord, RunStatus # noqa: E402from codeverse.contracts.spec import Spec # noqa: E402diff --git a/harness/tests/graphics/test_live.py b/harness/tests/graphics/test_live.pyindex e9372a22..4dc41c98 100644--- a/harness/tests/graphics/test_live.py+++ b/harness/tests/graphics/test_live.py@@ -31,9 +31,9 @@ def keys_ok():def test_live_plan_generate_build_judge(tmp_path, keys_ok):- from codeverse.events import EventLogfrom codeverse.models import get_chat_modelfrom codeverse.orchestrator import RunState+ from codeverse.proc import EventLogfrom codeverse.prompts import renderspec = Spec(id="live_gfx", track=Track.GRAPHICS, language=Language.GLSL_SHADER,diff --git a/harness/tests/graphics/test_track.py b/harness/tests/graphics/test_track.pyindex 0f25fc00..ee9ebc6a 100644--- a/harness/tests/graphics/test_track.py+++ b/harness/tests/graphics/test_track.py@@ -16,11 +16,11 @@ from codeverse.contracts.common import Backends, Budget, Language, Trackfrom codeverse.contracts.plan import GraphicsPlanfrom codeverse.contracts.run import RunStatusfrom codeverse.contracts.spec import Constraints, Spec-from codeverse.events import EventLogfrom codeverse.judges.rubrics import load_rubricfrom codeverse.languages._gl_common import finish_build, judge_times, preview_timesfrom codeverse.languages.glsl_shader.lint import lint_workspacefrom codeverse.languages.glsl_shader.skeleton import write_skeleton+from codeverse.proc import EventLogfrom codeverse.prompts import renderfrom codeverse.spatial.gl_render import GlFrame, GlResultfrom codeverse.tracks import get_trackdiff --git a/harness/tests/judges/test_prompt_builder.py b/harness/tests/judges/test_prompt_builder.pyindex f6b40ab9..ab975d41 100644--- a/harness/tests/judges/test_prompt_builder.py+++ b/harness/tests/judges/test_prompt_builder.py@@ -2,9 +2,16 @@ from pathlib import Pathfrom PIL import Image-from codeverse.contracts.artifacts import GateFinding, GateReport, RenderSet, RenderView, Severity+from codeverse.contracts.artifacts import (+ GateFinding,+ GateReport,+ ImprovementItem,+ Judgment,+ RenderSet,+ RenderView,+ Severity,+)from codeverse.contracts.chat import ImagePart, TextPart-from codeverse.contracts.judgment import ImprovementItem, Judgmentfrom codeverse.judges.prompt_builder import (TEXT_BUDGET_CHARS,build_judge_messages,diff --git a/harness/tests/orchestrator_tracks/fakes.py b/harness/tests/orchestrator_tracks/fakes.pyindex ad1470bd..4582a509 100644--- a/harness/tests/orchestrator_tracks/fakes.py+++ b/harness/tests/orchestrator_tracks/fakes.py@@ -18,6 +18,9 @@ from codeverse.contracts.artifacts import (BuildResult,GateFinding,GateReport,+ ImprovementItem,+ JudgeIssue,+ Judgment,Measurement,PartMeasure,RenderSet,@@ -26,7 +29,6 @@ from codeverse.contracts.artifacts import ()from codeverse.contracts.chat import ChatRequest, ChatResponsefrom codeverse.contracts.common import Language, Usage-from codeverse.contracts.judgment import ImprovementItem, JudgeIssue, Judgmentfrom codeverse.contracts.plan import Planfrom codeverse.contracts.run import RunRecordfrom codeverse.conventions import to_snakediff --git a/harness/tests/orchestrator_tracks/test_budget_snapshot.py b/harness/tests/orchestrator_tracks/test_budget_snapshot.pyindex 66067725..8fdff6e0 100644--- a/harness/tests/orchestrator_tracks/test_budget_snapshot.py+++ b/harness/tests/orchestrator_tracks/test_budget_snapshot.py@@ -20,8 +20,8 @@ import pytestfrom codeverse.contracts.common import Budget, Language, Usagefrom codeverse.contracts.plan import StaticPlanfrom codeverse.contracts.run import RunStatus-from codeverse.events import EventLogfrom codeverse.orchestrator import BudgetExceeded, BudgetGuard, BudgetSnapshot, RunState+from codeverse.proc import EventLogfrom codeverse.tracks.generation import GenerationTask, generate_filesfrom codeverse.tracks.planner import MAX_VALIDATION_REASKS, PlanningErrorfrom codeverse.tracks.planner import plan as run_plannerdiff --git a/harness/tests/orchestrator_tracks/test_candidates_reference_motion.py b/harness/tests/orchestrator_tracks/test_candidates_reference_motion.pyindex 0413b0fd..c23153e6 100644--- a/harness/tests/orchestrator_tracks/test_candidates_reference_motion.py+++ b/harness/tests/orchestrator_tracks/test_candidates_reference_motion.py@@ -11,13 +11,13 @@ from codeverse.contracts.common import Language, Trackfrom codeverse.contracts.plan import ArticulatedPlanfrom codeverse.contracts.run import RunStatusfrom codeverse.contracts.spec import ReferenceImage-from codeverse.events import EventLogfrom codeverse.orchestrator import (RefineTask,RoundPolicy,build_refine_instructions,compact_instructions,)+from codeverse.proc import EventLogfrom codeverse.tracks import get_trackfrom codeverse.tracks.articulated_object import ArticulatedObjectTrack, expected_directionfrom codeverse.tracks.candidates import CandidateRecord, decide_best, rank_candidatesdiff --git a/harness/tests/orchestrator_tracks/test_cost_latency.py b/harness/tests/orchestrator_tracks/test_cost_latency.pyindex c9f453f7..4b366c45 100644--- a/harness/tests/orchestrator_tracks/test_cost_latency.py+++ b/harness/tests/orchestrator_tracks/test_cost_latency.py@@ -13,8 +13,8 @@ from codeverse.config import get_settingsfrom codeverse.contracts.common import Budget, Language, Trackfrom codeverse.contracts.plan import AssetPlan, ScenePlan, ZonePlanfrom codeverse.contracts.run import RunStatus-from codeverse.events import EventLogfrom codeverse.orchestrator import BudgetExceeded, BudgetGuard, RoundPolicy, RunState+from codeverse.proc import EventLogfrom codeverse.tracks.common import RunContextfrom codeverse.tracks.planner import plan_examplefrom codeverse.tracks.scene import SceneTrack, plan_zone_batches, zone_filediff --git a/harness/tests/orchestrator_tracks/test_fewer_turns.py b/harness/tests/orchestrator_tracks/test_fewer_turns.pyindex ceb41836..dbb4c751 100644--- a/harness/tests/orchestrator_tracks/test_fewer_turns.py+++ b/harness/tests/orchestrator_tracks/test_fewer_turns.py@@ -20,8 +20,8 @@ LEG = "import bpy\n\n\ndef build_leg():\n return bpy.context.object # LEG-BOdef _ctx(tmp_path, plan, settings, *, language=Language.BLENDER, agent_id="fake-agent:m"):- from codeverse.events import EventLogfrom codeverse.orchestrator import RunState+ from codeverse.proc import EventLogfrom codeverse.tracks.static_object import StaticObjectTrackfrom codeverse.workspace import Workspacediff --git a/harness/tests/orchestrator_tracks/test_fix_batch2.py b/harness/tests/orchestrator_tracks/test_fix_batch2.pyindex 3983bba9..6a6b0d8a 100644--- a/harness/tests/orchestrator_tracks/test_fix_batch2.py+++ b/harness/tests/orchestrator_tracks/test_fix_batch2.py@@ -7,13 +7,12 @@ from types import SimpleNamespaceimport pytest-from codeverse.contracts.artifacts import BuildResult, GateFinding, GateReport, Severity+from codeverse.contracts.artifacts import BuildResult, GateFinding, GateReport, Judgment, Severityfrom codeverse.contracts.common import Language, Track, Usage-from codeverse.contracts.judgment import Judgmentfrom codeverse.contracts.plan import BBox, PartPlan, ScenePlan, StaticPlanfrom codeverse.contracts.run import RoundRecord, RunStatus-from codeverse.events import EventLogfrom codeverse.orchestrator import RoundPolicy, RunState+from codeverse.proc import EventLogfrom codeverse.prompts import load_textfrom codeverse.tracks.planner import plan_examplefrom codeverse.tracks.scene import SceneTrackdiff --git a/harness/tests/orchestrator_tracks/test_fix_generation.py b/harness/tests/orchestrator_tracks/test_fix_generation.pyindex de1bfce7..e6ceb286 100644--- a/harness/tests/orchestrator_tracks/test_fix_generation.py+++ b/harness/tests/orchestrator_tracks/test_fix_generation.py@@ -5,7 +5,7 @@ from __future__ import annotationsfrom codeverse.contracts.agent import AgentResultfrom codeverse.contracts.chat import ChatResponsefrom codeverse.contracts.common import Usage-from codeverse.events import EventLog+from codeverse.proc import EventLogfrom codeverse.tracks.generation import (GenerationTask,generate_files,diff --git a/harness/tests/orchestrator_tracks/test_generation_depth.py b/harness/tests/orchestrator_tracks/test_generation_depth.pyindex 926c7fa6..94c81995 100644--- a/harness/tests/orchestrator_tracks/test_generation_depth.py+++ b/harness/tests/orchestrator_tracks/test_generation_depth.py@@ -15,12 +15,13 @@ from codeverse.contracts.artifacts import (BuildResult,GateFinding,GateReport,+ ImprovementItem,+ Judgment,Measurement,PartMeasure,Severity,)from codeverse.contracts.common import Language-from codeverse.contracts.judgment import ImprovementItem, Judgmentfrom codeverse.contracts.plan import BBox, PartPlan, StaticPlanfrom codeverse.contracts.run import RoundRecordfrom codeverse.conventions import MAX_TRIS_OBJECT, to_snake@@ -239,8 +240,8 @@ def big_plan(n: int = 11) -> StaticPlan:def _ctx(tmp_path, plan, settings, *, language=Language.THREEJS, agent_id="fake-agent:m"):- from codeverse.events import EventLogfrom codeverse.orchestrator import RunState+ from codeverse.proc import EventLogfrom codeverse.tracks.static_object import StaticObjectTrackfrom codeverse.workspace import Workspacediff --git a/harness/tests/orchestrator_tracks/test_generation_planner_repair.py b/harness/tests/orchestrator_tracks/test_generation_planner_repair.pyindex 7ec29231..6842f1fa 100644--- a/harness/tests/orchestrator_tracks/test_generation_planner_repair.py+++ b/harness/tests/orchestrator_tracks/test_generation_planner_repair.py@@ -8,8 +8,8 @@ import pytestfrom codeverse.contracts.common import Language, Trackfrom codeverse.contracts.plan import ScenePlan, StaticPlan-from codeverse.events import EventLogfrom codeverse.orchestrator import BudgetGuard, RoundPolicy, RunState+from codeverse.proc import EventLogfrom codeverse.tracks.common import RunContextfrom codeverse.tracks.generation import (SINGLE_SHOT_FORMAT,diff --git a/harness/tests/orchestrator_tracks/test_graphics_recipes.py b/harness/tests/orchestrator_tracks/test_graphics_recipes.pyindex 051a5898..99ed3d03 100644--- a/harness/tests/orchestrator_tracks/test_graphics_recipes.py+++ b/harness/tests/orchestrator_tracks/test_graphics_recipes.py@@ -21,13 +21,13 @@ import pytestfrom codeverse.config import Settings, seed_recipes_enabledfrom codeverse.contracts.common import HARNESS_OWNED_SRC, Language, Trackfrom codeverse.contracts.plan import GraphicsPlan-from codeverse.events import EventLogfrom codeverse.languages.file_lint import lint_one_filefrom codeverse.languages.glsl_shader.lint import lint_text, lint_workspacefrom codeverse.languages.glsl_shader.runtime import GlslShaderRuntimefrom codeverse.languages.glsl_shader.skeleton import COMMON_GLSL, write_skeletonfrom codeverse.languages.glsl_shader.wrap import HEADER as WRAP_HEADERfrom codeverse.languages.glsl_shader.wrap import compose, first_error, parse_glsl_log+from codeverse.proc import EventLogfrom codeverse.prompts import load_text, renderfrom codeverse.tracks import graphics as grfrom codeverse.tracks.graphics import (diff --git a/harness/tests/orchestrator_tracks/test_integrations2.py b/harness/tests/orchestrator_tracks/test_integrations2.pyindex c5d6db90..e63da4a8 100644--- a/harness/tests/orchestrator_tracks/test_integrations2.py+++ b/harness/tests/orchestrator_tracks/test_integrations2.py@@ -10,8 +10,8 @@ from codeverse.contracts.artifacts import RenderSet, RenderViewfrom codeverse.contracts.common import Language, Track, Usagefrom codeverse.contracts.plan import ScenePlanfrom codeverse.contracts.run import RunStatus-from codeverse.events import EventLogfrom codeverse.orchestrator import RunState+from codeverse.proc import EventLogfrom codeverse.tracks import get_trackfrom codeverse.tracks.graphics import GraphicsTrackfrom codeverse.tracks.planner import plan_examplediff --git a/harness/tests/orchestrator_tracks/test_orchestrator.py b/harness/tests/orchestrator_tracks/test_orchestrator.pyindex 4ed72c8a..c168fbff 100644--- a/harness/tests/orchestrator_tracks/test_orchestrator.py+++ b/harness/tests/orchestrator_tracks/test_orchestrator.py@@ -7,13 +7,17 @@ import timeimport pytestfrom pydantic import BaseModel-from codeverse.contracts.artifacts import BuildResult, GateFinding, GateReport, Severity+from codeverse.contracts.artifacts import (+ BuildResult,+ GateFinding,+ GateReport,+ ImprovementItem,+ Judgment,+ Severity,+)from codeverse.contracts.common import Budget, Usage-from codeverse.contracts.judgment import ImprovementItem, Judgmentfrom codeverse.contracts.plan import AcceptanceItemfrom codeverse.contracts.run import RoundRecord-from codeverse.events import EventLog-from codeverse.fanout import fan_out, split_resultsfrom codeverse.orchestrator import (BestSelector,BudgetExceeded,@@ -27,6 +31,7 @@ from codeverse.orchestrator import (hash_inputs,plan_parallel_groups,)+from codeverse.proc import EventLog, fan_out, split_results# ----------------------------------------------------------------------------- budgetdiff --git a/harness/tests/orchestrator_tracks/test_prompts_assets.py b/harness/tests/orchestrator_tracks/test_prompts_assets.pyindex b5b85e7a..37ca44f4 100644--- a/harness/tests/orchestrator_tracks/test_prompts_assets.py+++ b/harness/tests/orchestrator_tracks/test_prompts_assets.py@@ -8,8 +8,8 @@ import pytestfrom codeverse.contracts.common import Language, Trackfrom codeverse.contracts.plan import ArticulatedPlan, ScenePlan-from codeverse.events import EventLogfrom codeverse.orchestrator import BudgetGuard, RoundPolicy, RunState+from codeverse.proc import EventLogfrom codeverse.prompts import list_prompts, renderfrom codeverse.tracks.common import RunContextfrom codeverse.tracks.generation import SINGLE_SHOT_FORMATdiff --git a/harness/tests/orchestrator_tracks/test_refactor_batch2.py b/harness/tests/orchestrator_tracks/test_refactor_batch2.pyindex 3bbcb169..63c0fc31 100644--- a/harness/tests/orchestrator_tracks/test_refactor_batch2.py+++ b/harness/tests/orchestrator_tracks/test_refactor_batch2.py@@ -7,8 +7,8 @@ from codeverse.contracts.common import Language, Trackfrom codeverse.contracts.plan import ScenePlanfrom codeverse.contracts.run import RunStatusfrom codeverse.contracts.spec import RunOptions-from codeverse.events import EventLogfrom codeverse.orchestrator import RefineTask, RunState, plan_refine_groups+from codeverse.proc import EventLogfrom codeverse.tracks.planner import plan_examplefrom codeverse.tracks.scene import ScenePipeline, SceneTrackfrom codeverse.tracks.static_object import StaticObjectTrackdiff --git a/harness/tests/orchestrator_tracks/test_resume_reconcile.py b/harness/tests/orchestrator_tracks/test_resume_reconcile.pyindex 1356eb60..827b02f8 100644--- a/harness/tests/orchestrator_tracks/test_resume_reconcile.py+++ b/harness/tests/orchestrator_tracks/test_resume_reconcile.py@@ -14,8 +14,8 @@ from types import SimpleNamespaceimport pytestfrom codeverse.contracts.common import Language-from codeverse.events import EventLogfrom codeverse.orchestrator import RoundPolicy, RunState+from codeverse.proc import EventLogfrom codeverse.tracks.lifecycle import SpecChangedfrom codeverse.tracks.static_object import StaticObjectTrackfrom codeverse.workspace import Workspacediff --git a/harness/tests/orchestrator_tracks/test_round_economics.py b/harness/tests/orchestrator_tracks/test_round_economics.pyindex 5bd768d4..077b6bd6 100644--- a/harness/tests/orchestrator_tracks/test_round_economics.py+++ b/harness/tests/orchestrator_tracks/test_round_economics.py@@ -19,11 +19,9 @@ import jsonimport pytestfrom codeverse.contracts.agent import AgentJob, AgentResult-from codeverse.contracts.artifacts import BuildResult, GateFinding, GateReport, Severity+from codeverse.contracts.artifacts import BuildResult, GateFinding, GateReport, Judgment, Severityfrom codeverse.contracts.common import Language, Usage-from codeverse.contracts.judgment import Judgmentfrom codeverse.contracts.run import RoundRecord, RunStatus-from codeverse.events import EventLogfrom codeverse.orchestrator import (DEFAULT_JUDGE_SIGMA,REWRITE_KIND,@@ -33,6 +31,7 @@ from codeverse.orchestrator import (judge_sigma,last_gain,)+from codeverse.proc import EventLogfrom codeverse.tracks.generation import (DEFAULT_AGENT_MAX_TURNS,GenerationTask,@@ -516,7 +515,7 @@ def test_fan_out_workers_inherit_the_callers_context():default just because it ran on a pool thread."""import contextvars- from codeverse.fanout import fan_out+ from codeverse.proc import fan_outvar: contextvars.ContextVar[str] = contextvars.ContextVar("attr", default="process-default")var.set("run-42")diff --git a/harness/tests/orchestrator_tracks/test_tracks.py b/harness/tests/orchestrator_tracks/test_tracks.pyindex 0417688f..a0f696ed 100644--- a/harness/tests/orchestrator_tracks/test_tracks.py+++ b/harness/tests/orchestrator_tracks/test_tracks.py@@ -9,8 +9,8 @@ import pytestfrom codeverse.contracts.common import Language, Trackfrom codeverse.contracts.plan import ArticulatedPlan, ScenePlanfrom codeverse.contracts.run import RunRecord, RunStatus-from codeverse.events import EventLogfrom codeverse.orchestrator import RoundPolicy, RunState+from codeverse.proc import EventLogfrom codeverse.tracks import get_trackfrom codeverse.tracks.articulated_object import ArticulatedObjectTrackfrom codeverse.tracks.planner import plan_examplediff --git a/harness/tests/orchestrator_tracks/test_write_scope.py b/harness/tests/orchestrator_tracks/test_write_scope.pyindex c5f8faea..e3c1e1ec 100644--- a/harness/tests/orchestrator_tracks/test_write_scope.py+++ b/harness/tests/orchestrator_tracks/test_write_scope.py@@ -10,14 +10,13 @@from __future__ import annotations-from codeverse.contracts.artifacts import BuildResult, Measurement, PartMeasure+from codeverse.contracts.artifacts import BuildResult, Judgment, Measurement, PartMeasurefrom codeverse.contracts.chat import ChatResponsefrom codeverse.contracts.common import Language, Track, Usage-from codeverse.contracts.judgment import Judgmentfrom codeverse.contracts.plan import BBox, PartPlan, ScenePlan, StaticPlanfrom codeverse.contracts.run import RoundRecord-from codeverse.events import EventLogfrom codeverse.orchestrator import RefineTask, RunState, TaskGroup+from codeverse.proc import EventLogfrom codeverse.tracks.generation import (GenerationResult,GenerationTask,diff --git a/harness/tests/reference/test_run_and_cli.py b/harness/tests/reference/test_run_and_cli.pyindex b755341c..c65e084c 100644--- a/harness/tests/reference/test_run_and_cli.py+++ b/harness/tests/reference/test_run_and_cli.py@@ -8,7 +8,7 @@ from pathlib import Pathfrom typer.testing import CliRunnerfrom codeverse.contracts.spec import ReferenceImage-from codeverse.events import EventLog+from codeverse.proc import EventLogfrom codeverse.reference import SYNTH_TAG, ground_specfrom codeverse.workspace import Workspacefrom tests.reference.conftest import GOOD_GATE, PROMPT_PLAN, FakeChat, FakeImageModel, make_specdiff --git a/harness/tests/texturing/conftest.py b/harness/tests/texturing/conftest.pyindex 0a9a2370..c4faf683 100644--- a/harness/tests/texturing/conftest.py+++ b/harness/tests/texturing/conftest.py@@ -12,10 +12,9 @@ import pytestimport trimeshfrom PIL import Image-from codeverse.contracts.artifacts import RenderSet, RenderView+from codeverse.contracts.artifacts import Judgment, RenderSet, RenderViewfrom codeverse.contracts.chat import ChatResponsefrom codeverse.contracts.common import Language, Track, Usage-from codeverse.contracts.judgment import Judgmentfrom codeverse.contracts.plan import BBox, PartPlan, StaticPlanfrom codeverse.contracts.spec import Specfrom codeverse.texturing.generate import FakeImageModel