Merge branch 'offered-fixtures' into offered-join

This commit is contained in:
swaits committed 2026-12-03 07:38:51 -07:00
commit 2fcf281e8e
2 files changed
+24 -2

No files matched your search

+12 -1
View File
@@ -59,6 +59,15 @@ def tree():
REAL_HOME = os.path.expanduser("~")
def offered(data_dir, text):
"""The offered-models list for the current harness, written beside models.md: pick refuses without it."""
path = os.path.join(data_dir, "offered", "unknown.txt")
os.makedirs(os.path.dirname(path), exist_ok=True)
with open(path, "w", encoding="utf-8") as f:
f.write("listed %s by harness unknown\n%s" % (time.strftime("%Y-%m-%dT%H:%M:%S"), text))
return path
class Core(unittest.TestCase):
ENFORCE = False
@@ -83,7 +92,7 @@ class Core(unittest.TestCase):
self.env = dict(os.environ, HOME=self.tmp, SISI_DATA=self.data, SISI_STATE=os.path.join(self.tmp, "state"),
SISI_LIB=os.path.join(self.tmp, "lib"), CLAUDE_CONFIG_DIR=os.path.join(self.tmp, "claude"),
PYTHONPATH=py + (os.pathsep + os.environ["PYTHONPATH"] if os.environ.get("PYTHONPATH") else ""))
for name in ("SISI_SESSION_ID", "CLAUDE_ENV_FILE", "XDG_DATA_HOME", "XDG_STATE_HOME", "CODEX_HOME"):
for name in ("SISI_SESSION_ID", "CLAUDE_ENV_FILE", "XDG_DATA_HOME", "XDG_STATE_HOME", "CODEX_HOME", "CLAUDE_CODE_ENTRYPOINT"):
self.env.pop(name, None)
self.proj = self.project("alpha")
if not self.ENFORCE: # these tests hold the reminders; tests/test_plan.py holds the denials
@@ -125,6 +134,7 @@ class Core(unittest.TestCase):
def table(self, text):
self.write(os.path.join(self.data, "models.md"), text) if os.path.isdir(self.data) else (
os.makedirs(self.data), self.write(os.path.join(self.data, "models.md"), text))
offered(self.data, text)
def state(self, sid="s1"):
return json.loads(self.read(self.tmp, "state", "core-sessions", sid + ".json"))
@@ -2712,6 +2722,7 @@ cli.main(["tick"])
self.assertEqual(self.read(self.env["SISI_LIB"], "current", "SOURCE").split("\n")[0], src)
self.sisi("learn", "--level", "user", "Always keep what the person wrote")
self.write(os.path.join(self.data, "models.md"), WORKERS)
offered(self.data, WORKERS)
self.write(os.path.join(self.data, "retro.jsonl"), '{"gap": "g"}\n')
keep = {n: self.read(self.data, n) for n in ("models.md", "retro.jsonl", "rules/user.md")}
self.source("2.0.0")
+12 -1
View File
@@ -8,6 +8,7 @@ import shutil
import subprocess
import sys
import tempfile
import time
import unittest
from unittest import mock
@@ -24,6 +25,15 @@ HOST = "| sonnet | Anthropic | anthropic | host subagent `sonnet` | ordinary | p
FALL = "Fallback order: routine: go/qwen-flash; ordinary: sonnet; hard: zai/glm-5.\n"
def offered(data_dir, text):
"""The offered-models list for the current harness, written beside models.md: pick refuses without it."""
path = os.path.join(data_dir, "offered", "unknown.txt")
os.makedirs(os.path.dirname(path), exist_ok=True)
with open(path, "w", encoding="utf-8") as f:
f.write("listed %s by harness unknown\n%s" % (time.strftime("%Y-%m-%dT%H:%M:%S"), text))
return path
def tree():
out = hashlib.sha1()
for p in sorted(glob.glob(os.path.join(REPO, "sisi", "*")) + glob.glob(os.path.join(REPO, "canon", "*"))):
@@ -46,7 +56,7 @@ class ModelsResearch(unittest.TestCase):
self.env = dict(os.environ, HOME=self.tmp, SISI_DATA=self.data,
SISI_STATE=os.path.join(self.tmp, "state"), SISI_LIB=os.path.join(self.tmp, "lib"),
CLAUDE_CONFIG_DIR=os.path.join(self.tmp, "claude"))
for name in ("SISI_SESSION_ID", "CLAUDE_ENV_FILE", "XDG_DATA_HOME", "XDG_STATE_HOME", "CODEX_HOME"):
for name in ("SISI_SESSION_ID", "CLAUDE_ENV_FILE", "XDG_DATA_HOME", "XDG_STATE_HOME", "CODEX_HOME", "CLAUDE_CODE_ENTRYPOINT"):
self.env.pop(name, None)
subprocess.run(["git", "init", "-q", self.data], check=True, capture_output=True, stdin=subprocess.DEVNULL)
@@ -186,6 +196,7 @@ class ModelsResearch(unittest.TestCase):
os.makedirs(self.data, exist_ok=True)
with open(os.path.join(self.data, "models.md"), "w", encoding="utf-8") as f:
f.write(self.BUSY)
offered(self.data, self.BUSY)
use = self.in_process(models.plan_use, self.BUSY)[0]
self.assertEqual((use["plan a"]["5h"], use["plan a"]["week"]), (0.0, 0.125))
out = self.in_process(models.run, [])[1]