Force local verified first edits sooner
ober
1a96b2270074260132c6e6aca7072b3954286208
--- a/src/jcode/core/verified-run.ss +++ b/src/jcode/core/verified-run.ss @@ -422,6 +422,7 @@ (def remote-pre-edit-inspection-limit 12) (def remote-pre-edit-navigation-limit 10) (def remote-force-first-edit-inspection-count 6) +(def local-force-first-edit-tool-choice-count 4) (def local-force-first-edit-inspection-count 5) (def local-verified-text-response-retries 6) @@ -440,7 +441,7 @@ (not (current-pending-ss-create-repair)) (if (current-verified-local-model?) (>= (pre-edit-inspection-total) - local-force-first-edit-inspection-count) + local-force-first-edit-tool-choice-count) (>= (pre-edit-inspection-total) remote-force-first-edit-inspection-count)) (tool-specs-include? specs "edit") @@ -532,8 +533,7 @@ (openai-function-tool-choice staged-tool))) (forced-choice (or staged-choice - (and (not (current-verified-local-model?)) - (force-first-edit-tool-choice specs)))) + (force-first-edit-tool-choice specs))) (forced-specs (if staged-tool (forced-staged-repair-specs specs staged-tool) --- a/test/run.ss +++ b/test/run.ss @@ -3646,16 +3646,18 @@ result "VERIFIED: exit 0\n") (check! "verified-run: local inspection budget permits the first edit" (slurp target-path) "fixed\n") - (check-pred! "verified-run: local inspection budget refuses the seventh read" + (check-pred! "verified-run: local inspection pressure forces edit before more reads" (reverse tool-results) (lambda (xs) - (let loop ([ys xs]) - (cond - [(null? ys) #f] - [(and (str-contains? (car ys) "[ToolRecoverableError]") - (str-contains? (car ys) - "local-model pre-edit inspection limit reached")) #t] - [else (loop (cdr ys))]))))) + (and (member "one" xs) + (member "two" xs) + (member "three" xs) + (member "four" xs) + (not (member "five" xs)) + (let loop ([ys xs]) + (and (pair? ys) + (or (str-contains? (car ys) "wrote jcode-verified-local-inspection-budget.txt") + (loop (cdr ys))))))))) (safe-delete-test-file! target-path)) (let* ([vr-dir "/tmp/jcode-verified-local-force-schema"] @@ -3709,8 +3711,8 @@ (check-pred! "verified-run: local combined pressure hides inspection schemas" (reverse seen-specs) (lambda (xs) - (and (>= (length xs) 6) - (let ([names (list-ref xs 5)]) + (and (>= (length xs) 5) + (let ([names (list-ref xs 4)]) (and (member "edit" names) (member "write" names) (not (member "read" names)) @@ -3825,23 +3827,27 @@ (cons (message-content m) tool-results)))))))]) (check! "verified-run: navigation budget still reaches verify" result "VERIFIED: exit 0\n") - (check-pred! "verified-run: seventh directory navigation is refused" + (check-pred! "verified-run: local navigation pressure forces edit before more lists" (reverse tool-results) (lambda (xs) - (let loop ([ys xs]) - (cond - [(null? ys) #f] - [(str-contains? (car ys) - "local-model pre-edit navigation limit reached") #t] - [else (loop (cdr ys))])))) - (check-pred! "verified-run: navigation does not consume focused read budget" + (and (let loop ([ys xs]) + (and (pair? ys) + (or (str-contains? (car ys) + "wrote jcode-verified-local-navigation-budget.txt") + (loop (cdr ys))))) + (let loop ([ys xs]) + (or (null? ys) + (and (not (str-contains? (car ys) "missing-nav-c")) + (not (str-contains? (car ys) "missing-nav-d")) + (not (str-contains? (car ys) "missing-nav-e")) + (loop (cdr ys)))))))) + (check-pred! "verified-run: forced edit skips deferred focused read" (reverse tool-results) (lambda (xs) (let loop ([ys xs]) - (cond - [(null? ys) #f] - [(str-contains? (car ys) "api-marker") #t] - [else (loop (cdr ys))]))))) + (or (null? ys) + (and (not (str-contains? (car ys) "api-marker")) + (loop (cdr ys)))))))) (safe-delete-test-file! target-path)) (let* ([vr-dir "/tmp"]