Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/autoskillit/cli/_prompts_orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ def _build_orchestrator_prompt(
- classify_fix: "error:" line present in output

FAILURE PREDICATE β€” open_kitchen:
If the open_kitchen response contains `"success": false` OR does not
contain the substring `--- INGREDIENTS TABLE ---`:
If the open_kitchen response contains `"success": false` OR `"ingredients_table"`: null
(field absent or null in the JSON response):
1. Extract and print the value of "user_visible_message" from the
JSON response verbatim (fall back to the raw response text if
parsing fails).
Expand Down
4 changes: 2 additions & 2 deletions src/autoskillit/fleet/_prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ def _build_food_truck_prompt(
- classify_fix: "error:" line present in output

FAILURE PREDICATE β€” open_kitchen:
If the open_kitchen response contains `"success": false` OR does not
contain the substring `--- INGREDIENTS TABLE ---`:
If the open_kitchen response contains `"success": false` OR `"ingredients_table"`: null
(field absent or null in the JSON response):
1. Emit the sentinel block with success=false and reason="open_kitchen_failed".
2. End the session.

Expand Down
8 changes: 4 additions & 4 deletions tests/cli/test_orchestrator_prompt_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ def test_prompt_open_kitchen_predicate_forbids_askuserquestion(self):
section = prompt[idx : idx + 500]
assert "DO NOT call AskUserQuestion" in section

def test_open_kitchen_predicate_uses_substring_not_json_field_dispatch(self):
"""Negative: the predicate block must NOT use JSON-field dispatch phrasing."""
def test_open_kitchen_predicate_uses_json_field_not_substring(self):
"""The predicate block must use JSON-field check, not substring marker."""
prompt = _get_prompt()
idx = prompt.index("FAILURE PREDICATE β€” open_kitchen")
section = prompt[idx : idx + 500]
assert "json.loads" not in section.lower()
assert "parsed[" not in section
assert "--- INGREDIENTS TABLE ---" not in section
assert "ingredients_table" in section


class TestStep0ToolPredicateCoverage:
Expand Down
17 changes: 17 additions & 0 deletions tests/fleet/test_food_truck_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,20 @@ def test_food_truck_prompt_no_caller_instructions_section_when_empty():
caller_instructions="",
)
assert "CALLER INSTRUCTIONS" not in prompt


def test_food_truck_open_kitchen_predicate_uses_json_field_not_substring():
"""Food truck predicate must use JSON-field check, not substring marker."""
prompt = _build_food_truck_prompt(
recipe="test-recipe",
task="Test task",
ingredients={},
mcp_prefix=DIRECT_PREFIX,
dispatch_id="test-dispatch",
campaign_id="test-campaign",
l3_timeout_sec=300,
)
idx = prompt.index("FAILURE PREDICATE β€” open_kitchen")
section = prompt[idx : idx + 500]
assert "--- INGREDIENTS TABLE ---" not in section
assert "ingredients_table" in section
Loading