ethanplusai/codex-on-crack / plugins/codex-on-crack/skills/crack
crack
UnverifiedLead substantial Codex builds with one configured implementation worker and lead acceptance. Use when the user requests codex-on-crack, names a model to delegate work to, asks to run subagents through Claude, or requests a lead/worker split. Keep host-only work direct; honor explicit external model choices. Workers must not invoke this orchestrator.
viewer/test/viewer.test.mjs
View on GitHubimport test from 'node:test';import assert from 'node:assert/strict';import fs from 'node:fs/promises';import os from 'node:os';import path from 'node:path';
import {Adapter,selectEvents} from '../src/adapter.mjs';import {Tail} from '../src/tail.mjs';import {reduceEvents,validateEvent} from '../src/model.mjs';
const at='2026-09-28T12:00:00Z';const record=(type,payload,timestamp=at)=>({type,payload,timestamp});
const meta=(id,parent)=>record('session_meta',{id,source:parent?{subagent:{thread_spawn:{parent_thread_id:parent}}}:'cli'});
function adapter(id,parent){const a=new Adapter({source:id});a.ingest(meta(id,parent),1);return a}
test('root and descendants included, unrelated files excluded',()=>{const root=adapter('root'),child=adapter('child','root'),other=adapter('other');assert.deepEqual(new Set(selectEvents([root,child,other],'root').map(e=>e.agentId)),new Set(['root','child']))});
test('completion is returned, not accepted; next turn restarts',()=>{const a=adapter('child','root');a.ingest(record('event_msg',{type:'task_complete'}),2);assert.equal(reduceEvents(a.events)[0].status,'Returned · awaiting review');a.ingest(record('event_msg',{type:'task_started'}),3);assert.equal(reduceEvents(a.events)[0].status,'Working')});
test('reasoning and tool bodies are never emitted; plan text opt-in',()=>{const a=adapter('root');a.ingest(record('response_item',{type:'reasoning',summary:'SECRET'}),2);a.ingest(record('response_item',{type:'function_call',name:'exec_command',arguments:'SECRET'}),3);a.ingest(record('response_item',{type:'function_call',name:'update_plan',arguments:JSON.stringify({plan:[{step:'SECRET',status:'in_progress'}]})}),4);assert(!JSON.stringify(a.events).includes('SECRET'));assert.equal(reduceEvents(a.events)[0].steps[0].step,'Plan step 1')});
test('bad timestamps and plans reject without false completion',()=>{const a=adapter('root');a.ingest(record('event_msg',{type:'task_complete'},'oops'),2);a.ingest(record('response_item',{type:'function_call',name:'update_plan',arguments:JSON.stringify({plan:[{step:'a',status:'fake'}]})}),3);assert.equal(a.errors,2);assert.notEqual(reduceEvents(a.events)[0].status,'Accepted')});
test('duplicate events do not duplicate history',()=>{const a=adapter('root');assert.equal(reduceEvents([...a.events,...a.events])[0].history.length,1)});
test('since retains metadata but excludes historical workers',()=>{const root=adapter('root'),old=adapter('old','root');root.ingest(record('event_msg',{type:'task_started'},'2026-09-28T13:00:00Z'),2);assert.deepEqual(new Set(selectEvents([root,old],'root','2026-09-28T12:30:00Z').map(e=>e.agentId)),new Set(['root']))});
test('sample includes correction, acceptance and distinct verification',async()=>{const f=JSON.parse(await fs.readFile(new URL('../fixtures/sample.json',import.meta.url)));f.events.forEach(validateEvent);const agents=reduceEvents(f.events);assert.equal(agents.find(a=>a.id==='worker').status,'Accepted');assert.equal(agents.find(a=>a.id==='lead').status,'Turn complete')});
test('tail handles partial UTF8, malformed lines, append, truncate, and missing files',async()=>{const dir=await fs.mkdtemp(path.join(os.tmpdir(),'viewer-'));try{const file=path.join(dir,'log.jsonl');const row=JSON.stringify(meta('root'))+'\n';await fs.writeFile(file,row.slice(0,12));const t=new Tail(file,0,false);await t.poll();assert.equal(t.adapter.events.length,0);await fs.appendFile(file,row.slice(12)+'bad\n');await t.poll();assert.equal(t.adapter.events.length,1);assert.equal(t.adapter.errors,1);await fs.appendFile(file,JSON.stringify(record('event_msg',{type:'task_started'}))+'\n');await t.poll();assert.equal(reduceEvents(t.adapter.events)[0].status,'Working');await fs.writeFile(file,JSON.stringify(meta('new'))+'\n');await t.poll();assert.equal(t.adapter.id,'new');await fs.unlink(file);await t.poll();assert.equal(t.status,'Unavailable')}finally{await fs.rm(dir,{recursive:true,force:true})}});
test('native task-name delegation aliases to the attached child session',()=>{const root=adapter('root');root.ingest(record('response_item',{type:'function_call',name:'spawn_agent',call_id:'call',arguments:'{"task_name":"builder"}'}),2);root.ingest(record('response_item',{type:'function_call_output',call_id:'call',output:'{"task_name":"/root/builder"}'}),3);const child=adapter('child','root');child.agentPath='/root/builder';assert.equal(reduceEvents(selectEvents([root,child],'root')).length,2)});
test('explicit event feed validates and preserves review evidence',()=>{const a=new Adapter({source:'explicit',normalized:true});a.ingest({schemaVersion:1,eventId:'1',agentId:'root',at,type:'review.accepted',data:{}},1);a.ingest({schemaVersion:1,eventId:'bad',agentId:'root',at,type:'invented',data:{}},2);assert.equal(a.errors,1);assert.equal(reduceEvents(a.events)[0].status,'Accepted')});
test('explicit feed privacy drops arbitrary payload and hides descriptions',()=>{const a=new Adapter({source:'explicit',normalized:true});a.ingest({schemaVersion:1,eventId:'1',agentId:'root',at,type:'agent.created',extra:'SECRET',data:{title:'SECRET',assignment:'SECRET',extra:'SECRET'}},1);assert(!JSON.stringify(a.events).includes('SECRET'))});
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |