PSF: Stabilizing workspace after crash. Valid kernel/skill fixes.
This commit is contained in:
@@ -24,20 +24,28 @@ Verify the system's stability and error-handling capabilities under stress.
|
||||
* Phase D: Build (Implementation)
|
||||
|
||||
** Chaos Injection Logic
|
||||
#+begin_src lisp :tangle projects/org-skill-chaos/src/chaos-logic.lisp
|
||||
#+begin_src lisp :tangle ../projects/org-skill-chaos/src/chaos-logic.lisp
|
||||
(defun chaos-inject-error (sensor-type)
|
||||
"Injects a synthetic error into a specific sensor pipeline."
|
||||
(kernel-log "CHAOS - Injecting synthetic error into ~a sensor..." sensor-type)
|
||||
(org-agent:kernel-log "CHAOS - Injecting synthetic error into ~a sensor..." sensor-type)
|
||||
(org-agent:inject-stimulus
|
||||
`(:type :EVENT :payload (:sensor ,sensor-type :error "SYNTHETIC_CHAOS_ERROR"))))
|
||||
|
||||
(defun chaos-test-gitea-timeout ()
|
||||
"Simulates a Gitea connection timeout."
|
||||
(let ((gitea-url (org-agent::get-env "GITEA_URL" "http://localhost:3000")))
|
||||
(kernel-log "CHAOS - Simulating timeout for Gitea at ~a" gitea-url)
|
||||
;; Mock timeout by wrapping a call with an immediate failure
|
||||
(org-agent:inject-stimulus
|
||||
`(:type :EVENT :payload (:sensor :shell-response :cmd "git push" :exit-code 128 :stderr "fatal: connection timed out")))))
|
||||
(defun chaos-stress-test (action context)
|
||||
"Executes a randomized stress test by injecting failures into the system."
|
||||
(declare (ignore context))
|
||||
(let* ((payload (getf action :payload))
|
||||
(mode (or (getf payload :mode) :random))
|
||||
(intensity (or (getf payload :intensity) 3)))
|
||||
(org-agent:kernel-log "CHAOS - Commencing stress test (Mode: ~a, Intensity: ~a)" mode intensity)
|
||||
(case mode
|
||||
(:random (dotimes (i intensity)
|
||||
(let ((failure-type (nth (random 3) '(:test-failure :shell-timeout :llm-error))))
|
||||
(org-agent:inject-stimulus
|
||||
`(:type :EVENT :payload (:sensor :chaos-injection :type ,failure-type))))))
|
||||
(:shell (org-agent:inject-stimulus
|
||||
`(:type :EVENT :payload (:sensor :shell-response :cmd "git push" :exit-code 128 :stderr "fatal: network unreachable")))))
|
||||
(format nil "SUCCESS - Chaos stress test initiated.")))
|
||||
#+end_src
|
||||
|
||||
* Registration
|
||||
@@ -45,6 +53,8 @@ Verify the system's stability and error-handling capabilities under stress.
|
||||
(defskill :skill-chaos
|
||||
:priority 10 ; Lower priority, used for background testing
|
||||
:trigger (lambda (context) (eq (getf (getf context :payload) :sensor) :chaos-trigger))
|
||||
:neuro (lambda (context) "Analyze the failure and verify recovery path.")
|
||||
:symbolic (lambda (action context) action))
|
||||
:neuro (lambda (context)
|
||||
(let ((p (getf context :payload)))
|
||||
(format nil "A chaos trigger was received (~a). Should I run a stress test?" (getf p :mode))))
|
||||
:symbolic #'chaos-stress-test)
|
||||
#+end_src
|
||||
|
||||
Reference in New Issue
Block a user