Files
aigc-home/calliope-backend/tests/test_render_intent.py
T
Benjiyaya 6bd8ce1190 fix: release 1.5.5 - swarm renders enqueue, scenes get written, the board fills
Live event logs (session 908) showed a planner-scheduled render task whose
tools were hidden by the HITL visibility rule, a story sub-agent denied the
add_scene tools the planner told it to use, deep-linked chats orphaning as
duplicate empty sessions, and new project assets missing from the canvas
until re-open. Render-intent now recognizes clip/shot/storyboard; sub-agent
payloads keep approval-gated tools visible (permission stays at the
execute-time guard, whose denial teaches ask_user); the story role owns
scene structure; the canvas deep-link session param is trusted; GET
/api/canvas/{id} auto-seeds new entity cards.
2026-09-22 03:48:57 +08:00

55 lines
2.4 KiB
Python

"""Regression tests for render-intent detection (policy.is_render_request).
The failure that motivated this: "all 20 scenes use this text2video workflow.
Do not overthinking, no image need." read as NON-render (compound word
"text2video" unmatched + a message-global negation veto from "Do not"/"no"),
so the registry hid enqueue_video_jobs/run_workflow, and the agent — unable
to say why — fabricated job ids instead of admitting the tools were hidden.
"""
from __future__ import annotations
import pytest
from calliope.agent.harness.policy import is_render_request
@pytest.mark.parametrize(
("text", "want"),
[
# The exact messages from the canvas/62 incident
("all 20 scenes use this text2video workflow. Do not overthinking, no image need.", True),
("you are not doing the job go away", False),
# Compound / model-name cues
("make a text2video clip of the establishing shot", True),
("txt2vid for scene 3 please", True),
("use fastvideoH3_t2v-API for all 20 scenes", True),
("image-to-video on scene 2", True),
# Negation must stay authoritative when it governs the render cue
("do not generate videos", False),
("no images please", False),
("don't render anything", False),
("no render, just fix the script", False),
("i said do not render", False),
# …but a negated clause must not veto an unrelated render clause
("fix the script but render afterwards", True),
("no image need, render all scenes", True),
# Plain positive cues
("render all scenes now", True),
("yes, generate the images", True),
# Clip/shot are render-unit nouns (session 908: "shot clips" left the
# video sub-agent's enqueue tools hidden → "generation tool is not
# exposed")
("Break the beats into the 8-scene script + shot clips", True),
("break scene 3 into clips", True),
("render the shots for scene 2", True),
# Non-render text must not flip positive
("generate the story", False),
("provide the lyrics", False),
# 'clip' as a noun of speech ("clip the beard") is not a cue — but the
# verb is rare in film asks; keep the broad match and rely on
# clause-scoped negation for safety.
],
)
def test_render_intent(text: str, want: bool):
assert is_render_request(text) is want, text