Keep no-expert draft inspection available

ober

b72b2c8949853dcfe6d70f1119321d7f80c6257b

diff --git a/src/jcode/core/verified-run.ss b/src/jcode/core/verified-run.ss
index 8df6efe..8a8c6cb 100644
--- a/src/jcode/core/verified-run.ss
+++ b/src/jcode/core/verified-run.ss
@@ -190,19 +190,19 @@
 
 (def (verified-staged-repair-tool-spec? spec)
   (member (tool-spec-name spec)
-          '("line_edit" "replace_def" "replace_range" "verify")))
+          '("read" "balance" "line_edit" "replace_def" "replace_range" "verify")))
 
 (def (verified-syntax-create-staged-tool-spec? spec)
   (member (tool-spec-name spec)
-          '("edit" "write" "line_edit" "replace_def" "replace_range")))
+          '("read" "balance" "edit" "write" "line_edit" "replace_def" "replace_range")))
 
 (def (verified-missing-create-staged-tool-spec? spec)
   (member (tool-spec-name spec)
-          '("edit" "write" "line_edit" "replace_def" "replace_range" "verify")))
+          '("read" "balance" "edit" "write" "line_edit" "replace_def" "replace_range" "verify")))
 
 (def (verified-missing-create-repair-tool-spec? spec)
   (member (tool-spec-name spec)
-          '("edit" "write" "line_edit" "replace_def" "replace_range")))
+          '("read" "balance" "edit" "write" "line_edit" "replace_def" "replace_range")))
 
 (def (verified-current-create-draft-tool-spec? spec)
   (if (incomplete-rejected-ss-create-draft?)
@@ -2570,14 +2570,16 @@
                 0))))
       (when (and (current-verified-local-model?)
                  same-path?
+                 (config-expert-enabled?)
                  (>= path-reject-count local-expert-after-rejected-drafts))
         ;; The latest full tool arguments and syntax diagnostic are in history,
         ;; so the expert can patch staging without another broad inspection.
+        ;; When experts are disabled, keep local read/balance inspection
+        ;; available so no-expert benchmark runs can still recover.
         (current-rejected-draft-inspections
           (+ rejected-draft-inspection-limit 1))
         (current-rejected-draft-needs-inspection #f)
-        (when (config-expert-enabled?)
-          (current-force-expert-next? #t)))
+        (current-force-expert-next? #t))
       repeat-result)))
 
 (def (rejected-draft-repeat-note path)
@@ -3024,7 +3026,11 @@
     "Prefer the smallest repair around the reported line; a full replacement remains available as write(path=\""
     path
     "\", content=<complete corrected file contents>). "
-    "Do not call run, bash, shell, list, read, cat, ls, balance, verify, MCP tools, "
+    "Use read(path=\""
+    path
+    "\", start=<near reported line>, end=<near reported line>) or balance(path=\""
+    path
+    "\") only if the reported span is ambiguous. Do not call run, bash, shell, list, cat, ls, verify, MCP tools, "
     "until a staged repair passes the syntax guard and is promoted to disk."))
 
 (def (rejected-draft-limit-message path content)
@@ -3112,8 +3118,10 @@
            path
            "\", start=<start>, end=<end>, content=<complete corrected span>) "
            "for a structural span. The file does not exist on disk until the "
-           "staged repair passes the syntax guard; do not call verify, read, "
-           "list, balance, MCP, edit, or write before that repair is promoted."))))
+           "staged repair passes the syntax guard; use read/balance only on "
+           path
+           " if the retained draft span is ambiguous, and do not call verify, "
+           "list, MCP, edit, or write before that repair is promoted."))))
 
 (def (staged-create-broad-write-block-message cwd name args)
   #f)
diff --git a/test/run.ss b/test/run.ss
index f88415e..70c0c12 100644
--- a/test/run.ss
+++ b/test/run.ss
@@ -3894,9 +3894,10 @@
 		             (member "replace_range" names)
 		             (member "edit" names)
 		             (member "write" names)
+		             (member "read" names)
+		             (member "balance" names)
 		             (not (member "verify" names))
-	             (not (member "read" names))
-	             (not (member "balance" names)))))
+	             (not (member "list" names)))))
 	    (check! "verified-run: local staged line edit promotes repaired file"
 	            (slurp target-path)
 	            (string-append "(import (jerboa prelude))\n" good-line "\n")))
