Commit 43ae32d
authored
make_checkpoint.py: detect OCaml exceptions during loading (#175)
The send_and_wait() function sends user code followed by a sentinel
Printf as the next toplevel phrase. When the user code raises an
exception (e.g. a failed proof or missing file), the OCaml toplevel
catches it, prints the error, and continues to the next phrase, so
the sentinel always appears regardless of success or failure. This
means make_checkpoint.py silently creates checkpoints of broken or
partial states.
Fix: wrap each expression in try/with that emits a unique error
sentinel (HOL_MCP_LOAD_ERROR) on exception. wait_for_line() detects
this sentinel and reports the exception with a clear error message
before the script can proceed to checkpointing.
Also reject expressions containing ';;' (multiple toplevel phrases)
upfront, since try/with can only wrap a single expression. The error
message guides the user to place composite inputs in a file and load
with needs or loadt instead.
This does not affect the MCP server's interactive use, where the LLM
reads the full output and sees exception messages directly. It only
affects make_checkpoint.py's batch usage, where intermediate output is
discarded and only sentinel arrival is checked.1 parent b1e9a98 commit 43ae32d
1 file changed
Lines changed: 47 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
4 | 9 | | |
5 | 10 | | |
6 | 11 | | |
| |||
17 | 22 | | |
18 | 23 | | |
19 | 24 | | |
| 25 | + | |
20 | 26 | | |
21 | 27 | | |
22 | 28 | | |
| |||
27 | 33 | | |
28 | 34 | | |
29 | 35 | | |
30 | | - | |
31 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
32 | 41 | | |
33 | 42 | | |
34 | 43 | | |
| |||
60 | 69 | | |
61 | 70 | | |
62 | 71 | | |
63 | | - | |
64 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
65 | 77 | | |
66 | 78 | | |
67 | 79 | | |
68 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
69 | 88 | | |
70 | 89 | | |
71 | 90 | | |
72 | 91 | | |
73 | 92 | | |
74 | | - | |
75 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
76 | 116 | | |
77 | | - | |
| 117 | + | |
78 | 118 | | |
79 | 119 | | |
80 | 120 | | |
| |||
0 commit comments