Fix Krea2 atlas cue prompt formatting

This commit is contained in:
2026-06-30 22:01:03 +02:00
parent ff484aa27c
commit 337bbb10f1
7 changed files with 366 additions and 10 deletions
+108
View File
@@ -6843,6 +6843,11 @@ def smoke_krea2_pov_atlas_variant_prompt_routes() -> None:
for cue in variant.get("prompt_cues") or []:
cue_text = _expect_text(f"{key}.prompt_cue", cue, 8).lower()
_expect(cue_text in prompt, f"{key} final Krea prompt lost atlas cue {cue_text!r}: {prompt}")
atlas_action_prompt = prompt.split(" camera is ", 1)[0]
_expect(
"; " not in atlas_action_prompt,
f"{key} final Krea prompt kept semicolon-delimited atlas cue formatting: {prompt}",
)
_expect(
"framed as " not in prompt and "the image is framed as " not in prompt,
f"{key} final Krea prompt kept generic composition text after atlas route: {prompt}",
@@ -6871,10 +6876,12 @@ def smoke_krea2_pov_atlas_variant_prompt_routes() -> None:
):
_expect(forbidden not in prompt, f"{key} final Krea prompt kept generic detail fragment {forbidden!r}: {prompt}")
for required in (
"the woman kneels directly below the viewer between his feet",
"mouth seals around the centered shaft",
"one hand wraps the base",
):
_expect(required in prompt, f"{key} final Krea prompt lost compact contact cue {required!r}: {prompt}")
_expect("one woman" not in prompt, f"{key} final Krea prompt split the subject with 'one woman': {prompt}")
for avoid in variant.get("avoid_cues") or []:
avoid_text = _expect_text(f"{key}.avoid_cue", avoid, 4).lower()
_expect(avoid_text not in prompt, f"{key} final Krea prompt leaked avoid cue {avoid_text!r}: {prompt}")
@@ -10394,6 +10401,106 @@ def smoke_sxcp_mcp_client_cli_policy() -> None:
_expect("--arguments-json" in call_help.stdout, "sxcp MCP client help lost JSON argument option")
def smoke_watch_prompt_image_folder_cli_policy() -> None:
helper_path = ROOT / "tools" / "watch_prompt_image_folder.sh"
_expect(helper_path.exists(), "watch prompt/image folder helper is missing")
_expect(helper_path.stat().st_mode & 0o111, "watch prompt/image folder helper must be executable")
help_result = subprocess.run(
[str(helper_path), "--help"],
cwd=ROOT,
capture_output=True,
text=True,
check=False,
)
_expect(help_result.returncode == 0, f"watch helper --help failed: {help_result.stderr}")
for term in ("--folder", "--target", "--notes", "--once", "--dry-run", "tmux send-keys"):
_expect(term in help_result.stdout, f"watch helper help lost {term!r}")
with tempfile.TemporaryDirectory() as temp_dir:
folder = Path(temp_dir)
prompt_path = folder / "atlas_case_001.txt"
image_path = folder / "atlas_case_001.png"
state_path = folder / "seen.state"
notes_path = folder / "prompt-learning.md"
prompt_path.write_text("nadir-angle standing male POV test prompt\n", encoding="utf-8")
image_path.write_bytes(b"fake-png")
first_scan = subprocess.run(
[
str(helper_path),
"--folder",
str(folder),
"--target",
"codex:1.0",
"--notes",
str(notes_path),
"--state",
str(state_path),
"--once",
"--dry-run",
],
cwd=ROOT,
capture_output=True,
text=True,
check=False,
)
_expect(first_scan.returncode == 0, f"watch helper dry-run scan failed: {first_scan.stderr}")
_expect("tmux send-keys -t codex:1.0" in first_scan.stdout, "watch helper dry-run did not render tmux target")
_expect(str(prompt_path) in first_scan.stdout, "watch helper notification lost prompt path")
_expect(str(image_path) in first_scan.stdout, "watch helper notification lost image path")
_expect(str(notes_path) in first_scan.stdout, "watch helper notification lost notes path")
_expect("atlas_case_001.txt" in state_path.read_text(encoding="utf-8"), "watch helper did not record notified prompt")
second_scan = subprocess.run(
[
str(helper_path),
"--folder",
str(folder),
"--target",
"codex:1.0",
"--notes",
str(notes_path),
"--state",
str(state_path),
"--once",
"--dry-run",
],
cwd=ROOT,
capture_output=True,
text=True,
check=False,
)
_expect(second_scan.returncode == 0, f"watch helper repeated dry-run scan failed: {second_scan.stderr}")
_expect("no new prompt/image pairs" in second_scan.stdout, "watch helper should dedupe already-notified pairs")
jpeg_prompt = folder / "atlas_case_002.prompt"
jpeg_image = folder / "atlas_case_002.jpg"
jpeg_prompt.write_text("side-profile oral prompt\n", encoding="utf-8")
jpeg_image.write_bytes(b"fake-jpg")
third_scan = subprocess.run(
[
str(helper_path),
"--folder",
str(folder),
"--target",
"codex:1.0",
"--notes",
str(notes_path),
"--state",
str(state_path),
"--once",
"--dry-run",
],
cwd=ROOT,
capture_output=True,
text=True,
check=False,
)
_expect(third_scan.returncode == 0, f"watch helper jpeg dry-run scan failed: {third_scan.stderr}")
_expect(str(jpeg_prompt) in third_scan.stdout and str(jpeg_image) in third_scan.stdout, "watch helper lost prompt/JPEG pairing")
def smoke_sxcp_prompt_batch_cli_policy() -> None:
helper_path = ROOT / "tools" / "sxcp_prompt_batch.py"
eval_loop_doc = (ROOT / "docs" / "sxcp-eval-loop.md").read_text(encoding="utf-8")
@@ -12180,6 +12287,7 @@ SMOKE_CASES: list[tuple[str, Callable[[], None]]] = [
("seed_config_policy", smoke_seed_config_policy),
("prompt_route_simulation_policy", smoke_prompt_route_simulation_policy),
("sxcp_mcp_client_cli_policy", smoke_sxcp_mcp_client_cli_policy),
("watch_prompt_image_folder_cli_policy", smoke_watch_prompt_image_folder_cli_policy),
("sxcp_prompt_batch_cli_policy", smoke_sxcp_prompt_batch_cli_policy),
("node_camera_registration", smoke_node_camera_registration),
("node_route_config_registration", smoke_node_route_config_registration),