@@ -4762,6 +4763,68 @@
 	  (safe-delete-test-file! target-path))
 
 	(let* ([vr-dir "/tmp"]
+	       [target "jcode-local-no-expert-staged-draft-read.ss"]
+	       [target-path (string-append vr-dir "/" target)]
+	       [bad-a "(import (jerboa prelude))\n(def (main)\n  (displayln \"bad\")))\n"]
+	       [bad-b "(import (jerboa prelude))\n(def (main)\n  (displayln \"still bad\")))\n"]
+	       [tool-names-after-repeat '()]
+	       [tool-results '()]
+	       [calls 0]
+	       [responder
+	         (lambda (_messages tools _step)
+	           (set! calls (+ calls 1))
+	           (when (= calls 3)
+	             (set! tool-names-after-repeat (map tool-spec-name tools)))
+	           (case calls
+	             [(1) (list (make-wtool-call "write"
+	                         (list (cons "path" target)
+	                               (cons "content" bad-a)) #f))]
+	             [(2) (list (make-wtool-call "write"
+	                         (list (cons "path" target)
+	                               (cons "content" bad-b)) #f))]
+	             [(3) (list (make-wtool-call "read"
+	                         (list (cons "path" target)) #f))]
+	             [(4) (list (make-wtool-call "line_edit"
+	                         (list (cons "path" target)
+	                               (cons "line" 3)
+	                               (cons "content" "  (displayln \"fixed\"))")) #f))]
+	             [else (error 'test "no-expert staged draft read should auto-verify")]))])
+	  (safe-delete-test-file! target-path)
+	  (let ([result
+	          (parameterize ([current-expert-disabled #t])
+	            (verified-run responder "inspect retained missing-file draft without experts"
+	              (list
+	                (cons 'cwd vr-dir)
+	                (cons 'verify-command (string-append "grep -q fixed " target))
+	                (cons 'write-scope (parse-write-scope target))
+	                (cons 'local-model? #t)
+	                (cons 'max-iterations 10)
+	                (cons 'max-tool-errors 4)
+	                (cons 'on-message
+	                  (lambda (m)
+	                    (when (equal? (message-role m) "tool")
+	                      (set! tool-results
+	                        (cons (message-content m) tool-results))))))))])
+	    (check! "verified-run: no-expert staged draft read verifies"
+	            result "VERIFIED: exit 0\n"))
+	  (check-pred! "verified-run: no-expert staged draft keeps read visible"
+	    tool-names-after-repeat (lambda (names) (member "read" names)))
+	  (check-pred! "verified-run: no-expert staged draft keeps balance visible"
+	    tool-names-after-repeat (lambda (names) (member "balance" names)))
+	  (check-pred! "verified-run: no-expert staged draft read returns retained draft"
+	    (reverse tool-results)
+	    (lambda (xs)
+	      (let loop ([ys xs])
+	        (cond
+	          [(null? ys) #f]
+	          [(and (str-contains? (car ys) "Rejected draft for")
+	                (str-contains? (car ys) "still bad")
+	                (not (str-contains? (car ys) "Unknown tool 'read'")))
+	           #t]
+	          [else (loop (cdr ys))]))))
+	  (safe-delete-test-file! target-path))
+
+	(let* ([vr-dir "/tmp"]
 	       [target "jcode-local-rejected-draft-read-after-failure.ss"]
 	       [target-path (string-append vr-dir "/" target)]
 	       [initial "(import (jerboa prelude))\n(def value \"broken\")\n"]
@@ -8077,7 +8140,7 @@
                            (cons 'max-tool-errors 3))))])
     (check! "verified-run: missing create schema repair reaches done"
             result "missing-create-schema-ok")
-    (check-pred! "verified-run: syntax create repair hides broad schemas"
+    (check-pred! "verified-run: syntax create repair keeps draft inspection"
       (reverse seen-specs)
       (lambda (xs)
         (and (>= (length xs) 2)
@@ -8087,9 +8150,9 @@
                     (member "replace_range" names)
 	                    (member "edit" names)
 	                    (member "write" names)
-                    (not (member "read" names))
+                    (member "read" names)
+                    (member "balance" names)
                     (not (member "list" names))
-                    (not (member "balance" names))
                     (not (member "verify" names))))))))
 	  (safe-delete-test-file! target-path))