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
- bd3591c7conductor: gates run on the live day44 binarymre
- 47f747a7records: jukebox #9 fix livemre
- 0a3169fdMerge branch 'vendored-size' into mainKunibert
- e447bb09Vendored size fix: keep renames with an app side whole; type the filter parameter (L10)mre
- 99ccc742Vendored size fix: no renames in the app diff, filter the resumed delta toomre
- 1a52e100|||PR Diff size limit counts only app files when vendored paths are setmre
- 50a1867estatus: jukebox #9mre
- c57484e6log: jukebox #9 diff sizemre
- 795a20carecords: guard fix live (PR 8)mre
- 6981d96fMerge branch 'fresh-on-nocmd' into mainKunibert
- 37c47840runner: one shared prompt for both fresh-session fallbacks (L16)mre
- f945d2e1|||PR runner: a resumed run with no command on a new head gets one fresh session instead of a tool errormre
- 10b2a49estatus: PR 314, guard fix proposedmre
- e73995a3log: hycon PR 314 approved after fresh reviewmre
- f60427falog: hycon PR 314 false tool errormre
- 481974f7log: Hermes accepts PR 259 findingmre
- bb0976acrecords: hycon PR 259 design findingmre
- 5c637c24records: hycon PR 259 false tool errormre
- a344c406log: routger 132 reviewedmre
- 56e70dcbrecords: review time limit 1800 s (routger 132)mre