Answer product-owner round 2: 0 🔴, 1 🟡 (0 misread); exit 0 on awaited merges, so the finished chunk's window closes and the next run reads the plan

This commit is contained in:
Lilleman
2026-11-19 23:30:30 +01:00
parent 1a23aa05b0
commit 356ae263e1
6 changed files with 34 additions and 19 deletions
+4 -2
View File
@@ -11,10 +11,10 @@ import unittest.mock
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2]))
from chunk_driver.doubles import a_loop
from loop_claude.loop import chunk_windows, main, reload, usage
from loop_effects.doubles import CWD, FakeEffects, ran, STAMP
from failure import Failure
from agent_cycle.verdicts import Finished, Unfinished
from loop_claude.loop import main, reload, usage
from loop_claude.doubles import OPUS_PROJECT
from loop_state import paths
from model_routing.route import Route
@@ -240,6 +240,7 @@ class WindowStarts(unittest.TestCase):
def test_stops_where_no_chunk_could_start(self):
self.assertEqual(self.run_loop(["do it"], FakeEffects(git=["/r\n"]), started=Failure("no plan"))[0], Stop(1, "no plan"))
self.assertEqual(self.run_loop(["do it"], FakeEffects(git=["/r\n"]), started=chunk_windows.AwaitedMerges("#7 awaits a merge."))[0], Stop(0, "#7 awaits a merge."), "nothing failed, so the stop exits 0")
def test_stops_where_tmux_cannot_show_the_session(self):
fake = FakeEffects(git=["/r\n"])
@@ -260,7 +261,8 @@ class WindowStarts(unittest.TestCase):
def test_a_finished_chunk_starts_each_chunk_that_may_start_and_stops_without_a_reason(self):
loop_run = main.LoopRun(4, "/r", "do it", "", chunk="item-7")
for started, said, stop in ((["item-9", "item-12"], "the chunk finished; started item-9, item-12", Stop(0, "")), ([], "the chunk finished; started no other, since the chunks running fill what may run now", Stop(0, "")),
(Failure("no plan"), "", Stop(1, "the chunk finished, but the next could not start: no plan"))):
(Failure("no plan"), "", Stop(1, "the chunk finished, but the next could not start: no plan")),
(chunk_windows.AwaitedMerges("#7 awaits a merge."), "", Stop(0, "the chunk finished; #7 awaits a merge."))):
with self.subTest(started=started), contextlib.redirect_stdout(io.StringIO()) as printed:
loop, asked = a_loop(FakeEffects().effects(), env={"LOOP_CLAUDE_X": "1"}), []
self.assertEqual(main.handed_on(loop_run, loop, lambda *args: asked.append(args) or started), stop)