kunibert
All repositories: gitoria
4.7 KB
# K11: no review when the model could not read the code (kunibert#11)## Rule chosen (structural, no schema change)`parseEvents` (lib/review-output.hl) now counts, from the `codex exec --json` stream, `item.completed` items of type `command_execution`:`commandsOk` (status `completed`), `commandsFailed` (any other status), `spawnFailures` (failed ones whose `aggregated_output` has "failed to spawn", "bwrap:" or "Operation not permitted"; text is only a backstop).`checked(events, code, needsCode = true)` raises `the model's tools failed` unless `commandsOk > 0 || (!needsCode && spawnFailures == 0)`.`needsCode` (lib/runner.hl) = first review (no session) || fallback turn || head changed || forced. So a wake on an unchanged head (thread reply) that legitimately runs no command still gets through; a run that must read the code needs at least one command that completed.One failed command (e.g. a test exiting 1) among successful ones: normal review.Why structural: in the real broken session (byrodin, rollout 08-01-14) the turns with broken tools have NO command item in the event stream at all (the session file shows only `custom_tool_call_output` "failed to spawn code-mode host …" and "bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted"; the only item_completed in the broken turns are two McpToolCall `list_mcp_resources` calls, which must not count). The good turn (08:05) has 6 CommandExecution completed + 1 failed (exit 128) → passes. `mcp_tool_call` items are deliberately not counted. Note: the runner's own `.kunibert/codex.jsonl` of the live run no longer exists on byrodin (worktree removed), so the exec --json item shape is taken from K2/K3 logs (`command_execution`, `status` completed/failed, `exit_code`, `aggregated_output`) and cross-checked against the session file's `CommandExecution` items.## Error path`checked` runs after the usage record is written and before `state.session/head/verdict` are saved, so nothing progresses (proved: state has session null, head null; next run on the same head is a fresh first review). It raises via `require` → global error handler → `errorStatus` → status `error`, no review, no replies, no comment. Queue retry rules untouched (maxTries still applies; 2 tries in the proof).Extra small change: `errorStatus` (lib/review-post.hl) strips the hlError prefix `<file>.hl:<line>:<col>: ` so the PR shows `Review could not run: the model's tools failed` (before, the path ate the 140-char cap). Applies to all error statuses.## Diff summary- lib/review-output.hl: counters in parseEvents (+3 return fields), `checked` gets `needsCode` and the new require.- lib/runner.hl: one line, passes needsCode to `checked`.- lib/review-post.hl: errorStatus strips the file:line:col prefix.## Proof (scratch /media/STORAGE/claude-scratch/kunibert/K11/, ports 8851/8852, freed)`python3 -I /media/STORAGE/claude-scratch/kunibert/K11/scripts/proof.py` → ALL OK. Sections:- A fake codex returns schema-valid "I could not review the PR because the tool runner failed" with no command item: per try status pending+error (4 PUTs for 2 tries), no review POST, no reply POST, summary exactly "Review could not run: the model's tools failed", state session/head null.- B next event on the same head, working fake codex: pending, review POST, status; fresh (no resume) prompt; state stored.- C review_comment wake on the same head, model runs no command: reply + resolve posted (needsCode false).- D failed commands only, with the real bwrap/spawn output strings (fixtures/real-failures.json, copied from the byrodin session; checked: only error texts and `original_token_count`, no secrets): error, no review; then a run with 2 completed + 1 failed command on the same head: review posted.Local gates, each ALL OK: `python3 -I /media/STORAGE/claude-scratch/kunibert/{K4/proof.py,K6/scripts/proof.py,K7/scripts/proof.py,K8/scripts/proof.py,K9/scripts/proof.py}`.**Gate fakes changed:** the old fake codexes (K4, K4/k3rerun, K6, K7, K8, K9/regression-K7, -K8, K9/live bin/codex) emitted no tool event, so the new rule (correctly) rejected them; I added one `command_execution` completed line after `thread.started` to each (scratch only). Any other fake codex or script that feeds the runner must emit a completed command item too.## Open points- The exact `exec --json` shape of a failing code-mode tool call in codex 0.166 is not captured (no codex.jsonl survived); the rule relies on "no command_execution item completes", which matches the session evidence. If a future codex reports code-mode commands as another item type (e.g. only mcp_tool_call), every review would error: watch the first live proof after deploy (then add that type to the counter).- A resumed wake on a CHANGED head that needs no command is impossible by design (needsCode).- Not deployed, not pushed.
Branches
Latest commits
- 070e01a4Records: parkmre
- bf8af0dcRecords: v1.4 checkedmre
- 44af321bRecords: contract v1.4mre
- 310f3fd0Records: outdated semanticsmre
- 268ebfe6Records: #11 proven live and closedmre
- 88e8aad3Records: K11 verified and deployedmre
- 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