From c537f4a809a564ecdab0380bcb356018f79a6900 Mon Sep 17 00:00:00 2001 From: godosa Date: Wed, 7 Oct 2026 17:15:33 +0200 Subject: orch: lane cloud parks a stuck task (Cloud: no), keeps picking Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01JEAjUkQRrCYX5MZhWxdtj2 --- tests/test_cloud.py | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'tests/test_cloud.py') diff --git a/tests/test_cloud.py b/tests/test_cloud.py index e922f9c..3ac184a 100644 --- a/tests/test_cloud.py +++ b/tests/test_cloud.py @@ -1,6 +1,7 @@ import datetime as dt import io import json +import re import os import shutil import sys @@ -1163,12 +1164,42 @@ class OrchCloud(CloudProject): out = self.orch("pick", "cloud") self.assertIn("stop lane cloud: none fit (project not opted in", out) - def test_post_handback_commits_and_stops(self): + def test_post_handback_parks_and_picks_next(self): self.orch("pick", "cloud", "--id", "t-slow") self.ok("note", "t-slow", "Recovery: cloud attempt x — red") # what wf cloud pull leaves behind self.ok("status", "t-slow", "clear") out = self.orch("post", "t-slow", "cloud", "--result", "handback") self.assertIn("post: t-slow handback", out) self.assertIn("committed leftover", out) - self.assertIn("stop lane cloud: handback", out) + self.assertIn("alert: t-slow handback → tell the owner (Cloud: no", out) + self.assertIn("lane cloud keeps picking", out) + self.assertNotIn("stop lane cloud: handback", out) + self.assertIn("pick: t-yes (lane cloud", out) # next pick, not a re-send + self.assertNotIn("pick: t-slow", out) self.assertIn(" cloud opus t-slow handback ", (self.root / "out" / "wf-orch.log").read_text()) + body = (self.root / "TASKS.md").read_text().split("**t-slow**")[1].split("\n- **")[0] + self.assertIn("Cloud: no", body) + self.assertNotIn("Sessions: owner", body) # local lanes may still retry it + out = self.orch("pick", "cloud") + self.assertIn("stop lane cloud: none fit", out) # t-slow never re-sent + led = json.loads((self.d / "xdg" / "wf" / "cloud.json").read_text()) + self.assertEqual([e["id"] for e in led["entries"]], ["t-slow", "t-yes"]) + self.assertIn("pick: t-slow", self.orch("pick", "slow", "--id", "t-slow")) + + def test_post_awaiting_parks_and_picks_next(self): + self.orch("pick", "cloud", "--id", "t-slow") + hdr = self.ok("add", "-s", "awaiting", "which way? [[t-slow]]") # what wf cloud pull does + a = re.search(r"\*\*(a-[^*]+)\*\*", hdr)[1] + self.ok("status", "t-slow", "blocked", a) + out = self.orch("post", "t-slow", "cloud", "--result", f"awaiting {a}") + self.assertIn(f"alert: t-slow awaiting → tell the owner (already blocked: [[{a}]])", out) + self.assertIn("pick: t-yes (lane cloud", out) + self.assertIn(f"blocked: [[{a}]]", self.status("t-slow")) + self.assertIn("stop lane cloud: none fit", self.orch("pick", "cloud")) + + def test_post_lost_parks_too(self): + self.orch("pick", "cloud", "--id", "t-yes") + self.ok("status", "t-yes", "clear") + out = self.orch("post", "t-yes", "cloud", "--result", "lost") + self.assertIn("alert: t-yes lost → tell the owner (Cloud: no", out) + self.assertIn("pick: t-slow (lane cloud", out) -- cgit