Force remote first edits sooner
ober
729de25e71f335ee8274165aaddfa5e7bac48c91
--- a/src/jcode/core/verified-run.ss +++ b/src/jcode/core/verified-run.ss @@ -298,12 +298,13 @@ #f) ;; Keep cheap directory navigation separate from source inspection, ;; so locating an approved dependency does not consume every read. - ((and (current-verified-local-model?) - (= (current-successful-edit-count) 0) + ((and (= (current-successful-edit-count) 0) (not (current-rejected-ss-draft)) (not (current-pending-ss-create-repair)) (>= (pre-edit-inspection-total) - local-force-first-edit-inspection-count) + (if (current-verified-local-model?) + local-force-first-edit-inspection-count + remote-force-first-edit-inspection-count)) (verified-inspection-tool-spec? spec)) #f) ((and (= (current-successful-edit-count) 0) @@ -391,7 +392,7 @@ (def remote-pre-edit-inspection-limit 12) (def remote-pre-edit-navigation-limit 10) -(def remote-force-first-edit-inspection-count 10) +(def remote-force-first-edit-inspection-count 6) (def local-force-first-edit-inspection-count 5) (def (pre-edit-inspection-total) --- a/test/run.ss +++ b/test/run.ss @@ -3467,6 +3467,71 @@ (safe-delete-test-file! makefile) (safe-delete-test-file! runner)) + (let* ([vr-dir "/tmp/jcode-verified-remote-force-schema"] + [target "remote-force-schema.txt"] + [target-path (string-append vr-dir "/" target)] + [test-dir (string-append vr-dir "/test")] + [makefile (string-append vr-dir "/Makefile")] + [runner (string-append test-dir "/run-tests.sh")] + [seen-specs '()] + [i 0] + [provider + (lambda (_messages tool-specs _step) + (set! seen-specs + (cons (map tool-spec-name tool-specs) seen-specs)) + (set! i (+ i 1)) + (cond + [(= i 1) + (list (make-wtool-call "list" '(("path" . ".")) #f))] + [(= i 2) + (list (make-wtool-call "read" '(("path" . "Makefile")) #f))] + [(= i 3) + (list (make-wtool-call "list" '(("path" . "test")) #f))] + [(= i 4) + (list (make-wtool-call "read" '(("path" . "test/run-tests.sh")) #f))] + [(= i 5) + (list (make-wtool-call "list" '(("path" . ".")) #f))] + [(= i 6) + (list (make-wtool-call "read" '(("path" . "Makefile")) #f))] + [(= i 7) + (list (make-wtool-call "edit" + (list (cons "path" target) + (cons "content" "fixed\n")) #f))] + [else + (list (make-wtool-call "verify" '() #f))]))]) + (ensure-test-directory! vr-dir) + (ensure-test-directory! test-dir) + (safe-delete-test-file! target-path) + (write-test-output-file makefile + (lambda (o) (display ".PHONY: test\n" o)) 'replace) + (write-test-output-file runner + (lambda (o) (display "#!/usr/bin/env bash\n" o)) 'replace) + (let ([result + (verified-run (provider-responder provider) + "hide remote inspection schemas after combined pressure" + (list + (cons 'cwd vr-dir) + (cons 'verify-command + (string-append "grep -q fixed " target)) + (cons 'write-scope (parse-write-scope target)) + (cons 'max-iterations 12) + (cons 'max-tool-errors 0)))]) + (check! "verified-run: remote combined inspection pressure still verifies" + result "VERIFIED: exit 0\n") + (check-pred! "verified-run: remote combined pressure hides inspection schemas" + (reverse seen-specs) + (lambda (xs) + (and (>= (length xs) 7) + (let ([names (list-ref xs 6)]) + (and (member "edit" names) + (member "write" names) + (not (member "read" names)) + (not (member "list" names)) + (not (member "balance" names)))))))) + (safe-delete-test-file! target-path) + (safe-delete-test-file! makefile) + (safe-delete-test-file! runner)) + (let* ([vr-dir "/tmp"] [target "jcode-verified-local-navigation-budget.txt"] [target-path (string-append vr-dir "/" target)] @@ -6213,18 +6278,18 @@ [responder (lambda (_messages specs _step) (set! calls (+ calls 1)) - (when (= calls 11) + (when (= calls 7) (set! forced-spec-names (map tool-spec-name specs))) (cond - [(<= calls 10) (read-call calls)] - [(= calls 11) + [(<= calls 6) (read-call calls)] + [(= calls 7) ;; Simulate a remote model ignoring the narrowed schema. (read-call calls)] - [(= calls 12) + [(= calls 8) (list (make-wtool-call "edit" (list (cons "path" target) (cons "content" "fixed\n")) #f))] - [(= calls 13) + [(= calls 9) (list (make-wtool-call "verify" '() #f))] [else (error 'test "unexpected remote first-edit force step")]))]) (safe-delete-test-file! target-path) @@ -6264,7 +6329,7 @@ (check! "verified-run: hidden remote read was not executed" (length (filter (lambda (s) (str-contains? s "context-")) (reverse tool-results))) - 10) + 6) (check! "verified-run: forced first-edit marker is not assistant prose" (let loop ([xs seen-messages]) (cond