#+TITLE: SKILL: Chaos Gauntlet (Universal Literate Note) #+ID: skill-chaos #+STARTUP: content #+FILETAGS: :chaos:testing:reliability:psf: #+DEPENDS_ON: skill-shell-actuator skill-tdd-runner * Overview The **Chaos Gauntlet** is an adversarial testing skill designed to ensure the system's resilience. It simulates environmental failures, malformed LLM responses, and network disruptions, forcing the kernel and its skills to handle "Byzantine" conditions gracefully. * Phase A: Demand (PRD) :PROPERTIES: :STATUS: FROZEN :END: ** 1. Purpose Verify the system's stability and error-handling capabilities under stress. ** 2. User Needs - **Failure Simulation:** Ability to inject artificial delays or errors into the OACP bus. - **Byzantine Response Testing:** Test how System 2 handles nonsensical or malicious System 1 proposals. - **Network Resilience:** Simulate Gitea or LLM provider timeouts. - **Recovery Verification:** Ensure the kernel can recover from a "skip-event" restart. * Phase D: Build (Implementation) ** Chaos Injection Logic #+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: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"))))) #+end_src * Registration #+begin_src lisp (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)) #+end_src