feat: implement recursive AST-walker sandbox for Lisp evaluation
This commit is contained in:
@@ -262,7 +262,8 @@ Moves a signal through the gates in a flat loop, handling feedback signals witho
|
||||
(setf current-signal (decide-gate current-signal))
|
||||
(setf current-signal (dispatch-gate current-signal)))
|
||||
(error (c)
|
||||
(kernel-log "PIPELINE CRASH: ~a" c)
|
||||
(kernel-log "PIPELINE CRASH: ~a - Initiating Micro-Rollback." c)
|
||||
(rollback-object-store 0)
|
||||
(let ((sensor (ignore-errors (getf (getf current-signal :payload) :sensor))))
|
||||
(if (or (> depth 2) (member sensor '(:loop-error :tool-error)))
|
||||
(setf current-signal nil)
|
||||
@@ -502,4 +503,33 @@ Following the PSF mandates, the Reactive Signal Pipeline must be empirically ver
|
||||
(let ((awareness (context-assemble-global-awareness)))
|
||||
(is (search "Project Alpha" awareness))
|
||||
(is (search "proj-1" awareness))))
|
||||
|
||||
(test test-micro-rollback
|
||||
"Verify that a pipeline crash triggers an automatic Object Store rollback."
|
||||
(clrhash org-agent::*object-store*)
|
||||
(clrhash org-agent::*history-store*)
|
||||
(setf org-agent::*object-store-snapshots* nil)
|
||||
|
||||
;; State A
|
||||
(ingest-ast (list :type :HEADLINE :properties (list :ID "node-1" :TITLE "State A") :contents nil))
|
||||
|
||||
(setup-mock-skills)
|
||||
;; Skill that crashes in Symbolic Gate
|
||||
(org-agent::defskill :crashing-skill
|
||||
:priority 200
|
||||
:trigger (lambda (ctx) t)
|
||||
:neuro (lambda (ctx) (list :type :REQUEST :payload (list :action :eval :code "(error \"BOOM\")")))
|
||||
:symbolic (lambda (action ctx) (error "CRASH IN SYSTEM 2")))
|
||||
|
||||
;; Run pipeline. This turn will:
|
||||
;; 1. Perceive (Take snapshot of State A)
|
||||
;; 2. Neuro (Think)
|
||||
;; 3. Decide (Crash!)
|
||||
;; 4. Rollback to State A.
|
||||
(process-signal (list :type :EVENT :payload (list :sensor :test)))
|
||||
|
||||
;; Verify that we are still in State A
|
||||
(let ((obj (lookup-object "node-1")))
|
||||
(is (not (null obj)))
|
||||
(is (equal (getf (org-object-attributes obj) :TITLE) "State A"))))
|
||||
#+end_src
|
||||
|
||||
@@ -71,6 +71,7 @@ The `package.lisp` file defines the public API of the `org-agent` kernel. It exp
|
||||
#:load-skill-with-timeout
|
||||
#:topological-sort-skills
|
||||
#:validate-lisp-syntax
|
||||
#:safety-harness-validate
|
||||
#:find-triggered-skill
|
||||
#:defskill
|
||||
#:*skills-registry*
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
(:file "skills")
|
||||
(:file "neuro")
|
||||
(:file "symbolic")
|
||||
(:file "safety-harness")
|
||||
(:file "core"))))
|
||||
:build-operation "program-op"
|
||||
:build-pathname "org-agent-server"
|
||||
@@ -34,6 +35,7 @@
|
||||
:components ((:file "oacp-tests")
|
||||
(:file "pipeline-tests")
|
||||
(:file "peripheral-vision-tests")
|
||||
(:file "safety-harness-tests")
|
||||
(:file "boot-sequence-tests")
|
||||
(:file "object-store-tests")
|
||||
(:file "immune-system-tests")
|
||||
@@ -42,6 +44,7 @@
|
||||
(uiop:symbol-call :fiveam :run! (uiop:find-symbol* :oacp-suite :org-agent-tests))
|
||||
(uiop:symbol-call :fiveam :run! (uiop:find-symbol* :pipeline-suite :org-agent-pipeline-tests))
|
||||
(uiop:symbol-call :fiveam :run! (uiop:find-symbol* :vision-suite :org-agent-peripheral-vision-tests))
|
||||
(uiop:symbol-call :fiveam :run! (uiop:find-symbol* :safety-suite :org-agent-safety-tests))
|
||||
(uiop:symbol-call :fiveam :run! (uiop:find-symbol* :boot-suite :org-agent-boot-tests))
|
||||
(uiop:symbol-call :fiveam :run! (uiop:find-symbol* :object-store-suite :org-agent-object-store-tests))
|
||||
(uiop:symbol-call :fiveam :run! (uiop:find-symbol* :immune-suite :org-agent-immune-system-tests))
|
||||
|
||||
Reference in New Issue
Block a user