Gate judges a session by its own edits, measured, not guessed
ci / tests (macos-latest, python 3.10) (push) Canceled after 0s
ci / tests (macos-latest, python 3.11) (push) Canceled after 0s
ci / tests (macos-latest, python 3.13) (push) Canceled after 0s
ci / tests (macos-latest, python 3.9) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.10) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.11) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.13) (push) Canceled after 0s
ci / tests (macos-latest, python 3.10) (push) Canceled after 0s
ci / tests (macos-latest, python 3.11) (push) Canceled after 0s
ci / tests (macos-latest, python 3.13) (push) Canceled after 0s
ci / tests (macos-latest, python 3.9) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.10) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.11) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.13) (push) Canceled after 0s
The end-of-turn gate attributes changed files to the session that changed them: edit tool calls by path, and shell commands by a snapshot of the tree before and after. A session answers for failing checks, and is asked for a retrospective, only over its own files. Another agent's work in progress is allowed once, marked unverified, with a note that the work is not done. Single-session behaviour is unchanged, shown by a property test. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
e5b603486b
commit
5744f3149c
15 files changed
+1387
-41
No files matched your search
@@ -68,6 +68,30 @@ class HookToolTests(AdapterBase):
|
||||
self.assertEqual(self.rows()["gemini"]["status"], "wired")
|
||||
wiring.uninstall()
|
||||
|
||||
def test_watch_hooks_registered_per_tool(self):
|
||||
cases = {"codex": (".codex", ".codex/hooks.json", ("PreToolUse", "PostToolUse"), False),
|
||||
"gemini": (".gemini", ".gemini/settings.json", ("BeforeTool", "AfterTool"), False),
|
||||
"copilot": (".copilot", ".copilot/hooks/sisi.json", ("preToolUse", "postToolUse"), True),
|
||||
"cursor": (".cursor", ".cursor/hooks.json", ("preToolUse", "postToolUse"), True)}
|
||||
for name, (d, f, events, flat) in cases.items():
|
||||
with self.subTest(tool=name):
|
||||
self.fresh_home()
|
||||
os.makedirs(self.path(d), exist_ok=True)
|
||||
if name == "copilot":
|
||||
os.makedirs(self.path(".copilot", "hooks"), exist_ok=True)
|
||||
self.cycle() # install x2 idempotent, uninstall exact (in cycle), then installs again below
|
||||
wiring.install()
|
||||
obj = json.load(open(self.path(f)))
|
||||
for ev in events:
|
||||
cmds = [e.get("bash") or e.get("command") for e in obj["hooks"][ev]] if flat else \
|
||||
[h["command"] for g in obj["hooks"][ev] for h in g["hooks"]]
|
||||
self.assertTrue(any("watch --tool %s" % name in (c or "") for c in cmds), (name, ev, cmds))
|
||||
if name == "codex":
|
||||
for ev in events:
|
||||
self.assertTrue(any(g.get("matcher") == "Bash" for g in obj["hooks"][ev]))
|
||||
self.assertEqual(self.rows()[name]["status"], "wired")
|
||||
wiring.uninstall()
|
||||
|
||||
def test_gemini_user_file_not_touched(self):
|
||||
os.makedirs(self.path(".gemini"))
|
||||
self.put(".gemini/GEMINI.md", b"mine\n")
|
||||
|
||||
Reference in new issue
Block a user