Official Codebase of 3DCodeVerse
Python
flywheel caption: --model defaults to Settings.default_captioner — a configured captioner was ignored (B8)
gaoypeng0a0eb7821478
diff --git a/harness/codeverse3d/cli/flywheel_cmd.py b/harness/codeverse3d/cli/flywheel_cmd.pyindex 98f591b4..36760b6d 100644--- a/harness/codeverse3d/cli/flywheel_cmd.py+++ b/harness/codeverse3d/cli/flywheel_cmd.py@@ -95,7 +95,7 @@ def refine_cmd(@flywheel_app.command("caption")def caption_cmd(target: Annotated[str, typer.Argument(help="run slug/dir, or a runs root with --all")],- model: Annotated[str, typer.Option("--model")] = "gemini:gemini-3.7-flash",+ model: Annotated[str | None, typer.Option("--model", help="default: Settings.default_captioner")] = None,all_runs: Annotated[bool, typer.Option("--all", help="caption every un-captioned run under target")] = False,force: Annotated[bool, typer.Option("--force", help="re-caption even if captions exist")] = False,runs_dir: Annotated[Path | None, typer.Option("--runs-dir")] = None,@@ -104,10 +104,12 @@ def caption_cmd("""Caption run(s): {detailed, instruction, factory} via a chat model."""from codeverse3d.addons.dataset.captions import CaptionError, caption_samplefrom codeverse3d.addons.dataset.export import load_captions+ from codeverse3d.config import get_settingsfrom codeverse3d.cost.instrument import run_ledgerfrom codeverse3d.proc import RunLocked, exclusivefrom codeverse3d.record.record import iter_runs, load_record+ model = model or get_settings().default_captionerif all_runs:targets = [(fr.ws, fr.record, fr.run_id.slug)for fr in iter_runs(target, on_error=lambda d, e: warn(f"skip {d.name}: {e}"))]diff --git a/harness/tests/flywheel_cli/test_cli.py b/harness/tests/flywheel_cli/test_cli.pyindex cef42b52..0c5fcb16 100644--- a/harness/tests/flywheel_cli/test_cli.py+++ b/harness/tests/flywheel_cli/test_cli.py@@ -4,6 +4,7 @@ from __future__ import annotationsimport jsonfrom pathlib import Path+from types import SimpleNamespaceimport pytestfrom typer.testing import CliRunner@@ -512,3 +513,17 @@ def test_render_only_labels_the_working_tree_round(tmp_path: Path):assert "working tree, which is at round 4" in msg and "3dcode pick" in msg and ei.value.exit_code == 2assert _render_round_or_refuse(ws, 4) == 4, "rendering the tree's own round is fine"assert _render_round_or_refuse(_round_guard_ws(tmp_path / "b", tree=1), None) == 1+++def test_flywheel_caption_defaults_to_the_configured_captioner(runs_dir: Path, monkeypatch):+ """No --model: Settings.default_captioner, not a literal the CLI kept (a configured one was ignored)."""+ import codeverse3d.addons.dataset.captions as cap+ from codeverse3d.config import get_settings++ seen: list[str] = []+ monkeypatch.setattr(get_settings(), "default_captioner", "fake:configured")+ monkeypatch.setattr(cap, "caption_sample", lambda ws, rec, model, **kw: seen.append(model) or SimpleNamespace(instruction="x"))+ r = runner.invoke(app, ["flywheel", "caption", "wooden_chair_ab12cd34", "--runs-dir", str(runs_dir), "--out",+ str(runs_dir.parent / "side")])+ assert r.exit_code == 0, r.output+ assert seen == ["fake:configured"]