gate rebuild 5: new gate tests (requirements, flow, send-backs, attribution, subagents, seeded sequences)

This commit is contained in:
swaits committed 2026-11-23 12:07:28 -07:00
1 parent 5335a9c14f
commit 10ccb0f277
4 files changed
+942 -844

No files matched your search

+1 -1
View File
@@ -67,7 +67,7 @@ def review_evidence(project, c, now=None):
try:
from . import workers
dg = workers.delegations_for_project(os.path.basename(project.rstrip(os.sep)), t0,
time.time() if now is None else now)
(time.time() if now is None else now) + 1) # a judgement rounds its time
except Exception as e:
store.log_error("assure-delegations", e)
return []
+1 -1
View File
@@ -167,7 +167,7 @@ def parse_chunk(data, measured=False):
writing = True
files.append(".sisi/contract.json")
continue # everything else was measured, not guessed
may = _shell_may_write(cmd)
may = shell_may_write(cmd)
if may is None:
corrupt += 1
edits += 1
+10 -9
View File
@@ -60,25 +60,26 @@ def _new_waiver(project, sess):
# ---------------------------------------------------------------- who changed what
def _absorb_subagents(sess, sid):
def _absorb_subagents(sess, sid, top):
"""Edits a subagent reported at its own stop count as this session's edits (hosts that keep the
subagent's transcript elsewhere are covered this way)."""
seen = int(sess.get("sub_seen_ns", 0) or 0)
top = max(seen, 0)
newest = seen
for r in store.read("subagents"):
if r.get("session") != sid or int(r.get("ns", 0)) <= seen:
continue
top = max(top, int(r["ns"]))
newest = max(newest, int(r["ns"]))
if not r.get("edited"):
continue
sess["attr_gen"] = int(sess.get("attr_gen", 0) or 0) + 1
since = sess.setdefault("attr_since_pass", [])
for f in r.get("files") or []:
if f not in since:
since.append(f)
rel = os.path.relpath(f, top) if top and os.path.isabs(f) else f
if rel not in since:
since.append(rel)
if not r.get("files") and "*subagent*" not in since:
since.append("*subagent*")
sess["sub_seen_ns"] = top
sess["sub_seen_ns"] = newest
def _note_own_paths(sess, attr, top):
@@ -281,7 +282,7 @@ def _decide(payload):
attr["unknown"] = True # a shell command with a before but no after: strict
except Exception as e:
store.log_error("gate-watch-pending", e)
_absorb_subagents(sess, sid)
_absorb_subagents(sess, sid, top)
_note_own_paths(sess, attr, top)
fp = gitutil.fingerprint(cwd, [path]) if top else None
if attr is not None:
@@ -315,7 +316,7 @@ def _decide(payload):
c, path = None, None # the unit is archived; new work stands or falls on its own
sess["req_contract"] = False
elif isinstance(c, dict) and c.get("status") == "paused":
if not sess.get("dirty") or top is None or c.get("pause_fp") == fp:
if not sess.get("dirty") or top is None or c.get("pause_fp") == gitutil.fingerprint(cwd):
return stop.allow(cwd, settle=bool(sess.get("dirty"))) # a recorded wait, no new change
U.resume(c, path) # the tree changed since the pause: the wait is over
stop.refresh(cwd, path)
@@ -428,7 +429,7 @@ def _late_close(stop, cwd, c, path, project):
"""This session changed nothing, but a retro was recorded for the open unit it evaluated before:
the unit closes now rather than waiting for the next change."""
s = stop.sess
if c is not None and path and c.get("status") == "open" and s.get("last_unit") == c.get("id") \
if c is not None and path and c.get("status", "open") == "open" and s.get("last_unit") == c.get("id") \
and not c.get("unverified"):
try:
from . import learning
+930 -833
View File
File diff suppressed because it is too large. Load diff