Commitbe716823Recorded5 Apr 2026Repositorysigil-log

Harden MCP server guard and log formatting against secondary crashes

Message

Wrap format-exception and log-error in the tool call guard with their own guards so a failure in error formatting or logging cannot escape and crash the server. Make format-text-field in sigil-log defensive against non-keyword field keys instead of crashing with keyword->string.

Changed
 src/sigil/log.sgl | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Diff
src/sigil/log.sglmodified
@@ -202,7 +202,10 @@
202
203
;; Format a keyword-value pair for text output.
204
(define (format-text-field pair)
205
(let ((key (keyword->string (car pair)))
+205
(let ((key (if (keyword? (car pair))
+206
(keyword->string (car pair))
+207
(call-with-output-string
+208
(lambda (p) (write (car pair) p)))))
209
(val (cdr pair)))
210
(string-append key "=" (if (string? val)
211
val