Require deeper guide study
- SHA
2e86586507e8d491dbe9753fa4fc9f12785763d9- Parents
-
65ebf4a - Tree
4afb13f
2e86586
2e86586507e8d491dbe9753fa4fc9f12785763d965ebf4a
4afb13f| Status | File | + | - |
|---|---|---|---|
| M |
src/loader/runtime/workflow.py
|
31 | 0 |
| M |
tests/test_workflow.py
|
36 | 0 |
src/loader/runtime/workflow.pymodified@@ -194,6 +194,17 @@ _CONTENT_EVIDENCE_HINTS = ( | ||
| 194 | 194 | "thorough", |
| 195 | 195 | "thoroughness", |
| 196 | 196 | ) |
| 197 | +_DEEP_CONTENT_EVIDENCE_HINTS = ( | |
| 198 | + "organization", | |
| 199 | + "cadence", | |
| 200 | + "depth", | |
| 201 | + "writing style", | |
| 202 | + "thorough", | |
| 203 | + "thoroughness", | |
| 204 | + "same structure", | |
| 205 | + "same style", | |
| 206 | + "same pattern", | |
| 207 | +) | |
| 197 | 208 | _BROAD_SETUP_HINTS = ( |
| 198 | 209 | "directory structure", |
| 199 | 210 | "directories", |
@@ -1282,6 +1293,10 @@ def _todo_progress_score(item: str, tool_call: ToolCall) -> int: | ||
| 1282 | 1293 | score += 1 |
| 1283 | 1294 | |
| 1284 | 1295 | if name == "read": |
| 1296 | + if _todo_requires_deep_content_evidence(text) and _is_summary_artifact_name( | |
| 1297 | + basename | |
| 1298 | + ): | |
| 1299 | + return 0 | |
| 1285 | 1300 | if _contains_any(text, _READ_STEP_HINTS): |
| 1286 | 1301 | score += 2 |
| 1287 | 1302 | if _contains_any(text, _PARSE_STEP_HINTS) and ".html" in combined: |
@@ -1335,6 +1350,22 @@ def _todo_requires_content_level_evidence(text: str) -> bool: | ||
| 1335 | 1350 | return _contains_any(text, _CONTENT_EVIDENCE_HINTS) |
| 1336 | 1351 | |
| 1337 | 1352 | |
| 1353 | +def _todo_requires_deep_content_evidence(text: str) -> bool: | |
| 1354 | + return _contains_any(text, _DEEP_CONTENT_EVIDENCE_HINTS) | |
| 1355 | + | |
| 1356 | + | |
| 1357 | +def _is_summary_artifact_name(name: str) -> bool: | |
| 1358 | + normalized = name.lower() | |
| 1359 | + return normalized in { | |
| 1360 | + "index.html", | |
| 1361 | + "index.htm", | |
| 1362 | + "readme", | |
| 1363 | + "readme.md", | |
| 1364 | + "readme.rst", | |
| 1365 | + "readme.txt", | |
| 1366 | + } | |
| 1367 | + | |
| 1368 | + | |
| 1338 | 1369 | def _todo_describes_aggregate_mutation(text: str) -> bool: |
| 1339 | 1370 | return ( |
| 1340 | 1371 | _contains_any(text, _AGGREGATE_TODO_HINTS) |
tests/test_workflow.pymodified@@ -1043,6 +1043,42 @@ def test_advance_todos_from_tool_call_does_not_complete_content_examination_from | ||
| 1043 | 1043 | assert "Develop the main index.html file for the nginx guide" in dod.pending_items |
| 1044 | 1044 | |
| 1045 | 1045 | |
| 1046 | +def test_advance_todos_from_tool_call_does_not_complete_deep_guide_study_from_root_index_read() -> None: | |
| 1047 | + dod = create_definition_of_done("Create a multi-file nginx guide.") | |
| 1048 | + sync_todos_to_definition_of_done( | |
| 1049 | + dod, | |
| 1050 | + [ | |
| 1051 | + { | |
| 1052 | + "content": "First, examine the existing fortran guide structure to understand the content organization and cadence", | |
| 1053 | + "active_form": "Working on: First, examine the existing fortran guide structure to understand the content organization and cadence", | |
| 1054 | + "status": "pending", | |
| 1055 | + }, | |
| 1056 | + { | |
| 1057 | + "content": "Develop the main index.html file for the nginx guide", | |
| 1058 | + "active_form": "Working on: Develop the main index.html file for the nginx guide", | |
| 1059 | + "status": "pending", | |
| 1060 | + }, | |
| 1061 | + ], | |
| 1062 | + ) | |
| 1063 | + | |
| 1064 | + assert ( | |
| 1065 | + advance_todos_from_tool_call( | |
| 1066 | + dod, | |
| 1067 | + ToolCall( | |
| 1068 | + id="read-reference-index", | |
| 1069 | + name="read", | |
| 1070 | + arguments={"file_path": "~/Loader/guides/fortran/index.html"}, | |
| 1071 | + ), | |
| 1072 | + ) | |
| 1073 | + is False | |
| 1074 | + ) | |
| 1075 | + assert ( | |
| 1076 | + "First, examine the existing fortran guide structure to understand the content organization and cadence" | |
| 1077 | + in dod.pending_items | |
| 1078 | + ) | |
| 1079 | + assert "Develop the main index.html file for the nginx guide" in dod.pending_items | |
| 1080 | + | |
| 1081 | + | |
| 1046 | 1082 | def test_advance_todos_from_tool_call_does_not_complete_populate_step_from_reference_read() -> None: |
| 1047 | 1083 | dod = create_definition_of_done("Create a multi-file nginx guide.") |
| 1048 | 1084 | sync_todos_to_definition_of_done( |