Official Codebase of 3DCodeVerse
Python
cost: docstrings stop pointing at the reconstruction and the cost.round event
gaoypeng7df4a07a22a7
diff --git a/harness/codeverse3d/cost/ledger.py b/harness/codeverse3d/cost/ledger.pyindex 61b1385d..83f0eb22 100644--- a/harness/codeverse3d/cost/ledger.py+++ b/harness/codeverse3d/cost/ledger.py@@ -243,7 +243,7 @@ def record_call(from codeverse3d.cost import record_callrecord_call(res.usage, run=ws.slug, round=idx, stage="baseline",- role="generator", ledger=ws.root / "cost_ledger.jsonl")+ role="generator", ledger=ws.root / "telemetry" / "cost.jsonl")Anything the caller leaves out (``run`` / ``round`` / ``stage`` / ``role``) isresolved from the ambient run context and the call label — see@@ -301,8 +301,8 @@ def load_ledger(path: str | Path, *, include_attempts: bool = False) -> list[Cal``source="attempt"`` rows (one per round-trip, ``instrument.MeteredChatModel``)are left out unless ``include_attempts=True``: their tokens are already on the- call's logical row, so every aggregate built on this reader (``summarise``,- ``reconstruct``, the CLI) keeps counting each call exactly once. This is the ONLY+ call's logical row, so every aggregate built on this reader (``summarise``, a run's+ ``total_usage``, the cost audit) keeps counting each call exactly once. This is the ONLYplace that filter lives — ``summarise`` used to repeat it, which made``include_attempts=True`` summarise to $0. Paid-but-discarded round-trips are``source="extra"`` instead and always count: nothing else records them."""diff --git a/harness/codeverse3d/cost/types.py b/harness/codeverse3d/cost/types.pyindex 44b988ac..5bfe9b69 100644--- a/harness/codeverse3d/cost/types.py+++ b/harness/codeverse3d/cost/types.py@@ -1,8 +1,8 @@"""Typed rows and buckets for the cost ledger / audit.One :class:`CallCost` = one billable model or agent call. Rows are written-append-only (``ledger.py``), reconstructed from old runs (``reconstruct.py``)-and aggregated into :class:`Summary` buckets (``ledger.summarise``).+append-only (``ledger.py``) and aggregated into :class:`Summary` buckets+(``ledger.summarise``).Nothing here imports the orchestrator or the tracks: the cost package is aleaf so any caller (track, judge, texturing, bench script) can use it.@@ -74,8 +74,8 @@ _LABEL_STAGES: tuple[tuple[str, Stage], ...] = (("baseline", Stage.BASELINE),("refine", Stage.REFINE),# the static track's surface-detail round (labels "detail" / "detail_<scope>") was a- # refine pass under another name. The round went on 2026-09-22; the row stays so the- # runs that recorded one still reconstruct its sessions as refine, not "other".+ # refine pass under another name. The round went on 2026-09-22; the row stays so a+ # label of a run that recorded one still reads as refine, not "other".("detail", Stage.REFINE),("candidate", Stage.CANDIDATE),("cand", Stage.CANDIDATE),diff --git a/harness/codeverse3d/record/record.py b/harness/codeverse3d/record/record.pyindex 72ee90ab..4fa52064 100644--- a/harness/codeverse3d/record/record.py+++ b/harness/codeverse3d/record/record.py@@ -255,7 +255,7 @@ RUN_SEARCH_DEPTH = 7BATTERY_MARKERS = ("runs", "cells", "arms")#: run-layout directories that hold a SUB-workspace (a scene asset candidate, a rejected#: best-of-N candidate): their files belong to that sub-run, not to the run above them.-#: ``cost.reconstruct.find_runs`` and the bench survey scripts skip them by this one name.+#: ``addons.costreport.audit.find_runs`` and the bench survey scripts skip them by this one name.SUBRUN_DIRS: frozenset[str] = frozenset({"_cand", "_assets"})diff --git a/harness/codeverse3d/tracks/generation.py b/harness/codeverse3d/tracks/generation.pyindex 780f1343..f42687d0 100644--- a/harness/codeverse3d/tracks/generation.py+++ b/harness/codeverse3d/tracks/generation.py@@ -580,9 +580,7 @@ def run_agent_task(if turn_capped(res):# the turns are gone, the money is not wasted: ask for a landing, not more work- if events is not None:- # NB: not ``cost_usd`` — an event carrying that key is priced as its own- # call by ``cost.reconstruct``, and this money is already in the session row.+ if events is not None: # (the money itself is the session's ledger row)events.emit("generate.turn_cap",label=task.label,@@ -706,7 +704,7 @@ def _is_budget_stop(e: BaseException) -> bool:def session_turns(res: Any) -> int:"""``AgentResult.turns`` — the count as the BACKEND reports it (0 for gemini-cli,which exposes none). Backends count turns slightly differently, so this is a- size signal for the ``cost.round`` event, not the number the turn cap is compared+ size signal (the ``generate.turn_cap`` event), not the number the turn cap is comparedagainst — that one is enforced inside the session by ``job.max_turns``. (Until2026-08-29 this re-read result.json for a ``turns`` key only the deleted api-agentwrote, so ``agent_turns`` was 0 for every vendor CLI.)"""