fix(skills): finalize reconstructions for diagnostics and llm-gateway

This commit is contained in:
2026-04-28 19:18:11 -04:00
parent ad891a86e6
commit 8ad7443d3f
2 changed files with 42 additions and 42 deletions

View File

@@ -6,38 +6,6 @@
* Overview
The *LLM Gateway* skill provides a unified interface for interacting with multiple Large Language Model providers.
* Test Suite
#+begin_src lisp :tangle org-skill-llm-gateway.lisp
(defpackage :opencortex-llm-gateway-tests
(:use :cl :opencortex)
(:export #:llm-gateway-suite))
(in-package :opencortex-llm-gateway-tests)
(eval-when (:compile-toplevel :load-toplevel :execute)
(ql:quickload :fiveam))
(fiveam:def-suite llm-gateway-suite :description "Tests for the LLM Gateway skill
(fiveam:in-suite llm-gateway-suite)
(fiveam:test test-llm-gateway-timeout
"Tier 2 Chaos: Verify that LLM Gateway handles connection failures gracefully."
(let ((old-host (uiop:getenv "OLLAMA_HOST))
(unwind-protect
(progn
(setf (uiop:getenv "OLLAMA_HOST "localhost:1
(let ((fn (or (find-symbol "EXECUTE-LLM-REQUEST" :opencortex.skills.org-skill-llm-gateway)
(find-symbol "EXECUTE-LLM-REQUEST" :opencortex))))
(if fn
(let ((result (funcall fn :prompt "hello" :provider :ollama)))
(fiveam:is (eq (getf result :status) :error))
(fiveam:is (uiop:string-prefix-p "Ollama Failure" (getf result :message))))
(fiveam:fail "Could not find EXECUTE-LLM-REQUEST symbol)))
(if old-host
(setf (uiop:getenv "OLLAMA_HOST old-host)
(sb-posix:unsetenv "OLLAMA_HOST))))
#+end_src
* Implementation
** Package Context
@@ -65,3 +33,35 @@ The *LLM Gateway* skill provides a unified interface for interacting with multip
:trigger (lambda (ctx) (getf ctx :user-input))
:deterministic (lambda (action ctx) (declare (ignore ctx)) action))
#+end_src
* Test Suite
#+begin_src lisp :tangle tests/llm-gateway-tests.lisp
(eval-when (:compile-toplevel :load-toplevel :execute)
(ql:quickload :fiveam :silent t))
(defpackage :opencortex-llm-gateway-tests
(:use :cl :opencortex)
(:export #:llm-gateway-suite))
(in-package :opencortex-llm-gateway-tests)
(fiveam:def-suite llm-gateway-suite :description "Tests for the LLM Gateway skill")
(fiveam:in-suite llm-gateway-suite)
(fiveam:test test-llm-gateway-timeout
"Tier 2 Chaos: Verify that LLM Gateway handles connection failures gracefully."
(let ((old-host (uiop:getenv "OLLAMA_HOST")))
(unwind-protect
(progn
(setf (uiop:getenv "OLLAMA_HOST") "localhost:1")
(let ((fn (or (find-symbol "EXECUTE-LLM-REQUEST" :opencortex.skills.org-skill-llm-gateway)
(find-symbol "EXECUTE-LLM-REQUEST" :opencortex))))
(if fn
(let ((result (funcall fn :prompt "hello" :provider :ollama)))
(fiveam:is (eq (getf result :status) :error))
(fiveam:is (uiop:string-prefix-p "Ollama Failure" (getf result :message))))
(fiveam:fail "Could not find EXECUTE-LLM-REQUEST symbol"))))
(if old-host
(setf (uiop:getenv "OLLAMA_HOST") old-host)
(uiop:run-program (list "unset" "OLLAMA_HOST") :ignore-error-status t)))))
#+end_src