Keep broad content steps pending
Authored by
mfwolffe <wolffemf@dukes.jmu.edu>
- SHA
9c5b6091f017b422b6c16c720b19bae2b3effd5d- Parents
-
7e3369e - Tree
060b985
9c5b609
9c5b6091f017b422b6c16c720b19bae2b3effd5d7e3369e
060b985| Status | File | + | - |
|---|---|---|---|
| M |
src/loader/runtime/workflow.py
|
32 | 0 |
| M |
tests/test_workflow.py
|
35 | 0 |
src/loader/runtime/workflow.pymodified@@ -1476,6 +1476,8 @@ def _todo_progress_score(item: str, tool_call: ToolCall) -> int: | ||
| 1476 | 1476 | if "directory" in text and "mkdir" in command: |
| 1477 | 1477 | score += 2 |
| 1478 | 1478 | elif name in {"write", "edit", "patch"}: |
| 1479 | + if _todo_describes_broad_content_generation_step(text, basename): | |
| 1480 | + return 0 | |
| 1479 | 1481 | if _todo_describes_aggregate_mutation(text) and basename and basename not in text: |
| 1480 | 1482 | return 0 |
| 1481 | 1483 | if _contains_any(text, _MUTATION_STEP_HINTS): |
@@ -1509,6 +1511,7 @@ def _is_summary_artifact_name(name: str) -> bool: | ||
| 1509 | 1511 | def _todo_describes_aggregate_mutation(text: str) -> bool: |
| 1510 | 1512 | return ( |
| 1511 | 1513 | _contains_any(text, _AGGREGATE_TODO_HINTS) |
| 1514 | + or _todo_describes_broad_content_generation_step(text, "") | |
| 1512 | 1515 | or _todo_mentions_plural_output_set(text) |
| 1513 | 1516 | ) and _contains_any( |
| 1514 | 1517 | text, |
@@ -1516,6 +1519,35 @@ def _todo_describes_aggregate_mutation(text: str) -> bool: | ||
| 1516 | 1519 | ) |
| 1517 | 1520 | |
| 1518 | 1521 | |
| 1522 | +def _todo_describes_broad_content_generation_step( | |
| 1523 | + text: str, | |
| 1524 | + basename: str, | |
| 1525 | +) -> bool: | |
| 1526 | + if basename and basename in text: | |
| 1527 | + return False | |
| 1528 | + if _TODO_FILE_CANDIDATE_PATTERN.search(text): | |
| 1529 | + return False | |
| 1530 | + if not _contains_any(text, _MUTATION_STEP_HINTS): | |
| 1531 | + return False | |
| 1532 | + if not _contains_any(text, _CONTENT_EVIDENCE_HINTS): | |
| 1533 | + return False | |
| 1534 | + return any( | |
| 1535 | + token in text | |
| 1536 | + for token in ( | |
| 1537 | + "guide", | |
| 1538 | + "tutorial", | |
| 1539 | + "documentation", | |
| 1540 | + "docs", | |
| 1541 | + "manual", | |
| 1542 | + "website", | |
| 1543 | + "site", | |
| 1544 | + "content", | |
| 1545 | + "pattern", | |
| 1546 | + "structure", | |
| 1547 | + ) | |
| 1548 | + ) | |
| 1549 | + | |
| 1550 | + | |
| 1519 | 1551 | def todo_describes_aggregate_mutation(item: str) -> bool: |
| 1520 | 1552 | """Return True when a todo describes a broad multi-artifact mutation step.""" |
| 1521 | 1553 | |
tests/test_workflow.pymodified@@ -1014,6 +1014,41 @@ def test_advance_todos_from_tool_call_keeps_plural_chapter_creation_step_pending | ||
| 1014 | 1014 | assert "Create chapter files following the established pattern" in dod.pending_items |
| 1015 | 1015 | |
| 1016 | 1016 | |
| 1017 | +def test_advance_todos_from_tool_call_keeps_broad_guide_content_step_pending() -> None: | |
| 1018 | + dod = create_definition_of_done("Create a multi-file nginx guide.") | |
| 1019 | + sync_todos_to_definition_of_done( | |
| 1020 | + dod, | |
| 1021 | + [ | |
| 1022 | + { | |
| 1023 | + "content": "Develop the nginx guide content following the established pattern", | |
| 1024 | + "active_form": "Working on: Develop the nginx guide content following the established pattern", | |
| 1025 | + "status": "pending", | |
| 1026 | + }, | |
| 1027 | + { | |
| 1028 | + "content": "Ensure consistency in formatting, structure, and content approach", | |
| 1029 | + "active_form": "Working on: Ensure consistency in formatting, structure, and content approach", | |
| 1030 | + "status": "pending", | |
| 1031 | + }, | |
| 1032 | + ], | |
| 1033 | + ) | |
| 1034 | + | |
| 1035 | + assert ( | |
| 1036 | + advance_todos_from_tool_call( | |
| 1037 | + dod, | |
| 1038 | + ToolCall( | |
| 1039 | + id="write-index", | |
| 1040 | + name="write", | |
| 1041 | + arguments={ | |
| 1042 | + "file_path": "/tmp/nginx/index.html", | |
| 1043 | + "content": "<html></html>", | |
| 1044 | + }, | |
| 1045 | + ), | |
| 1046 | + ) | |
| 1047 | + is False | |
| 1048 | + ) | |
| 1049 | + assert "Develop the nginx guide content following the established pattern" in dod.pending_items | |
| 1050 | + | |
| 1051 | + | |
| 1017 | 1052 | def test_advance_todos_from_tool_call_tracks_bash_directory_creation_progress() -> None: |
| 1018 | 1053 | dod = create_definition_of_done("Create a multi-file nginx guide.") |
| 1019 | 1054 | sync_todos_to_definition_of_done( |