tenseleyflow/loader / 47db0c5

Browse files

Advance first empty child retry

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
47db0c5d3f5e6ed3958393efb3f2f079217619f0
Parents
d37b2b4
Tree
e6467a6

2 changed files

StatusFile+-
M src/loader/runtime/repair.py 1 3
M tests/test_repair.py 12 12
src/loader/runtime/repair.pymodified
@@ -383,8 +383,6 @@ class ResponseRepairer:
383383
         retry_number: int,
384384
         max_empty_retries: int,
385385
     ) -> str | None:
386
-        if retry_number < 2:
387
-            return None
388386
         if not self._has_confirmed_output_file_progress(dod):
389387
             return None
390388
         if self._has_confirmed_substantive_output_file_progress(dod):
@@ -1588,7 +1586,7 @@ class ResponseRepairer:
15881586
         retry_number: int,
15891587
         outline_label: str | None,
15901588
     ) -> str | None:
1591
-        if not require_first_substantive_output or retry_number < 2:
1589
+        if not require_first_substantive_output or retry_number < 1:
15921590
             return None
15931591
         if target.suffix.lower() not in {".html", ".htm"}:
15941592
             return None
tests/test_repair.pymodified
@@ -1367,7 +1367,7 @@ def test_compact_first_substantive_retry_reuses_known_reference_structure(
13671367
     )
13681368
 
13691369
 
1370
-def test_first_substantive_retry_activates_on_second_empty_turn(
1370
+def test_first_substantive_retry_activates_on_first_empty_turn(
13711371
     temp_dir: Path,
13721372
 ) -> None:
13731373
     context = build_context(
@@ -1431,7 +1431,7 @@ def test_first_substantive_retry_activates_on_second_empty_turn(
14311431
     decision = repairer.handle_empty_response(
14321432
         task="Create a multi-file nginx guide.",
14331433
         original_task=None,
1434
-        empty_retry_count=2,
1434
+        empty_retry_count=1,
14351435
         max_empty_retries=4,
14361436
         dod=dod,
14371437
     )
@@ -1663,16 +1663,13 @@ def test_empty_response_retry_points_at_declared_child_file_within_incomplete_ou
16631663
 
16641664
     assert decision.should_continue is True
16651665
     assert decision.retry_message is not None
1666
-    assert "Next missing planned artifact: `introduction.html`" in decision.retry_message
16671666
     assert (
1668
-        "Resume with this exact next step: continue `Write the introduction chapter` "
1669
-        "by creating `introduction.html`."
1667
+        "Continue `Write the introduction chapter` by creating `introduction.html`."
16701668
         in decision.retry_message
16711669
     )
16721670
     assert "Next declared output under `chapters/`" not in decision.retry_message
16731671
     assert (
1674
-        f"Prefer one `write(content=...)` call for `{(chapters / 'introduction.html').resolve(strict=False)}` "
1675
-        "before more research."
1672
+        f'Emit this tool shape now: `write(file_path="{display_runtime_path(chapters / "introduction.html")}", content="...")`.'
16761673
         in decision.retry_message
16771674
     )
16781675
 
@@ -2374,15 +2371,18 @@ def test_empty_response_retry_names_next_file_from_observed_sibling_directory(
23742371
 
23752372
     assert decision.should_continue is True
23762373
     assert decision.retry_message is not None
2377
-    assert "Next missing planned artifact: `01-introduction.html`" in decision.retry_message
23782374
     assert (
2379
-        "Resume with this exact next step: continue `Write the introduction chapter` "
2380
-        "by creating `01-introduction.html`."
2375
+        "Continue `Write the introduction chapter` by creating `01-introduction.html`."
2376
+        in decision.retry_message
2377
+    )
2378
+    assert (
2379
+        f'Emit this tool shape now: `write(file_path="{display_runtime_path(chapters / "01-introduction.html")}", content="...")`.'
23812380
         in decision.retry_message
23822381
     )
23832382
     assert "Next observed output pattern under `chapters/`" not in decision.retry_message
23842383
     assert (
2385
-        "It mirrors the observed filename pattern from another `chapters/` directory "
2386
-        "you already inspected."
2384
+        f"You already read `{display_runtime_path(reference_chapters / '01-introduction.html')}`; "
2385
+        "reuse its overall structure as the starting pattern for this new file, then adapt the "
2386
+        "content to the current target."
23872387
         in decision.retry_message
23882388
     )