Repository navigation
loopguard: count every file a multi-file patch changes, not only the first - #225
Open
Lanre Shittu (Shizoqua) wants to merge 1 commit into
Open
Lanre Shittu (Shizoqua) wants to merge 1 commit into
Lanre Shittu (Shizoqua) wants to merge 1 commit into
Conversation
…first One `apply_patch` call can change several files. The Codex, Droid and Hermes hosts and the Codex rollout reader pass them all as `paths` (with the first as `path`), but `SpiralState.update` read only `path`. A patch that changed three files counted as one edit to the first, so `edit_churn` and `distinct_edit_files`, which `is_stuck` and the learned envelope read, came out low. The same patch run through the shell (`apply_patch <<'PATCH'`) already counted each file. An edit tool's call now counts each distinct file in `paths` once, and falls back to the single path as before when there is no list.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One
apply_patchcall can change several files. The Codex, Droid and Hermes hosts and the Codex rollout reader pass them all aspaths, with the first aspath, butSpiralState.updateread onlypath. A patch that changed three files counted as one edit to the first, soedit_churnanddistinct_edit_files, whichis_stuckand the learned envelope read, came out low. The same patch run through the shell (apply_patch <<'PATCH') already counted each file.Fix: an edit tool's call now counts each distinct file in
pathsonce, and falls back to the single path as before when there is no list. The judge's digest names the files (edit a.py, b.py, test_c.py).Test, in
tests/test_live_core.pynext to the other edit-counting tests:test_a_patch_that_changes_several_files_counts_each_of_themsends a three-file patch throughhosts.Codex().tool_callandTurnGuard.fold, and the same patch through the shell form. On main it fails with{'a.py': 1} == {'a.py': 1, 'b.py': 1, 'test_c.py': 1}; with the fix both forms give the same counts.Also checked on a made-up Codex rollout with one
FileChangeover three files, read throughtrace.codex_rollout_to_execandstate_from_trajectory:distinct_edit_filesis 1 on main and 3 with the fix.The skips need a real Codex, Hermes, opencode or aider, Windows, or a non-root user.
Fixes #223