Class: OllamaAgent::Runtime::IsolatedValidator
- Inherits:
-
Object
- Object
- OllamaAgent::Runtime::IsolatedValidator
- Defined in:
- lib/ollama_agent/runtime/isolated_validator.rb
Overview
Runs array-exec validation commands inside a locked-down Docker container (no host shell). rubocop:disable Metrics/ClassLength – Docker argv + capture + status interpretation stay together
Instance Method Summary collapse
-
#initialize(image:, workspace_root:, runtime_command: "docker", timeout_epochs: 300, wal: nil) ⇒ IsolatedValidator
constructor
A new instance of IsolatedValidator.
-
#run(command:, manifest_id:, logical_stamp:) ⇒ Hash
Keys:
:status,:exit_code,:stdout,:stderr,:image_digest.
Constructor Details
#initialize(image:, workspace_root:, runtime_command: "docker", timeout_epochs: 300, wal: nil) ⇒ IsolatedValidator
Returns a new instance of IsolatedValidator.
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ollama_agent/runtime/isolated_validator.rb', line 15 def initialize(image:, workspace_root:, runtime_command: "docker", timeout_epochs: 300, wal: nil) @image = image @workspace_root = File.(workspace_root) @runtime_command = runtime_command @timeout_epochs = timeout_epochs.to_i @wal = wal @digest_memo = :unset @runtime_checked = false @runtime_ok = false end |
Instance Method Details
#run(command:, manifest_id:, logical_stamp:) ⇒ Hash
Returns keys: :status, :exit_code, :stdout, :stderr, :image_digest.
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ollama_agent/runtime/isolated_validator.rb', line 30 def run(command:, manifest_id:, logical_stamp:) assert_array_command!(command) digest = cached_image_digest return unavailable_result(digest) unless runtime_ok? argv = docker_argv(command) status, code, out, err = execute_docker(argv) result = base_result(status, code, out, err, digest) record_mutation_step(manifest_id, logical_stamp, result, command) if record_step?(status) result end |