@christang/keel 5.228.0 → 5.229.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,120 @@
1
+ 'use strict';
2
+ const {test}=require('node:test');
3
+ const assert=require('node:assert/strict');
4
+ const http=require('node:http');
5
+ const crypto=require('node:crypto');
6
+ const os=require('node:os');
7
+ const path=require('node:path');
8
+ const fs=require('node:fs');
9
+ const {spawn}=require('node:child_process');
10
+ const cli=path.resolve(__dirname,'../bin/keel.js');
11
+ function run(args,action="status"){return new Promise(resolve=>{const p=spawn(process.execPath,action==='tick'?[cli,'tick',...args]:[cli,'codex',action,...args]);let out='',err='';p.stdout.on('data',b=>out+=b);p.stderr.on('data',b=>err+=b);p.on('close',code=>resolve({code,out,err}));});}
12
+ test('managed CLI lifecycle, mailbox scheduling and frame boundaries',async()=>{
13
+ const dir=fs.mkdtempSync(path.join(os.tmpdir(),'keel-host-'));const sock=path.join(dir,'host.sock');const requests=[];const requestDetails=[];const peers=[];let active=true,serial=0,uncertain=false,invalidHost=false,injectNotice=false,unloaded=false,resumeActive=false,resumeFails=false,resumeMismatch=false,readMismatch=false,resumeDelay=false;
14
+ const server=http.createServer();server.on('upgrade',(req,s)=>{peers.push(s);s.write('HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: '+crypto.createHash('sha1').update(req.headers['sec-websocket-key']+'258EAFA5-E914-47DA-95CA-C5AB0DC85B11').digest('base64')+'\r\n\r\n');let initialized=false;let buf=Buffer.alloc(0);s.on('data',chunk=>{buf=Buffer.concat([buf,chunk]);while(buf.length>=6){let n=buf[1]&127,off=2;if(n===126){if(buf.length<8)return;n=buf.readUInt16BE(2);off=4;}else if(n===127){if(buf.length<14)return;n=Number(buf.readBigUInt64BE(2));off=10;}if(buf.length<off+4+n)return;const mask=buf.subarray(off,off+4);const data=Buffer.from(buf.subarray(off+4,off+4+n));buf=buf.subarray(off+4+n);for(let i=0;i<data.length;i++)data[i]^=mask[i%4];const x=JSON.parse(data);requests.push(x.method);requestDetails.push(x);if(x.method==='initialized'){initialized=true;continue;}if(!x.id)continue;if(x.method!=='initialize'&&!initialized){s.destroy();return;}if(x.method==='thread/resume'){if(resumeFails){const b=Buffer.from(JSON.stringify({id:x.id,error:{message:'fixture resume failure'}}));s.write(Buffer.concat([Buffer.from([129,b.length]),b]));continue;}unloaded=false;if(resumeActive)active=true;}const result=x.method==='initialize'?(invalidHost?{}:{userAgent:'test-host'}):x.method==='turn/start'?{turn:uncertain?{}:{id:'turn-fixture'}}:{thread:{id:x.method==='thread/start'?`fixture-thread-${++serial}`:(x.params.threadId||'fixture-thread'),status:{type:unloaded?'notLoaded':active?'active':'idle'},cwd:readMismatch||(x.method==='thread/resume'&&resumeMismatch)?'/wrong-worktree':dir}};const b=Buffer.from(JSON.stringify({id:x.id,result}));const h=b.length<126?Buffer.from([129,b.length]):Buffer.from([129,126,b.length>>8,b.length&255]);const split=Math.floor(b.length/2);const frame=(op,body)=>Buffer.concat([body.length<126?Buffer.from([op,body.length]):Buffer.from([op,126,body.length>>8,body.length&255]),body]);if(injectNotice){const notice=Buffer.from(JSON.stringify({id:x.id,method:'server/notice',params:{}}));s.write(frame(129,notice));}const reply=()=>{if(!s.destroyed)s.write(Buffer.concat([frame(1,b.subarray(0,split)),frame(128,b.subarray(split))]));};if(resumeDelay&&x.method==='thread/resume')setTimeout(reply,5500).unref();else reply();}});});
15
+ await new Promise(r=>server.listen(sock,r));
16
+ try{const x=await run(['--socket',sock,'--thread','fixture-thread','--json']);assert.equal(x.code,0,x.err);assert.equal(JSON.parse(x.out).thread.status.type,'active');assert.deepEqual(requests.filter(x=>x!=='initialized'),['initialize','thread/read']);
17
+ active=false;const {spawnSync}=require('node:child_process');spawnSync('git',['init','-q',dir]);
18
+ const reserved=await run(['--socket',sock,'--repo',dir,'--role','keel','--json'],'start');assert.notEqual(reserved.code,0);assert.equal(serial,0,'reserved role must be rejected before thread/start');
19
+ fs.mkdirSync(path.join(dir,'.git/keel-chat'),{recursive:true});fs.writeFileSync(path.join(dir,'.git/keel-chat/renames.json'),JSON.stringify({'old-role':'new-role'}));const renamed=await run(['--socket',sock,'--repo',dir,'--role','old-role'],'start');assert.notEqual(renamed.code,0);assert.match(renamed.err,/renamed/);assert.equal(serial,0);
20
+ const started=await run(['--socket',sock,'--repo',dir,'--role','test-role','--json'],'start');assert.equal(started.code,0,started.err);
21
+ assert.equal(JSON.parse(started.out).role,'test-role');
22
+ const again=await run(['--socket',sock,'--repo',dir,'--role','test-role'],'start');assert.notEqual(again.code,0);assert.match(again.err,/already|exists/);
23
+ const own=await run(['--repo',dir,'--role','test-role','--json']);assert.equal(own.code,0,own.err);
24
+ assert.equal(requests.filter(x=>x==='thread/start').length,1);
25
+ const message=['--repo',dir,'--role','test-role','--record','fixture-record','--text','Run keel chat unread','--json'];
26
+ const sent=await run(message,'deliver');assert.equal(sent.code,0,sent.err);
27
+ const duplicate=await run(message,'deliver');assert.equal(duplicate.code,0,duplicate.err);assert.equal(requests.filter(x=>x==='turn/start').length,1);
28
+ active=true;const waiting=await run(['--repo',dir,'--role','test-role','--note','finish fixture','--json'],'handover');assert.equal(waiting.code,0,waiting.err);assert.equal(JSON.parse(waiting.out).state,'waiting');assert.equal(serial,1);
29
+ active=false;const handed=await run(['--repo',dir,'--role','test-role','--note','finish fixture','--json'],'handover');assert.equal(handed.code,0,handed.err);assert.equal(serial,2);
30
+ const store=require('../src/core/chat/store');const where=store.requireLocation(dir);
31
+ store.createGroup(where,'owner','team',['test-role']);
32
+ store.writeRecord(where,{group:'team',kind:'message',from:'owner',mentions:['test-role'],text:'addressed fixture'});
33
+ store.writeRecord(where,{group:'team',kind:'message',from:'owner',mentions:['test-role'],no_wake:true,text:'do not wake'});
34
+ const beforeDrain=requests.filter(x=>x==='turn/start').length;
35
+ const drained=await run(['--repo',dir,'--json'],'drain');assert.equal(drained.code,0,drained.err);assert.equal(requests.filter(x=>x==='turn/start').length,beforeDrain+1);
36
+ const drainedAgain=await run(['--repo',dir,'--json'],'drain');assert.equal(drainedAgain.code,0,drainedAgain.err);assert.equal(requests.filter(x=>x==='turn/start').length,beforeDrain+1);
37
+ const beforeTick=requests.filter(x=>x==='turn/start').length;
38
+ store.writeRecord(where,{group:'team',kind:'message',from:'owner',mentions:['test-role'],text:'tick addressed fixture'});
39
+ const ticked=await run(['--repo',dir,'--json'],'tick');assert.equal(ticked.code,0,ticked.err);assert.ok(JSON.parse(ticked.out).codex.some(x=>x.state==='delivered'));assert.equal(requests.filter(x=>x==='turn/start').length,beforeTick+1);
40
+ uncertain=true;const failedMessage=['--repo',dir,'--role','test-role','--record','uncertain-record','--text','read pending','--json'];const failed=await run(failedMessage,'deliver');assert.notEqual(failed.code,0);const retried=await run(failedMessage,'deliver');assert.notEqual(retried.code,0);assert.match(retried.err,/unknown/);assert.equal(requests.filter(x=>x==='turn/start').length,4);
41
+ const lock=path.join(dir,'.git/keel-chat/codex-roles/test-role.json.lock');fs.writeFileSync(lock,'owned by another process');const locked=await run(message,'deliver');assert.notEqual(locked.code,0);assert.equal(fs.readFileSync(lock,'utf8'),'owned by another process');fs.unlinkSync(lock);
42
+ const registry=JSON.parse(fs.readFileSync(path.join(dir,'.git/keel-chat/codex-roles/test-role.json')));assert.equal(registry.history.length,1);assert.equal(registry.history[0].note,'finish fixture');
43
+
44
+ uncertain=false;const large=await run(['--repo',dir,'--role','test-role','--record','large-record','--text','x'.repeat(70000),'--json'],'deliver');assert.equal(large.code,0,large.err);
45
+ const raceBefore=requests.filter(x=>x==='turn/start').length;const raceArgs=['--repo',dir,'--role','test-role','--record','concurrent-record','--text','concurrent fixture','--json'];const raced=await Promise.all([run(raceArgs,'deliver'),run(raceArgs,'deliver')]);assert.ok(raced.some(x=>x.code===0));assert.equal(requests.filter(x=>x==='turn/start').length,raceBefore+1);
46
+ // An unloaded owned thread is not an unrelated desktop session.
47
+ const recoveryArgs=record=>['--repo',dir,'--role','test-role','--record',record,'--text','recovery round','--json'];
48
+ const resumes=()=>requests.filter(x=>x==='thread/resume').length;
49
+ const turns=()=>requests.filter(x=>x==='turn/start').length;
50
+ unloaded=true;let rb=resumes(),tb=turns();
51
+ const unloadedDuplicate=await run(recoveryArgs('large-record'),'deliver');assert.equal(unloadedDuplicate.code,0,unloadedDuplicate.err);assert.equal(JSON.parse(unloadedDuplicate.out).state,'already-delivered');assert.equal(resumes(),rb);assert.equal(turns(),tb);
52
+ const recovered=await run(recoveryArgs('recovery-record'),'deliver');assert.equal(recovered.code,0,recovered.err);assert.equal(JSON.parse(recovered.out).state,'delivered');assert.equal(resumes(),rb+1);assert.equal(turns(),tb+1);assert.equal(serial,2);
53
+ const resumeRequest=requestDetails.find(x=>x.method==='thread/resume');assert.deepEqual(resumeRequest.params,{threadId:'fixture-thread-2',serviceName:'keel'});
54
+ unloaded=true;rb=resumes();tb=turns();const recoveredDuplicate=await run(recoveryArgs('recovery-record'),'deliver');assert.equal(recoveredDuplicate.code,0,recoveredDuplicate.err);assert.equal(resumes(),rb);assert.equal(turns(),tb);
55
+ const unknown=await run(recoveryArgs('uncertain-record'),'deliver');assert.notEqual(unknown.code,0);assert.match(unknown.err,/unknown/);assert.equal(resumes(),rb);
56
+ resumeActive=true;const busyRecovery=await run(recoveryArgs('busy-recovery'),'deliver');assert.equal(busyRecovery.code,0,busyRecovery.err);assert.equal(JSON.parse(busyRecovery.out).state,'waiting');assert.equal(turns(),tb);resumeActive=false;active=false;
57
+ unloaded=true;resumeFails=true;const failedRecovery=await run(recoveryArgs('failed-recovery'),'deliver');assert.notEqual(failedRecovery.code,0);assert.match(failedRecovery.err,/fixture resume failure/);assert.equal(turns(),tb);resumeFails=false;
58
+ unloaded=true;resumeMismatch=true;const mismatchRecovery=await run(recoveryArgs('mismatch-recovery'),'deliver');assert.notEqual(mismatchRecovery.code,0);assert.match(mismatchRecovery.err,/identity/);assert.equal(turns(),tb);resumeMismatch=false;
59
+ unloaded=true;readMismatch=true;rb=resumes();const wrongRead=await run(recoveryArgs('wrong-read'),'deliver');assert.notEqual(wrongRead.code,0);assert.equal(resumes(),rb);readMismatch=false;
60
+ unloaded=true;resumeDelay=true;const slowResume=await run(recoveryArgs('cold-recovery'),'deliver');assert.equal(slowResume.code,0,slowResume.err);unloaded=true;const explicitDeadline=await run([...recoveryArgs('short-deadline'),'--timeout','100'],'deliver');assert.notEqual(explicitDeadline.code,0);assert.match(explicitDeadline.err,/thread\/resume timeout/);resumeDelay=false;unloaded=true;rb=resumes();tb=turns();
61
+ const wrongEndpoint=await run([...recoveryArgs('wrong-endpoint'),'--socket',path.join(dir,'other.sock')],'deliver');assert.notEqual(wrongEndpoint.code,0);assert.match(wrongEndpoint.err,/endpoint mismatch/);assert.equal(resumes(),rb);
62
+ const roleFile=path.join(dir,'.git/keel-chat/codex-roles/test-role.json'),savedRole=fs.readFileSync(roleFile);fs.unlinkSync(roleFile);const notOwned=await run(recoveryArgs('not-owned'),'deliver');assert.notEqual(notOwned.code,0);assert.equal(resumes(),rb);fs.writeFileSync(roleFile,savedRole);
63
+ const unloadedHandover=await run(['--repo',dir,'--role','test-role','--note','not an implicit resume'],'handover');assert.notEqual(unloadedHandover.code,0);assert.equal(resumes(),rb);assert.equal(serial,2);unloaded=false;
64
+ injectNotice=true;const notified=await run(['--socket',sock,'--json']);assert.equal(notified.code,0,notified.err);assert.equal(JSON.parse(notified.out).host.userAgent,'test-host');injectNotice=false;
65
+ invalidHost=true;const malformed=await run(['--socket',sock,'--json']);assert.notEqual(malformed.code,0);assert.match(malformed.err,/identity/i);invalidHost=false;
66
+ const bad=await run(['--socket',path.join(dir,'missing'),'--timeout','100']);assert.notEqual(bad.code,0);assert.match(bad.err,/connect|ENOENT/i);}finally{peers.forEach(s=>s.destroy());await new Promise(r=>server.close(r));fs.rmSync(dir,{recursive:true,force:true});}
67
+ });
68
+ test('silent endpoint fails before the deadline',async()=>{
69
+ const dir=fs.mkdtempSync(path.join(os.tmpdir(),'keel-silent-')),sock=path.join(dir,'host.sock');const server=http.createServer();const peers=[];server.on('connection',s=>peers.push(s));await new Promise(r=>server.listen(sock,r));
70
+ try{const before=Date.now();const x=await run(['--socket',sock,'--timeout','100']);assert.notEqual(x.code,0);assert.match(x.err,/timeout/);assert.ok(Date.now()-before<3000);}finally{peers.forEach(s=>s.destroy());await new Promise(r=>server.close(r));fs.rmSync(dir,{recursive:true,force:true});}
71
+ });
72
+
73
+ test('native patch guard checks every source and move destination', () => {
74
+ const {spawnSync} = require('node:child_process');
75
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'keel-native-guard-'));
76
+ const hook = path.resolve(__dirname, '../plugins/keel/scripts/pretooluse-guard.js');
77
+ try {
78
+ fs.mkdirSync(path.join(dir, 'keel'));
79
+ fs.mkdirSync(path.join(dir, 'openspec/changes/fixture'), {recursive: true});
80
+ fs.writeFileSync(path.join(dir, 'openspec/changes/fixture/tasks.md'), '- [ ] 1.1 fixture\n');
81
+ fs.writeFileSync(path.join(dir, 'keel/guard.json'), JSON.stringify({schema:'keel-write-guard/v1',change:'fixture',task:'1.1',touch:['allowed.txt'],authority:[{path:'openspec/changes/fixture/tasks.md',sha256:'0'.repeat(64)}]}));
82
+ const check = patch => {
83
+ const r = spawnSync(process.execPath, [hook], {cwd:dir,encoding:'utf8',input:JSON.stringify({cwd:dir,tool_name:'apply_patch',tool_input:{command:patch}})});
84
+ assert.equal(r.status,0,r.stderr);
85
+ return r.stdout ? JSON.parse(r.stdout).hookSpecificOutput : null;
86
+ };
87
+ assert.equal(check('*** Begin Patch\n*** Add File: forbidden.txt\n+bad\n*** End Patch').permissionDecision,'deny');
88
+ assert.equal(check('*** Begin Patch\n*** Update File: allowed.txt\n*** Move to: forbidden.txt\n@@\n-old\n+new\n*** End Patch').permissionDecision,'deny');
89
+ assert.equal(check('*** Begin Patch\n*** Add File: allowed.txt\n+ok\n*** End Patch'),null);
90
+ const config=JSON.parse(fs.readFileSync(path.resolve(__dirname,'../plugins/keel/hooks/codex.json')));
91
+ assert.ok(config.hooks.PreToolUse.some(group=>new RegExp(group.matcher).test('Bash')));
92
+ } finally {fs.rmSync(dir,{recursive:true,force:true});}
93
+ });
94
+
95
+ test('public capability and help distinguish managed host from native enforcement', () => {
96
+ const {spawnSync}=require('node:child_process');
97
+ const result=spawnSync(process.execPath,[cli,'capabilities','--target','codex','--json'],{encoding:'utf8'});
98
+ assert.equal(result.status,0,result.stderr);
99
+ const capabilities=JSON.parse(result.stdout);
100
+ assert.equal(capabilities.host.managedRoles.level,'manual');
101
+ assert.match(capabilities.host.managedRoles.evidence,/explicit.*endpoint/);
102
+ assert.equal(capabilities.guard.enforcement.level,'manual');
103
+ assert.equal(capabilities.compaction.postCompactReinjection.level,'manual');
104
+ const help=spawnSync(process.execPath,[cli,'--help'],{encoding:'utf8'});
105
+ assert.match(help.stdout,/keel codex status\|start\|deliver\|handover\|drain/);
106
+ });
107
+
108
+ test('tick renders managed host failures without starting a replacement', async () => {
109
+ const {spawnSync}=require('node:child_process');
110
+ const dir=fs.mkdtempSync(path.join(os.tmpdir(),'keel-codex-tick-'));
111
+ try {
112
+ spawnSync('git',['init','-q',dir]);
113
+ const store=require('../src/core/chat/store'),where=store.requireLocation(dir);
114
+ fs.mkdirSync(path.join(where.root,'codex-roles'),{recursive:true});
115
+ fs.writeFileSync(path.join(where.root,'codex-roles/bad-role.json'),JSON.stringify({state:'creation-pending',role:'bad-role'}));
116
+ const result=await run(['--repo',dir],'tick');
117
+ assert.equal(result.code,0,result.err);
118
+ assert.match(result.out,/Codex bad-role.*unverified/);
119
+ } finally {fs.rmSync(dir,{recursive:true,force:true});}
120
+ });
@@ -308,6 +308,9 @@ def validate_paths(errors: list[str]) -> None:
308
308
  relative = marker_file.relative_to(ROOT).as_posix()
