Skip to content

Official Codebase of 3DCodeVerse

Python

workspace: one owner for .gitignore lines; INTERFACES records ArtifactStage/glb_path

gaoypeng77b855811976
diff --git a/harness/codeverse/tracks/candidates.py b/harness/codeverse/tracks/candidates.py
index ab411527..16965acf 100644
--- a/harness/codeverse/tracks/candidates.py
+++ b/harness/codeverse/tracks/candidates.py
@@ -61,7 +61,7 @@ def run_best_of_n(track: Any, ctx: RunContext, tasks: Sequence[GenerationTask],
"""Baseline round with ``ctx.policy.n_candidates`` parallel candidates; returns the r00 record."""
n = max(1, ctx.policy.n_candidates)
ctx.events.emit("candidates.start", round=0, n=n, parallel=min(n, ctx.settings.limits.max_parallel_agents))
- _ignore_candidates(ctx.ws)
+ ctx.ws.ensure_gitignore() # legacy run dirs may predate _cand/ in the standard lines
subs = [make_candidate_context(track, ctx, k) for k in range(n)]
def _one(k: int) -> tuple[CandidateRecord, RenderSet | None]:
@@ -281,12 +281,6 @@ def adopt_candidate(ctx: RunContext, sub_ws: Workspace) -> None:
shutil.copytree(sub_ws.trajectories, ctx.ws.trajectories, dirs_exist_ok=True)
-def _ignore_candidates(ws: Workspace) -> None:
- gi = ws.root / ".gitignore"
- text = gi.read_text() if gi.is_file() else ""
- if f"{CAND_DIR}/" not in text:
- gi.write_text(text.rstrip("\n") + f"\n{CAND_DIR}/\n")
-
# ----------------------------------------------------------------------------- best round (pairwise tie-break)
def choose_best_round(ctx: RunContext, rounds: list[RoundRecord], selector: BestSelector, new_index: int) -> int | None:
diff --git a/harness/codeverse/tracks/scene_assets.py b/harness/codeverse/tracks/scene_assets.py
index c04b1c52..6625f49e 100644
--- a/harness/codeverse/tracks/scene_assets.py
+++ b/harness/codeverse/tracks/scene_assets.py
@@ -129,7 +129,7 @@ def run_asset_stage(ctx: RunContext, *, judge_assets: bool = True) -> dict[str,
ctx.extra["asset_alias"] = alias
if not assets:
return {}
- _ignore_sub_workspaces(ctx.ws)
+ ctx.ws.ensure_gitignore() # legacy run dirs may predate _assets/ in the standard lines
def _one(asset: AssetPlan) -> AssetResult:
if asset.kind == "blender_glb":
@@ -408,9 +408,3 @@ def _read(ws: Workspace, rel: str, limit: int = 30_000) -> str:
p = ws.root / rel
return p.read_text(errors="replace")[:limit] if p.is_file() else ""
-
-def _ignore_sub_workspaces(ws: Workspace) -> None:
- gi = ws.root / ".gitignore"
- text = gi.read_text() if gi.is_file() else ""
- if "_assets/" not in text:
- gi.write_text(text.rstrip("\n") + "\n_assets/\n")
diff --git a/harness/codeverse/workspace.py b/harness/codeverse/workspace.py
index c59923e1..27bbf366 100644
--- a/harness/codeverse/workspace.py
+++ b/harness/codeverse/workspace.py
@@ -50,7 +50,7 @@ LAYOUT_ALIASES: tuple[tuple[str, str], ...] = (
#: harness-owned paths that never belong in the code snapshot
_GITIGNORE_LINES = (
"# harness-owned run state is never part of the code snapshot",
- "artifacts/", "trajectories/", "stages/", "rounds/", "_assets/", ".3dcv/", ".gemini/", ".claude/",
+ "artifacts/", "trajectories/", "stages/", "rounds/", "_assets/", "_cand/", ".3dcv/", ".gemini/", ".claude/",
"deliverable/", "telemetry/", "evidence", "captions.json",
"events.jsonl", "run_state.json", "record.json", "*.log", "node_modules/", "*.tmp", "__pycache__/",
)
diff --git a/harness/docs/INTERFACES.md b/harness/docs/INTERFACES.md
index 319e1faa..a0931e8f 100644
--- a/harness/docs/INTERFACES.md
+++ b/harness/docs/INTERFACES.md
@@ -45,6 +45,11 @@ append_jsonl_line(path, rec, lock) -> None # one json.dumps(ensu
```
`Spec.options` is plan-hash safe (`plan_stage_inputs` whitelists spec fields).
`Workspace.write_json` delegates to `proc.write_json_atomic`.
+`Workspace.stage_artifacts(*names) -> ArtifactStage` (2026-08-27): enter invalidates the
+canonical `artifacts/` names, writes land under `artifacts/.staging/<pid-nonce>/`,
+`promote()` `os.replace`s on success, exit-without-promote discards — canonical always
+means the last OK build. `Workspace.restore_paths(commit, paths)` = per-path
+`git checkout <commit> -- <paths>` under the per-root lock.
## models/
```python
@@ -223,6 +228,10 @@ in the message instead of failing obscurely; `parse_node_version` / `node_versio
are the pure helpers `3dcv doctor` reuses for its `node` row.
## spatial/
+
+`tool_common.glb_path` refuses (`ToolUsageError`) when the newest of
+`build_last.json`/`build.json` says the last build failed — tools never measure or
+texture a stale GLB; missing/unreadable status stays permissive (hand-placed GLBs).
```python
from codeverse.spatial.render import render_glb, render_turntable
render_glb(glb, out_dir, *, views=None, mode="shaded|wire|normals|silhouette|clay", width=768, height=768,