Work that took under retro_minutes (5) from sisi done, passed every check and delegated nothing closes without a retro
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6a5ed356a2
commit
927eb1bb0b
5 files changed
+35
-6
No files matched your search
@@ -96,7 +96,7 @@ its limits are.
|
||||
|
||||
Settings go under `"core"` in `config.json` in your store: `gate`, `meter`, `direct_calls` (8),
|
||||
`direct_extension` (8), `rules_lines` (30), `rules_chars` (4000), `organize_after` (8), `research_days` (7),
|
||||
`shell_workers` (false). Workers are started with the host's own delegation tool, so by default a shell command
|
||||
`shell_workers` (false), `retro_minutes` (5: work that passed every check, delegated nothing and took less than this many minutes from `sisi done` closes without a retro). Workers are started with the host's own delegation tool, so by default a shell command
|
||||
that starts a worker (`opencode`, `muse`, `agy`: the first word of a command line in your models table) is
|
||||
refused. Set `"shell_workers": true` to allow it: it is then free on the meter, and needs a pick like any
|
||||
delegation, and `sisi pick` prints the command line.
|
||||
+3
-2
@@ -204,9 +204,10 @@ def gate(p, for_subagent=False):
|
||||
unsaid = ["%d. %s" % (i, c["text"]) for i, c in enumerate(checks, 1) if not c["verdict"]]
|
||||
failed = [str(i) for i, c in enumerate(checks, 1) if c["verdict"] == "fail"]
|
||||
worked = s.get("changed") or store.snapshot(cwd) != s.get("snapshot")
|
||||
if checks and not unsaid and not failed and not worked:
|
||||
quick = time.time() - (s.get("done") or {}).get("at", 0) < 60 * store.config()["retro_minutes"] and not s.get("delegations_since")
|
||||
if checks and not unsaid and not failed and (not worked or quick):
|
||||
from . import retro
|
||||
retro.record(s, cwd, {}) # every check passed and nothing changed: the work closes itself
|
||||
retro.record(s, cwd, {}) # every check passed and nothing changed, or it was quick and alone: the work closes itself
|
||||
return 0
|
||||
reason = "" if unsaid and models.waiting(s) else OPEN % "; ".join(unsaid) if unsaid else GATE if worked else FAILED % ", ".join(failed) if failed else ""
|
||||
if not reason or s.get("blocks", 0) >= 2:
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ def done(args, cwd=None):
|
||||
return 1
|
||||
with store.session(sid) as s:
|
||||
if new:
|
||||
s["done"] = {"goal": opt["goal"][0], "next": opt["next"][0],
|
||||
s["done"] = {"goal": opt["goal"][0], "next": opt["next"][0], "at": time.time(),
|
||||
"checks": [{"text": c, "verdict": None, "evidence": ""} for c in opt["check"]]}
|
||||
elif verdict:
|
||||
kind, n, why = verdict
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ LIB = os.environ.get("SISI_LIB") or os.path.join(HOME, ".local", "lib", "sisi")
|
||||
# Every setting there is. The person overrides one under "core" in config.json in their store.
|
||||
DEFAULTS = {"gate": True, "meter": True, "direct_calls": 8, "direct_extension": 8,
|
||||
"rules_lines": 30, "rules_chars": 4000, "organize_after": 8, "research_days": 7, "shell_workers": False,
|
||||
"worker_minutes": 15}
|
||||
"worker_minutes": 15, "retro_minutes": 5}
|
||||
|
||||
|
||||
def config():
|
||||
|
||||
+29
-1
@@ -1449,6 +1449,34 @@ class Core(unittest.TestCase):
|
||||
self.hook("prompt", prompt="judged")
|
||||
self.assertIn("no verdict yet", self.hook("gate")[1]) # judged: no delegation open again
|
||||
|
||||
def test_a_retro_is_not_demanded_for_quick_work_that_passed_and_delegated_nothing(self):
|
||||
self.table(WORKERS)
|
||||
def work(sid, minutes, fail=False, delegate=False):
|
||||
self.hook("tick", sid=sid)
|
||||
self.hook("prompt", sid=sid, prompt="go")
|
||||
self.done(sid)
|
||||
self.tool("Edit", sid=sid) # the work changed things
|
||||
if delegate:
|
||||
self.assertEqual((self.sisi("pick", "hard", sid=sid)[0], self.tool("Agent", sid=sid, tool_input={"model": "sonnet"})[0]), (0, 0))
|
||||
self.assertEqual(self.sisi("done", "--pass", "1", "counts equal at 120 rows", sid=sid)[0], 0)
|
||||
self.assertEqual(self.sisi("done", "--fail" if fail else "--pass", "2", "the row was dropped" if fail else "empty name kept", sid=sid)[0], 0)
|
||||
path = os.path.join(self.tmp, "state", "core-sessions", sid + ".json")
|
||||
with open(path, "r+") as f:
|
||||
st = json.load(f)
|
||||
st["done"]["at"] = time.time() - minutes * 60 # the done was recorded this long ago
|
||||
f.seek(0), f.truncate(), json.dump(st, f)
|
||||
return self.hook("gate", sid=sid)[1]
|
||||
self.assertEqual(work("a", 4), "") # 4 minutes, all passed, no delegation: closed
|
||||
self.assertEqual(len(self.records()), 1)
|
||||
self.assertNotIn("gap", self.records()[0])
|
||||
self.assertIn("no retro yet", work("b", 6)) # 6 minutes: the retro
|
||||
self.assertIn("no retro yet", work("c", 4, fail=True)) # a failed check: the retro
|
||||
self.assertIn("no retro yet", work("d", 4, delegate=True)) # a delegation: the retro
|
||||
self.assertEqual(len(self.records()), 1)
|
||||
self.write(os.path.join(self.data, "config.json"), json.dumps({"core": {"retro_minutes": 10}}))
|
||||
self.assertEqual(work("e", 6), "") # the limit is a setting
|
||||
self.assertEqual(len(self.records()), 2)
|
||||
|
||||
def test_the_spec_is_unchanged(self):
|
||||
for line in self.read(REPO, "docs", "spec", "SHA256SUMS").splitlines():
|
||||
digest, rel = line.split()
|
||||
@@ -1457,7 +1485,7 @@ class Core(unittest.TestCase):
|
||||
|
||||
def test_the_product_stays_small(self):
|
||||
code = sum(len(self.read(p).splitlines()) for p in glob.glob(os.path.join(REPO, "sisi", "*.py")))
|
||||
self.assertLess(code, 1504, "sisi is two loops. If it needs more than this, find the simpler shape.")
|
||||
self.assertLess(code, 1511, "sisi is two loops. If it needs more than this, find the simpler shape.")
|
||||
rulebook = self.read(REPO, "canon", "core.md")
|
||||
self.assertLess(len(rulebook.splitlines()), 120)
|
||||
self.assertLess(len(rulebook), 8212)
|
||||
|
||||
Reference in new issue
Block a user