Skip to content

Official Codebase of 3DCodeVerse

Python

prompts: guard turn_discipline with 'is defined' — live workers render new templates with old context

gaoypengeb0f756a4b17
diff --git a/harness/codeverse/prompts/tracks/assemble_static.j2 b/harness/codeverse/prompts/tracks/assemble_static.j2
index cca1a269..3111e1a6 100644
--- a/harness/codeverse/prompts/tracks/assemble_static.j2
+++ b/harness/codeverse/prompts/tracks/assemble_static.j2
@@ -26,7 +26,7 @@ Overall bbox: {{ overall_bbox }}
2. Run `build`. Fix every build/lint error. An error inside a part file that stops the whole build
IS yours to fix — make the smallest change that makes it build.
3. Run `measure`. Compare each measured part box with the table above.
-4. {% if turn_discipline %}Read the CONNECTIVITY and CONTRACT sections of the `build` result (it runs both checks for you){% else %}Run `check_connectivity` and `check_contract`{% endif %}. Every ERROR must be gone before you finish:
+4. {% if turn_discipline is defined and turn_discipline %}Read the CONNECTIVITY and CONTRACT sections of the `build` result (it runs both checks for you){% else %}Run `check_connectivity` and `check_contract`{% endif %}. Every ERROR must be gone before you finish:
- a **floating** part → move it (or its neighbour) so the surfaces overlap by 2–5 mm;
- an **interpenetrating** pair → pull one back to its plan box;
- a **missing** part → the builder was not called, or it built under a parent Empty
@@ -47,7 +47,7 @@ Overall bbox: {{ overall_bbox }}
## Tools
{{ tool_cards }}
{% endif %}
-{% if turn_discipline %}
+{% if turn_discipline is defined and turn_discipline %}
{{ turn_discipline }}
{% endif %}
diff --git a/harness/codeverse/prompts/tracks/generate_static.j2 b/harness/codeverse/prompts/tracks/generate_static.j2
index 54d4c7d8..f4f0efae 100644
--- a/harness/codeverse/prompts/tracks/generate_static.j2
+++ b/harness/codeverse/prompts/tracks/generate_static.j2
@@ -79,7 +79,7 @@ Construction notes per part:
## Tools available to you
{{ tool_cards }}
{% endif %}
-{% if turn_discipline %}
+{% if turn_discipline is defined and turn_discipline %}
{{ turn_discipline }}
{% endif %}
diff --git a/harness/codeverse/prompts/tracks/generate_static_part.j2 b/harness/codeverse/prompts/tracks/generate_static_part.j2
index fba4ca40..e8a0664a 100644
--- a/harness/codeverse/prompts/tracks/generate_static_part.j2
+++ b/harness/codeverse/prompts/tracks/generate_static_part.j2
@@ -61,7 +61,7 @@ Run `build` after writing your files and fix every error it reports before you f
compiles the WHOLE object, so an error in someone else's file is not yours to fix — fix only errors
that name your files.
{% endif %}
-{% if turn_discipline %}
+{% if turn_discipline is defined and turn_discipline %}
{{ turn_discipline }}
{% endif %}
diff --git a/harness/codeverse/prompts/tracks/refine_object.j2 b/harness/codeverse/prompts/tracks/refine_object.j2
index 51ab1fff..90a51128 100644
--- a/harness/codeverse/prompts/tracks/refine_object.j2
+++ b/harness/codeverse/prompts/tracks/refine_object.j2
@@ -62,7 +62,7 @@ Files in scope: {% for f in files %}`{{ f }}`{% if not loop.last %}, {% endif %}
{{ tool_cards }}
Run `build` after editing and fix any error before finishing.
{% endif %}
-{% if turn_discipline %}
+{% if turn_discipline is defined and turn_discipline %}
## Turn discipline (every tool call is a full round trip — spend as few as you can)
- Make the edits first (the files above are current), then call `build` once; it already runs
diff --git a/harness/docs/RUNBOOK.md b/harness/docs/RUNBOOK.md
index f12b83bf..21f8ed0c 100644
--- a/harness/docs/RUNBOOK.md
+++ b/harness/docs/RUNBOOK.md
@@ -195,6 +195,15 @@ parks until it recovers instead; `--no-preflight` skips the check. Cells that a
provider outage kills anyway are recorded `infra_failed`, excluded from every rate,
and re-run with `--redo-status infra_failed` (see `docs/EVAL.md` §7).
+### 7.v Templates are read at render time — a new required variable breaks live workers like a moved name
+
+Measured 2026-08-26 13:45: the fewer-turns landing added `{{ turn_discipline }}` to four static
+templates; the four h2h drivers started 50 minutes earlier still ran the old python (no such
+context key) but rendered the NEW template from disk → `UndefinedError: 'turn_discipline' is
+undefined`, four prompts recorded `error` at 0 min. Rule: every new template variable is
+guarded `{% if name is defined and name %}` for at least one wave, and the "Landing source
+changes while a wave is running" rule covers `codeverse/prompts/**` as well as moved names.
+
### 7.w One driver per out dir — a second `bench run` re-runs what the first is still running
Measured 2026-08-26 (refs_v1_graphics): a redo driver (`--redo-status budget`) started while the