309
309
  if relative.startswith(("node_modules/", "openspec/changes/archive/", "keel/archive/")):
310
310
  continue
311
+ # Nested clones and linked worktrees are independent checkouts.
312
+ if any((parent / ".git").exists() for parent in marker_file.parents if parent != ROOT and ROOT in parent.parents):
313
+ continue
311
314
  try:
312
315
  text = marker_file.read_text(encoding="utf-8")
313
316
  except (UnicodeDecodeError, OSError):
@@ -0,0 +1,13 @@
1
+ """Public Codex CLI against an isolated WebSocket stand-in, not a real model host."""
2
+ import subprocess
3
+ from validation.common import ROOT, report
4
+
5
+ CODEX_HOST_EVIDENCE = {"hook_event_name": "PreToolUse", "transport": "stand-in WebSocket"}
6
+
7
+ def validate_codex_managed_host_scenario() -> int:
8
+ result = subprocess.run(["node", "--test", str(ROOT / "scripts/test_codex_host.js")], cwd=ROOT, capture_output=True, text=True, timeout=45)
9
+ if result.returncode:
10
+ report(result.stdout + result.stderr)
11
+ return 1
12
+ report("codex-managed-host scenario passed (" + CODEX_HOST_EVIDENCE["transport"] + "; native hook payload policy).")
13
+ return 0
@@ -35,10 +35,10 @@ os.environ["KEEL_UPDATE_CLAUDE"] = str(Path(tempfile.gettempdir()) / "keel-suite
35
35
  os.environ["KEEL_UPDATE_CODEX"] = str(Path(tempfile.gettempdir()) / "keel-suite-has-no-codex")
36
36
 
37
37
 
38
- PACKAGE_VERSION = "5.228.0"
38
+ PACKAGE_VERSION = "5.229.1"
39
39
 
40
40
 
41
- PROTOCOL_VERSION = "5.228.0"
41
+ PROTOCOL_VERSION = "5.229.1"
42
42
 
43
43
 
44
44
  LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
@@ -641,7 +641,7 @@ def validate_continuation_docs_scenario() -> int:
641
641
  # to spell all of it: a reader copies from the list they are shown.
642
642
  for needle in (
643
643
  f"accepted names: {ACCEPTED_AUTHORIZE_NAMES}",
644
- "The fifteen names above are the whole vocabulary.",
644
+ "The sixteen names above are the whole vocabulary.",
645
645
  "`protocol-refresh`, the seventh name",
646
646
  ):
647
647
  if needle not in readme:
@@ -5884,3 +5884,37 @@ def validate_external_agent_exit_status_scenario() -> int:
5884
5884
 
5885
5885
  report("external-agent-exit-status scenario passed.")
5886
5886
  return 0
5887
+
5888
+
5889
+ def validate_guard_refuses_push_to_held_branch_scenario() -> int:
5890
+ from validation.sync import _Devices, _declare_in
5891
+ label = "guard-refuses-push-to-held-branch:"
5892
+ with tempfile.TemporaryDirectory(prefix="keel-guard-lock-") as raw:
5893
+ d = _Devices(Path(raw), "authorize:\n - device-sync\nsync:\n lock: true\n")
5894
+ mine = {**d.env(d.a), "KEEL_DEVICE": "dev-a"}
5895
+ other = {**mine, "KEEL_DEVICE": "dev-b"}
5896
+ d.keel(d.a, "lock", "acquire", "--branch", "feat", env=mine)
5897
+ def decide(command: str, env: dict) -> dict | None:
5898
+ event = {"tool_name": "Bash", "tool_input": {"command": command}, "cwd": str(d.a)}
5899
+ ran = subprocess.run(["node", str(ROOT / PLUGIN_ROOT / "scripts/pretooluse-guard.js")],
5900
+ cwd=d.a, env=env, input=json.dumps(event), text=True, capture_output=True)
5901
+ return pretooluse_decision(ran)
5902
+ denied = decide("git push origin feat", other)
5903
+ if not denied or denied.get("permissionDecision") != "deny":
5904
+ report(f"{label} must deny naming keel lock acquire --branch feat: {denied}")
5905
+ return 1
5906
+ reason = denied.get("permissionDecisionReason", "")
5907
+ for expected in ("pm@dev-a", "keel lock acquire --branch feat"):
5908
+ if expected not in reason:
5909
+ report(f"{label} denial missing {expected}: {denied}")
5910
+ return 1
5911
+ for command, env in (("git push origin feat", mine), ("git push --all origin", other), ('git push origin "$BRANCH"', other)):
5912
+ if decide(command, env):
5913
+ report(f"{label} existing rule must allow {command} here")
5914
+ return 1
5915
+ _declare_in(d, d.a, "authorize:\n - device-sync\n")
5916
+ if decide("git push origin feat", other):
5917
+ report(f"{label} no sync declaration must preserve the old verdict")
5918
+ return 1
5919
+ report("guard-refuses-push-to-held-branch scenario passed.")
5920
+ return 0
@@ -12,11 +12,14 @@ from validation import chatwake
12
12
  from validation import dsh
13
13
  from validation import skipspecs
14
14
  from validation import feedback
15
+ from validation import sync
16
+ from validation import codexhost
15
17
 
16
18
 
17
19
 
18
20
 
19
21
  SCENARIOS: tuple = (
22
+ ("codex-managed-host", codexhost.validate_codex_managed_host_scenario),
20
23
  ("stateless-continuity", shift.validate_stateless_continuity_scenario),
21
24
  ("context-per-worktree", shift.validate_context_per_worktree_scenario),
22
25
  ("read-only-role", shift.validate_read_only_role_scenario),
@@ -531,11 +534,37 @@ SCENARIOS: tuple = (
531
534
  ("chat-no-wake-dm", chat.validate_chat_no_wake_dm_scenario),
532
535
  ("chat-wakes-without-no-wake", chat.validate_chat_wakes_without_no_wake_scenario),
533
536
  ("worktree-overview", shift.validate_worktree_overview_scenario),
537
+ ("sync-status-lists-local-only", sync.validate_sync_status_lists_local_only_scenario),
538
+ ("sync-status-read-only-exit-codes", sync.validate_sync_status_read_only_exit_codes_scenario),
539
+ ("sync-status-verify-classifies", sync.validate_sync_status_verify_classifies_scenario),
540
+ ("sync-status-verify-failure", sync.validate_sync_status_verify_failure_scenario),
541
+ ("sync-status-push-guidance", sync.validate_sync_status_push_guidance_scenario),
542
+ ("device-sync-authorization-name", sync.validate_device_sync_authorization_name_scenario),
543
+ ("sync-declaration-read", sync.validate_sync_declaration_read_scenario),
544
+ ("branch-lock-race", sync.validate_branch_lock_race_scenario),
545
+ ("branch-lock-head-and-expiry", sync.validate_branch_lock_head_and_expiry_scenario),
546
+ ("branch-lock-release", sync.validate_branch_lock_release_scenario),
547
+ ("branch-lock-push-authorization", sync.validate_branch_lock_push_authorization_scenario),
548
+ ("archive-carries-shift-notes", sync.validate_archive_carries_shift_notes_scenario),
549
+ ("sync-gates-lock", sync.validate_sync_gates_lock_scenario),
550
+ ("sync-gates-without-declaration", sync.validate_sync_gates_without_declaration_scenario),
551
+ ("context-warns-local-only", sync.validate_context_warns_local_only_scenario),
552
+ ("context-lock-next-action", sync.validate_context_lock_next_action_scenario),
553
+ ("shift-check-stash-and-notes", sync.validate_shift_check_stash_and_notes_scenario),
554
+ ("shift-ready-releases-lock", sync.validate_shift_ready_releases_lock_scenario),
555
+ ("shift-resume-takes-over", sync.validate_shift_resume_takes_over_scenario),
556
+ ("handover-waits-for-lock", sync.validate_handover_waits_for_lock_scenario),
557
+ ("tick-renews-and-pushes", sync.validate_tick_renews_and_pushes_scenario),
558
+ ("prompt-hook-renews-when-due", sync.validate_prompt_hook_renews_when_due_scenario),
559
+ ("patrol-old-local-only-risk", sync.validate_patrol_old_local_only_risk_scenario),
560
+ ("doctor-reports-branch-locks", sync.validate_doctor_reports_branch_locks_scenario),
561
+ ("release-skips-nested-worktrees", sync.validate_release_skips_nested_worktrees_scenario),
534
562
  ("init-never-downgrades-openspec", install.validate_init_never_downgrades_openspec_scenario),
535
563
  ("native-plugin-marketplaces", hosts.validate_native_plugin_marketplaces_scenario),
536
564
  ("native-plugin-install-matrix", hosts.validate_native_plugin_install_matrix_scenario),
537
565
  ("touch-write-guard", guard.validate_touch_write_guard_scenario),
538
566
  ("push-branch-guard", guard.validate_push_branch_guard_scenario),
567
+ ("guard-refuses-push-to-held-branch", guard.validate_guard_refuses_push_to_held_branch_scenario),
539
568
  ("push-guard-cd-before-push", guard.validate_push_guard_cd_before_push_scenario),
540
569
  ("push-guard-redirects", guard.validate_push_guard_redirects_scenario),
541
570
  ("push-guard-follow-tags", guard.validate_push_guard_follow_tags_scenario),