tenseleyflow/loader / 365993c

Browse files

Require content evidence for discovery

Authored by espadonne
SHA
365993c7af1df867fde065ad20e89b921564c1bd
Parents
5f39d46
Tree
c50603f

2 changed files

StatusFile+-
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 = (
186186
     "same structure",
187187
     "follow the same",
188188
 )
189
+_CONTENT_EVIDENCE_HINTS = (
190
+    "content",
191
+    "cadence",
192
+    "depth",
193
+    "writing style",
194
+    "thorough",
195
+    "thoroughness",
196
+)
189197
 _BROAD_SETUP_HINTS = (
190198
     "directory structure",
191199
     "directories",
@@ -1279,6 +1287,8 @@ def _todo_progress_score(item: str, tool_call: ToolCall) -> int:
12791287
         if _contains_any(text, _PARSE_STEP_HINTS) and ".html" in combined:
12801288
             score += 1
12811289
     elif name in {"glob", "grep"}:
1290
+        if _todo_requires_content_level_evidence(text):
1291
+            return 0
12821292
         if not (
12831293
             _contains_any(text, _SEARCH_STEP_HINTS)
12841294
             or _contains_any(text, _READ_STEP_HINTS)
@@ -1294,6 +1304,8 @@ def _todo_progress_score(item: str, tool_call: ToolCall) -> int:
12941304
             if _contains_any(text, _VERIFY_STEP_HINTS):
12951305
                 score += 3
12961306
         elif _looks_like_search_command(command):
1307
+            if _todo_requires_content_level_evidence(text):
1308
+                return 0
12971309
             if _contains_any(text, _SEARCH_STEP_HINTS):
12981310
                 score += 2
12991311
         elif _looks_like_read_command(command):
@@ -1319,6 +1331,10 @@ def _contains_any(text: str, candidates: tuple[str, ...]) -> bool:
13191331
     return any(candidate in text for candidate in candidates)
13201332
 
13211333
 
1334
+def _todo_requires_content_level_evidence(text: str) -> bool:
1335
+    return _contains_any(text, _CONTENT_EVIDENCE_HINTS)
1336
+
1337
+
13221338
 def _todo_describes_aggregate_mutation(text: str) -> bool:
13231339
     return (
13241340
         _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
10071007
     assert "Develop the main index.html file for the nginx guide" in dod.pending_items
10081008
 
10091009
 
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
+
10101046
 def test_advance_todos_from_tool_call_does_not_complete_populate_step_from_reference_read() -> None:
10111047
     dod = create_definition_of_done("Create a multi-file nginx guide.")
10121048
     sync_todos_to_definition_of_done(