fix(tui): Definitive fix for status leakage and error visibility
Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 3s

This commit is contained in:
2026-04-19 17:53:57 -04:00
parent 199c5d09a1
commit 8b7d4c1b9c
2 changed files with 26 additions and 22 deletions

View File

@@ -54,17 +54,19 @@ The OpenCortex TUI Client is a standalone Common Lisp application built on **Cro
(let ((raw-msg (opencortex:read-framed-message *stream*)))
(unless (member raw-msg '(:eof :error))
(let ((msg (clean-keywords raw-msg)))
(cond ((and (listp msg) (eq (getf msg :TYPE) :EVENT))
(let ((payload (getf msg :PAYLOAD)))
(when (eq (getf payload :ACTION) :handshake)
(setf *status-text* "Ready"))))
((and (listp msg) (eq (getf msg :TYPE) :STATUS))
(setf *status-text* (format nil "[Scribe: ~a] [Gardener: ~a]"
(getf msg :SCRIBE)
(getf msg :GARDENER))))
((and (listp msg) (eq (getf msg :TYPE) :CHAT))
(enqueue-msg (getf msg :TEXT)))
(t (enqueue-msg (format nil "~s" msg))))))
(let* ((msg (clean-keywords raw-msg))
(type (or (getf msg :TYPE) (getf msg :type))))
(cond ((eq type :EVENT)
(let ((payload (or (getf msg :PAYLOAD) (getf msg :payload))))
(when (eq (or (getf payload :ACTION) (getf payload :action)) :handshake)
(setf *status-text* "Ready"))))
((eq type :STATUS)
(setf *status-text* (format nil "[Scribe: ~a] [Gardener: ~a]"
(or (getf msg :SCRIBE) (getf msg :scribe))
(or (getf msg :GARDENER) (getf msg :gardener)))))
((eq type :CHAT)
(enqueue-msg (or (getf msg :TEXT) (getf msg :text))))
(t (enqueue-msg (format nil "~s" msg))))))))
(when (eq raw-msg :eof) (setf *is-running* nil))
(when (eq raw-msg :error) (setf *status-text* "Protocol Error"))))
(error (c) (setf *status-text* (format nil "Net Error: ~a" c)) (setf *is-running* nil)))

View File

@@ -41,17 +41,19 @@
(let ((raw-msg (opencortex:read-framed-message *stream*)))
(unless (member raw-msg '(:eof :error))
(let ((msg (clean-keywords raw-msg)))
(cond ((and (listp msg) (eq (getf msg :TYPE) :EVENT))
(let ((payload (getf msg :PAYLOAD)))
(when (eq (getf payload :ACTION) :handshake)
(setf *status-text* "Ready"))))
((and (listp msg) (eq (getf msg :TYPE) :STATUS))
(setf *status-text* (format nil "[Scribe: ~a] [Gardener: ~a]"
(getf msg :SCRIBE)
(getf msg :GARDENER))))
((and (listp msg) (eq (getf msg :TYPE) :CHAT))
(enqueue-msg (getf msg :TEXT)))
(t (enqueue-msg (format nil "~s" msg))))))
(let* ((msg (clean-keywords raw-msg))
(type (or (getf msg :TYPE) (getf msg :type))))
(cond ((eq type :EVENT)
(let ((payload (or (getf msg :PAYLOAD) (getf msg :payload))))
(when (eq (or (getf payload :ACTION) (getf payload :action)) :handshake)
(setf *status-text* "Ready"))))
((eq type :STATUS)
(setf *status-text* (format nil "[Scribe: ~a] [Gardener: ~a]"
(or (getf msg :SCRIBE) (getf msg :scribe))
(or (getf msg :GARDENER) (getf msg :gardener)))))
((eq type :CHAT)
(enqueue-msg (or (getf msg :TEXT) (getf msg :text))))
(t (enqueue-msg (format nil "~s" msg))))))))
(when (eq raw-msg :eof) (setf *is-running* nil))
(when (eq raw-msg :error) (setf *status-text* "Protocol Error"))))
(error (c) (setf *status-text* (format nil "Net Error: ~a" c)) (setf *is-running* nil)))