kunibert
All repositories: gitoria
4.3 KB
$mode = 'static'isList = (value) => {return hlTypeName(value) == 'Hybrid' && JSON.stringify(value).startsWith('[')}require = (Boolean ok, String message) => {if (!ok) { hlError(message) }}parseResult = (String text) => {r = JSON.parse(text.trim())require(hlTypeName(r.summary) == 'String', 'result.summary must be a string')require(isList(r.findings), 'result.findings must be an array')require(isList(r.replies), 'result.replies must be an array')require(hlTypeName(r.axes.correctness) == 'String' && hlTypeName(r.axes.spec) == 'String' && hlTypeName(r.axes.standards) == 'String', 'result.axes must have three string axes')require(['approve', 'comment', 'request_changes'].includes(r.verdict), 'invalid verdict')require(hlTypeName(r.gates) == 'String', 'result.gates must be a string')for (let i = 0; i < r.findings.length; i = i + 1) {let f = r.findings[i]if (!['correctness', 'spec', 'standards'].includes(f.axis)) { f.axis = 'correctness' }require(hlTypeName(f.path) == 'String' && hlTypeName(f.title) == 'String' && hlTypeName(f.body) == 'String', 'invalid finding text')require(hlTypeName(f.line) == 'Number' && f.line >= 1 && f.line % 1 == 0, 'invalid finding line')require(['blocker', 'major', 'minor', 'nit'].includes(f.severity), 'invalid finding severity')r.findings[i] = f}for (reply of r.replies) {require(hlTypeName(reply.thread) == 'String' && hlTypeName(reply.body) == 'String' && hlTypeName(reply.resolve) == 'Boolean', 'invalid reply')}return r}parseEvents = (Hybrid lines) => {let session = nulllet message = ''let error = nulllet usage = { input_tokens = 0, cached_input_tokens = 0, output_tokens = 0 }// Tool executions the model made (kunibert#11): a command_execution item that completed is a success, any other end (failed/declined) a failure.// A tool call that could not even start (missing helper, broken sandbox) makes no item at all, so "no successful command" is the signal.let commandsOk = 0let commandsFailed = 0let spawnFailures = 0for (line of lines) {if (!line.startsWith('{')) { continue }e = JSON.parse(line)if (e.type == 'thread.started' && e.thread_id) { session = e.thread_id }if (e.type == 'item.completed' && e.item.type == 'agent_message' && hlTypeName(e.item.text) == 'String') { message = e.item.text }if (e.type == 'item.completed' && e.item.type == 'command_execution') {if (e.item.status == 'completed') { commandsOk = commandsOk + 1 }else {commandsFailed = commandsFailed + 1out = hlTypeName(e.item.aggregated_output) == 'String' ? e.item.aggregated_output : ''if (out.includes('failed to spawn') || out.includes('bwrap:') || out.includes('Operation not permitted')) { spawnFailures = spawnFailures + 1 }}}if (e.type == 'error' || e.type == 'turn.failed') {error = e.messageif (error == null) { error = e.error.message }if (error == null) { error = JSON.stringify(e) }}if (e.usage != null) {for (key in e.usage) {require(hlTypeName(e.usage[key]) == 'Number', 'invalid usage counter')if (usage[key] == null) { usage[key] = 0 }usage[key] = usage[key] + e.usage[key]}}}return { =session, =message, =error, =usage, =commandsOk, =commandsFailed, =spawnFailures }}// needsCode: the run must have read the code (first review, new head, forced); a wake on an unchanged head may answer from memory.// No result without evidence that the tools worked: no successful command while the code had to be read, or only failed commands that// show a spawn/sandbox failure, is an error, whatever "review" the model wrote (kunibert#11). One failed command among successes is normal.checked = (Hybrid events, Number code, Boolean needsCode = true) => {require(code == 0 && events.error == null, 'codex failed (' + code + '): ' + events.error)require(events.commandsOk > 0 || (!needsCode && events.spawnFailures == 0), 'the model\'s tools failed')require(events.message != '', 'codex produced no final message')return { session = events.session, usage = events.usage, result = parseResult(events.message) }}
Branches
Latest commits
- cd4cb09cNo review and status error when the model's tools did not run (kunibert#11)Kunibert
- a6b54efaStatus updatemre
- 5a72268eRecords: #4-#10 done, #11 started, review package on #1mre
- 194c7da6Records: real proof greenmre
- cdfa94a9Records: AppArmor profile for the review sandboxmre
- c1bf02d8Status: sandbox blockermre
- 88aaacc5Records: real proof part 2 (posting works, sandbox blocked by AppArmor userns)mre
- 401df4e8Records: review user logged inmre
- 6ca681b3Records: login command, status cleanupmre
- 6b8d763cRecords: review user, device login startedKunibert
- 07025b99Open the job worktree read-only for the review user before each model runKunibert
- 2a44bd54Runner CLI: --review-user/--codex-bin/--work-dir work in every modeKunibert
- 2177f66fReview model runs as its own unix user (reviewUser, codexBin, workDir)Kunibert
- 35df8306Records: live service on byrodin, real proof part 1Kunibert
- 7480a98dkunibert.service: SIGTERM stop is a clean exitKunibert
- 3a8d93f9gitoria client: parse only JSON answers, accept a plain-text errorKunibert
- c9b48bfeVendor Hybriel plugins; deploy ships bin/ from zig-outKunibert
- a41ba15fKunibert: event intake, git cache, review runner, posting, linked tickets, deploy filesKunibert