Require content evidence for discovery
- SHA
365993c7af1df867fde065ad20e89b921564c1bd- Parents
-
5f39d46 - Tree
c50603f
365993c
365993c7af1df867fde065ad20e89b921564c1bd5f39d46
c50603f| Status | File | + | - |
|---|---|---|---|
| M |
src/loader/runtime/workflow.py
|
16 | 0 |
| M |
tests/test_workflow.py
|
36 | 0 |
src/loader/runtime/workflow.pymodified@@ -186,6 +186,14 @@ _ARTIFACT_SET_COMPLETION_HINTS = ( | ||
| 186 | 186 | "same structure", |
| 187 | 187 | "follow the same", |
| 188 | 188 | ) |
| 189 | +_CONTENT_EVIDENCE_HINTS = ( | |
| 190 | + "content", | |
| 191 | + "cadence", | |
| 192 | + "depth", | |
| 193 | + "writing style", | |
| 194 | + "thorough", | |
| 195 | + "thoroughness", | |
| 196 | +) | |
| 189 | 197 | _BROAD_SETUP_HINTS = ( |
| 190 | 198 | "directory structure", |
| 191 | 199 | "directories", |
@@ -1279,6 +1287,8 @@ def _todo_progress_score(item: str, tool_call: ToolCall) -> int: | ||
| 1279 | 1287 | if _contains_any(text, _PARSE_STEP_HINTS) and ".html" in combined: |
| 1280 | 1288 | score += 1 |
| 1281 | 1289 | elif name in {"glob", "grep"}: |
| 1290 | + if _todo_requires_content_level_evidence(text): | |
| 1291 | + return 0 | |
| 1282 | 1292 | if not ( |
| 1283 | 1293 | _contains_any(text, _SEARCH_STEP_HINTS) |
| 1284 | 1294 | or _contains_any(text, _READ_STEP_HINTS) |
@@ -1294,6 +1304,8 @@ def _todo_progress_score(item: str, tool_call: ToolCall) -> int: | ||
| 1294 | 1304 | if _contains_any(text, _VERIFY_STEP_HINTS): |
| 1295 | 1305 | score += 3 |
| 1296 | 1306 | elif _looks_like_search_command(command): |
| 1307 | + if _todo_requires_content_level_evidence(text): | |
| 1308 | + return 0 | |
| 1297 | 1309 | if _contains_any(text, _SEARCH_STEP_HINTS): |
| 1298 | 1310 | score += 2 |
| 1299 | 1311 | elif _looks_like_read_command(command): |
@@ -1319,6 +1331,10 @@ def _contains_any(text: str, candidates: tuple[str, ...]) -> bool: | ||
| 1319 | 1331 | return any(candidate in text for candidate in candidates) |
| 1320 | 1332 | |
| 1321 | 1333 | |
| 1334 | +def _todo_requires_content_level_evidence(text: str) -> bool: | |
| 1335 | + return _contains_any(text, _CONTENT_EVIDENCE_HINTS) | |
| 1336 | + | |
| 1337 | + | |
| 1322 | 1338 | def _todo_describes_aggregate_mutation(text: str) -> bool: |
| 1323 | 1339 | return ( |
| 1324 | 1340 | _contains_any(text, _AGGREGATE_TODO_HINTS) |
tests/test_workflow.pymodified@@ -1007,6 +1007,42 @@ def test_advance_todos_from_tool_call_does_not_complete_develop_step_from_refere | ||
| 1007 | 1007 | assert "Develop the main index.html file for the nginx guide" in dod.pending_items |
| 1008 | 1008 | |
| 1009 | 1009 | |
| 1010 | +def test_advance_todos_from_tool_call_does_not_complete_content_examination_from_shallow_glob() -> None: | |
| 1011 | + dod = create_definition_of_done("Create a multi-file nginx guide.") | |
| 1012 | + sync_todos_to_definition_of_done( | |
| 1013 | + dod, | |
| 1014 | + [ | |
| 1015 | + { | |
| 1016 | + "content": "First, examine the existing fortran guide structure and content", | |
| 1017 | + "active_form": "Working on: First, examine the existing fortran guide structure and content", | |
| 1018 | + "status": "pending", | |
| 1019 | + }, | |
| 1020 | + { | |
| 1021 | + "content": "Develop the main index.html file for the nginx guide", | |
| 1022 | + "active_form": "Working on: Develop the main index.html file for the nginx guide", | |
| 1023 | + "status": "pending", | |
| 1024 | + }, | |
| 1025 | + ], | |
| 1026 | + ) | |
| 1027 | + | |
| 1028 | + assert ( | |
| 1029 | + advance_todos_from_tool_call( | |
| 1030 | + dod, | |
| 1031 | + ToolCall( | |
| 1032 | + id="glob-reference-root", | |
| 1033 | + name="glob", | |
| 1034 | + arguments={"path": "~/Loader/guides/fortran", "pattern": "**"}, | |
| 1035 | + ), | |
| 1036 | + ) | |
| 1037 | + is False | |
| 1038 | + ) | |
| 1039 | + assert ( | |
| 1040 | + "First, examine the existing fortran guide structure and content" | |
| 1041 | + in dod.pending_items | |
| 1042 | + ) | |
| 1043 | + assert "Develop the main index.html file for the nginx guide" in dod.pending_items | |
| 1044 | + | |
| 1045 | + | |
| 1010 | 1046 | def test_advance_todos_from_tool_call_does_not_complete_populate_step_from_reference_read() -> None: |
| 1011 | 1047 | dod = create_definition_of_done("Create a multi-file nginx guide.") |
| 1012 | 1048 | sync_todos_to_definition_of_done( |