rubik 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ATTRIBUTION.md +1 -1
- data/CHANGELOG.md +61 -1
- data/lib/rubik/ast/extractor.rb +2 -1
- data/lib/rubik/ast/treesitter_extractor.rb +2 -1
- data/lib/rubik/benchmark/vakanuvis_adoption.rb +2 -1
- data/lib/rubik/config/secret_policy.rb +6 -5
- data/lib/rubik/config/store.rb +2 -1
- data/lib/rubik/config.rb +2 -2
- data/lib/rubik/context/ignore_rules.rb +193 -0
- data/lib/rubik/context/scanner.rb +46 -161
- data/lib/rubik/llm/client.rb +6 -200
- data/lib/rubik/llm/connection_pool.rb +104 -0
- data/lib/rubik/llm/registry.rb +3 -2
- data/lib/rubik/llm/sse_parser.rb +110 -0
- data/lib/rubik/lsp/circuit_breaker.rb +98 -0
- data/lib/rubik/lsp/client_provisioner.rb +49 -0
- data/lib/rubik/lsp/manager.rb +55 -88
- data/lib/rubik/mcp/manager.rb +25 -13
- data/lib/rubik/orchestrator/auto_apply.rb +4 -3
- data/lib/rubik/orchestrator/goal_ledger/ledger.rb +12 -1
- data/lib/rubik/orchestrator/goal_ledger/schema_vocabulary.rb +38 -0
- data/lib/rubik/orchestrator/goal_ledger/xml_render.rb +6 -1
- data/lib/rubik/orchestrator/goal_ledger.rb +1 -0
- data/lib/rubik/orchestrator/lsp_feedback.rb +1 -1
- data/lib/rubik/orchestrator/step_executor.rb +2 -1
- data/lib/rubik/orchestrator/subagent/notices.rb +2 -2
- data/lib/rubik/orchestrator/subagent/transcript_formatter.rb +2 -1
- data/lib/rubik/platform/io_drain.rb +3 -1
- data/lib/rubik/plugin/storage.rb +8 -8
- data/lib/rubik/repl/config_wiring.rb +5 -3
- data/lib/rubik/repl/input_execution.rb +4 -3
- data/lib/rubik/repl/lifecycle.rb +1 -1
- data/lib/rubik/repl/tee_io.rb +2 -1
- data/lib/rubik/runtime/ast_service.rb +2 -1
- data/lib/rubik/runtime/overlay_storage.rb +17 -17
- data/lib/rubik/runtime/task_manager.rb +1 -1
- data/lib/rubik/sandbox/runner.rb +5 -4
- data/lib/rubik/security/audit_log.rb +2 -1
- data/lib/rubik/security/command_gate.rb +11 -152
- data/lib/rubik/security/guard.rb +1 -1
- data/lib/rubik/security/secret_store.rb +32 -3
- data/lib/rubik/security/segment_report.rb +161 -0
- data/lib/rubik/session/recorder.rb +2 -1
- data/lib/rubik/skills/manager.rb +2 -1
- data/lib/rubik/storage/transcript_indexer.rb +3 -2
- data/lib/rubik/storage/vakanuvis.rb +2 -1
- data/lib/rubik/tools/builtins/goal_ledger.rb +12 -1
- data/lib/rubik/tools/builtins/synthesis.rb +3 -3
- data/lib/rubik/tools/preflight_runner.rb +2 -1
- data/lib/rubik/tools/uri_resolver.rb +3 -2
- data/lib/rubik/ui/capability.rb +1 -0
- data/lib/rubik/version.rb +1 -1
- data/lib/rubik.rb +3 -3
- metadata +8 -1
|
@@ -28,6 +28,11 @@ module Rubik
|
|
|
28
28
|
attrs += %( updated_at="#{@updated_at.utc.iso8601}") if @updated_at
|
|
29
29
|
body = []
|
|
30
30
|
body << %( <objective>#{esc.call(@doc['objective'].to_s)}</objective>)
|
|
31
|
+
# Statik gramer sözlüğü (Ledger.schema_vocabulary — SSOT türetme):
|
|
32
|
+
# durum-bağımsız tek satır; pinli Σ satırına sabit maliyet, modele
|
|
33
|
+
# kullanım anının dibinde kalıcı öğretim ("yokluk, boşluk değil"
|
|
34
|
+
# kuralı koleksiyonlar içindir — sözlük koleksiyon değildir).
|
|
35
|
+
body << %( <vocabulary>#{esc.call(Ledger.schema_vocabulary)}</vocabulary>)
|
|
31
36
|
tasks = @doc["tasks"].each_with_index.map do |task, idx|
|
|
32
37
|
text = task["title"].to_s
|
|
33
38
|
text += " — notes: #{task['notes']}" if task["notes"]
|
|
@@ -38,7 +43,7 @@ module Rubik
|
|
|
38
43
|
end
|
|
39
44
|
body << "<tasks>\n#{tasks.join("\n")}\n </tasks>" unless tasks.empty?
|
|
40
45
|
findings = @doc["findings"].each_with_index.map do |f, idx|
|
|
41
|
-
%( <finding id="#{esc.call(f['id'].to_s)}" source_step="#{f['source_step']}" index="#{idx}">#{esc.call(f['text'].to_s)}</finding>)
|
|
46
|
+
%( <finding id="#{esc.call(f['id'].to_s)}" source_step="#{esc.call(f['source_step'].to_s)}" index="#{idx}">#{esc.call(f['text'].to_s)}</finding>)
|
|
42
47
|
end
|
|
43
48
|
body << "<findings>\n#{findings.join("\n")}\n </findings>" unless findings.empty?
|
|
44
49
|
decisions = @doc["decisions"].each_with_index.map do |dec, idx|
|
|
@@ -57,6 +57,7 @@ end
|
|
|
57
57
|
|
|
58
58
|
require_relative "goal_ledger/patch"
|
|
59
59
|
require_relative "goal_ledger/schema"
|
|
60
|
+
require_relative "goal_ledger/schema_vocabulary"
|
|
60
61
|
require_relative "goal_ledger/validator"
|
|
61
62
|
require_relative "goal_ledger/ledger"
|
|
62
63
|
require_relative "goal_ledger/verify_spec"
|
|
@@ -37,7 +37,7 @@ module Rubik
|
|
|
37
37
|
# review, Plan 87). warn keeps the failure visible on stderr;
|
|
38
38
|
# ANSI stripping keeps LSP-server-controlled messages from
|
|
39
39
|
# injecting terminal escape sequences (red-team E1).
|
|
40
|
-
warn("LSP sync skipped: #{e.message.gsub(/\e\[[0-9;]*[A-Za-z]/, '')}")
|
|
40
|
+
Rubik::Log.warn(:lsp, "LSP sync skipped: #{e.message.gsub(/\e\[[0-9;]*[A-Za-z]/, '')}")
|
|
41
41
|
tool_result
|
|
42
42
|
end
|
|
43
43
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative "../log"
|
|
3
4
|
require_relative "finish_message_selector"
|
|
4
5
|
require_relative "auto_apply"
|
|
5
6
|
require_relative "tool_call_id"
|
|
@@ -217,7 +218,7 @@ module Rubik
|
|
|
217
218
|
sink.call(type: :user_output, content: raw_output.to_s, label: raw_output.display_stub,
|
|
218
219
|
step: @deps.step_count, max_steps: @deps.max_steps)
|
|
219
220
|
else
|
|
220
|
-
warn("[show_file] no :user_output sink wired — display content dropped: #{raw_output.display_stub}")
|
|
221
|
+
Rubik::Log.warn(:orchestrator, "[show_file] no :user_output sink wired — display content dropped: #{raw_output.display_stub}")
|
|
221
222
|
end
|
|
222
223
|
|
|
223
224
|
Rubik::Tools::Result.new(
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative "../../log"
|
|
3
4
|
require_relative "../../events"
|
|
4
5
|
require_relative "../../platform"
|
|
5
6
|
require_relative "budget"
|
|
@@ -69,7 +70,7 @@ module Rubik
|
|
|
69
70
|
rescue StandardError => e
|
|
70
71
|
raise if fallback.nil?
|
|
71
72
|
|
|
72
|
-
warn("#{fallback} (#{e.class}: #{e.message})")
|
|
73
|
+
Rubik::Log.warn(:orchestrator, "#{fallback} (#{e.class}: #{e.message})")
|
|
73
74
|
end
|
|
74
75
|
|
|
75
76
|
def normalize(event_name, payload)
|
|
@@ -191,7 +192,6 @@ module Rubik
|
|
|
191
192
|
end
|
|
192
193
|
|
|
193
194
|
DEFAULT_WAIT_TIMEOUT = 30
|
|
194
|
-
|
|
195
195
|
def render_ids(ids) = "[#{Array(ids).map { |id| "'#{id}'" }.join(', ')}]"
|
|
196
196
|
|
|
197
197
|
def wait_hint(ids, timeout: DEFAULT_WAIT_TIMEOUT) = "manage_subagents(action: 'wait', conversation_ids: #{render_ids(ids)}, timeout: #{timeout})"
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require "fileutils"
|
|
4
4
|
require "json"
|
|
5
5
|
require "digest"
|
|
6
|
+
require_relative "../../log"
|
|
6
7
|
require_relative "../../security/redactor"
|
|
7
8
|
require_relative "../../storage/layout"
|
|
8
9
|
require_relative "../../tools/truncator"
|
|
@@ -56,7 +57,7 @@ module Rubik
|
|
|
56
57
|
File.write(file_path, text)
|
|
57
58
|
file_path
|
|
58
59
|
rescue StandardError => e
|
|
59
|
-
warn("[Subagent transcript] Failed to save #{file_path}: #{e.class}: #{e.message}")
|
|
60
|
+
Rubik::Log.warn(:orchestrator, "[Subagent transcript] Failed to save #{file_path}: #{e.class}: #{e.message}")
|
|
60
61
|
nil
|
|
61
62
|
end
|
|
62
63
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative "../log"
|
|
4
|
+
|
|
3
5
|
module Rubik
|
|
4
6
|
module Platform
|
|
5
7
|
# Continuously drains a child-process IO (stderr) so a chatty child
|
|
@@ -34,7 +36,7 @@ module Rubik
|
|
|
34
36
|
# time it is the watchdog dying while the child may still flood
|
|
35
37
|
# the pipe — the exact deadlock this class exists to prevent —
|
|
36
38
|
# so it must leave a trace.
|
|
37
|
-
warn "[rubik] stderr drain died unexpectedly (#{e.class}: #{e.message})" unless @stopped
|
|
39
|
+
Rubik::Log.warn(:platform, "[rubik] stderr drain died unexpectedly (#{e.class}: #{e.message})") unless @stopped
|
|
38
40
|
end
|
|
39
41
|
self
|
|
40
42
|
end
|
data/lib/rubik/plugin/storage.rb
CHANGED
|
@@ -79,10 +79,10 @@ module Rubik
|
|
|
79
79
|
when :verified
|
|
80
80
|
:verified
|
|
81
81
|
when :drift
|
|
82
|
-
warn "[SECURITY] Integrity check failed for plugin '#{basename}': file modified since adding."
|
|
82
|
+
Rubik::Log.warn(:plugin, "[SECURITY] Integrity check failed for plugin '#{basename}': file modified since adding.")
|
|
83
83
|
:rejected
|
|
84
84
|
when :unknown
|
|
85
|
-
warn "[SECURITY] Unknown plugin file '#{basename}' not in manifest. Skipping."
|
|
85
|
+
Rubik::Log.warn(:plugin, "[SECURITY] Unknown plugin file '#{basename}' not in manifest. Skipping.")
|
|
86
86
|
:rejected
|
|
87
87
|
end
|
|
88
88
|
end
|
|
@@ -247,8 +247,8 @@ module Rubik
|
|
|
247
247
|
entry = load_manifest(dir)[name]
|
|
248
248
|
|
|
249
249
|
unless entry.is_a?(Hash) && entry["type"] == "directory" && entry["files"].is_a?(Hash)
|
|
250
|
-
warn "[SECURITY] Directory plugin '#{name}' has no package inventory in the manifest " \
|
|
251
|
-
|
|
250
|
+
Rubik::Log.warn(:plugin, "[SECURITY] Directory plugin '#{name}' has no package inventory in the manifest " \
|
|
251
|
+
"(legacy manifest). Skipping; re-add it with '!plugin add' or set RUBIK_TRUST_OVERLAYS=1 to trust it.")
|
|
252
252
|
return :rejected
|
|
253
253
|
end
|
|
254
254
|
|
|
@@ -256,16 +256,16 @@ module Rubik
|
|
|
256
256
|
begin
|
|
257
257
|
current = PackageInventory.inventory(package_dir)
|
|
258
258
|
rescue PackageInventory::Violation => e
|
|
259
|
-
warn "[SECURITY] Integrity check failed for plugin package '#{name}': #{e.message}. " \
|
|
260
|
-
|
|
259
|
+
Rubik::Log.warn(:plugin, "[SECURITY] Integrity check failed for plugin package '#{name}': #{e.message}. " \
|
|
260
|
+
"Re-add it with '!plugin add' or set RUBIK_TRUST_OVERLAYS=1 to trust it.")
|
|
261
261
|
return :rejected
|
|
262
262
|
end
|
|
263
263
|
|
|
264
264
|
drift = PackageInventory.drift(entry["files"], current)
|
|
265
265
|
return :verified if drift.empty?
|
|
266
266
|
|
|
267
|
-
warn "[SECURITY] Integrity check failed for plugin package '#{name}': #{drift}. " \
|
|
268
|
-
|
|
267
|
+
Rubik::Log.warn(:plugin, "[SECURITY] Integrity check failed for plugin package '#{name}': #{drift}. " \
|
|
268
|
+
"Re-add it with '!plugin add' or set RUBIK_TRUST_OVERLAYS=1 to trust it.")
|
|
269
269
|
:rejected
|
|
270
270
|
end
|
|
271
271
|
end
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative "../log"
|
|
4
|
+
|
|
3
5
|
module Rubik
|
|
4
6
|
module REPL
|
|
5
7
|
# Wires reactive configuration observers to Shell subsystems.
|
|
@@ -60,7 +62,7 @@ module Rubik
|
|
|
60
62
|
# only, so the mirror pushed writes into a key nothing reads back.
|
|
61
63
|
# The incantation stays accepted; it warns instead of mirroring.
|
|
62
64
|
cleanups << config.on_change("network.allow") do |_key, _val, _old|
|
|
63
|
-
warn "[ConfigWiring] [DEPRECATION] Config key 'network.allow' is deprecated and has no effect. Use 'sandbox.allow_network' instead."
|
|
65
|
+
Rubik::Log.warn(:config, "[ConfigWiring] [DEPRECATION] Config key 'network.allow' is deprecated and has no effect. Use 'sandbox.allow_network' instead.")
|
|
64
66
|
end
|
|
65
67
|
|
|
66
68
|
cleanups
|
|
@@ -83,7 +85,7 @@ module Rubik
|
|
|
83
85
|
begin
|
|
84
86
|
shell.guard.verify_root_safety!(r)
|
|
85
87
|
rescue Rubik::Security::BlockedWriteError => e
|
|
86
|
-
warn "[ConfigWiring] #{e.message}. Skipping additional root #{r}."
|
|
88
|
+
Rubik::Log.warn(:config, "[ConfigWiring] #{e.message}. Skipping additional root #{r}.")
|
|
87
89
|
next
|
|
88
90
|
end
|
|
89
91
|
end
|
|
@@ -110,7 +112,7 @@ module Rubik
|
|
|
110
112
|
begin
|
|
111
113
|
shell.guard.verify_root_safety!(d)
|
|
112
114
|
rescue Rubik::Security::BlockedWriteError => e
|
|
113
|
-
warn "[ConfigWiring] #{e.message}. Skipping allowed directory #{d}."
|
|
115
|
+
Rubik::Log.warn(:config, "[ConfigWiring] #{e.message}. Skipping allowed directory #{d}.")
|
|
114
116
|
next
|
|
115
117
|
end
|
|
116
118
|
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "stringio"
|
|
4
|
+
require_relative "../log"
|
|
4
5
|
require_relative "tee_io"
|
|
5
6
|
require_relative "../storage/layout"
|
|
6
7
|
|
|
@@ -398,7 +399,7 @@ module Rubik
|
|
|
398
399
|
begin
|
|
399
400
|
md_stream&.finish { |seg| @output.print seg }
|
|
400
401
|
rescue StandardError => e
|
|
401
|
-
warn "[rubik] markdown tail flush failed: #{e.class}: #{e.message}"
|
|
402
|
+
Rubik::Log.warn(:repl, "[rubik] markdown tail flush failed: #{e.class}: #{e.message}")
|
|
402
403
|
end
|
|
403
404
|
kill_spinner!(renderer&.spinner)
|
|
404
405
|
flush_subagent_notices! if respond_to?(:flush_subagent_notices!)
|
|
@@ -427,7 +428,7 @@ module Rubik
|
|
|
427
428
|
|
|
428
429
|
supervisor.cancel_owned(task, timeout: Rubik::Storage::Layout.config_get(@config, "subagents.cancel_timeout", 2.0))
|
|
429
430
|
rescue StandardError => e
|
|
430
|
-
warn "[rubik] task cancellation failed: #{e.class}: #{e.message}"
|
|
431
|
+
Rubik::Log.warn(:repl, "[rubik] task cancellation failed: #{e.class}: #{e.message}")
|
|
431
432
|
nil
|
|
432
433
|
end
|
|
433
434
|
|
|
@@ -455,7 +456,7 @@ module Rubik
|
|
|
455
456
|
def kill_spinner!(spinner)
|
|
456
457
|
spinner&.kill
|
|
457
458
|
rescue StandardError => e
|
|
458
|
-
warn "[rubik] spinner cleanup failed: #{e.class}: #{e.message}"
|
|
459
|
+
Rubik::Log.warn(:repl, "[rubik] spinner cleanup failed: #{e.class}: #{e.message}")
|
|
459
460
|
end
|
|
460
461
|
|
|
461
462
|
# Command-dispatch spinner cleanup (both branches).
|
data/lib/rubik/repl/lifecycle.rb
CHANGED
data/lib/rubik/repl/tee_io.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative "../log"
|
|
3
4
|
require_relative "../ui/capability"
|
|
4
5
|
|
|
5
6
|
module Rubik
|
|
@@ -94,7 +95,7 @@ module Rubik
|
|
|
94
95
|
|
|
95
96
|
def drop_failed_target(target, method, exception)
|
|
96
97
|
@targets.delete(target)
|
|
97
|
-
warn "[rubik] tee target failed during ##{method} (#{exception.class}: #{exception.message}); detached from output"
|
|
98
|
+
Rubik::Log.warn(:repl, "[rubik] tee target failed during ##{method} (#{exception.class}: #{exception.message}); detached from output")
|
|
98
99
|
end
|
|
99
100
|
|
|
100
101
|
def strip_args(args)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative "../log"
|
|
3
4
|
require_relative "../ast"
|
|
4
5
|
require_relative "../coeffects"
|
|
5
6
|
require_relative "service_registration"
|
|
@@ -24,7 +25,7 @@ module Rubik
|
|
|
24
25
|
# Report but keep draining: a failed cache save must not abort
|
|
25
26
|
# the LIFO unwind, and silence here would leak a stale symbol
|
|
26
27
|
# cache with no trace.
|
|
27
|
-
warn "[ASTService] cache save failed: #{e.class}: #{e.message}"
|
|
28
|
+
Rubik::Log.warn(:ast, "[ASTService] cache save failed: #{e.class}: #{e.message}")
|
|
28
29
|
end
|
|
29
30
|
ast_graph.clear if ast_graph.respond_to?(:clear)
|
|
30
31
|
end
|
|
@@ -79,7 +79,7 @@ module Rubik
|
|
|
79
79
|
[project_commands_dir, global_commands_dir, project_tools_dir, global_tools_dir].each do |dir|
|
|
80
80
|
FileUtils.mkdir_p(dir)
|
|
81
81
|
rescue SystemCallError => e
|
|
82
|
-
warn "[WARN] Failed to create overlay directory #{dir}: #{e.message}" if ENV["RUBIK_DEBUG"]
|
|
82
|
+
Rubik::Log.warn(:overlay, "[WARN] Failed to create overlay directory #{dir}: #{e.message}") if ENV["RUBIK_DEBUG"]
|
|
83
83
|
end
|
|
84
84
|
end
|
|
85
85
|
|
|
@@ -112,7 +112,7 @@ module Rubik
|
|
|
112
112
|
return :trusted if @overlay_guard.trust_mode?
|
|
113
113
|
|
|
114
114
|
unless @overlay_guard.safe_path_under?(file_path, dir)
|
|
115
|
-
warn "[SECURITY] Path traversal attempt detected for overlay '#{file_path}'. Skipping."
|
|
115
|
+
Rubik::Log.warn(:overlay, "[SECURITY] Path traversal attempt detected for overlay '#{file_path}'. Skipping.")
|
|
116
116
|
return :rejected
|
|
117
117
|
end
|
|
118
118
|
|
|
@@ -128,8 +128,8 @@ module Rubik
|
|
|
128
128
|
# Constant-time comparison policy is single-homed in ManifestStore
|
|
129
129
|
# (issue #426), same as plugin verification.
|
|
130
130
|
expected_hash = manifest[basename]["sha256"]
|
|
131
|
-
warn "[SECURITY] Integrity check failed for overlay '#{basename}': file modified " \
|
|
132
|
-
|
|
131
|
+
Rubik::Log.warn(:overlay, "[SECURITY] Integrity check failed for overlay '#{basename}': file modified " \
|
|
132
|
+
"since synthesis. Skipping. (expected: #{expected_hash}, got: #{current_hash})")
|
|
133
133
|
:rejected
|
|
134
134
|
when :unknown
|
|
135
135
|
if bootstrap_eligible && sentinel_content?(current_content)
|
|
@@ -152,7 +152,7 @@ module Rubik
|
|
|
152
152
|
save_manifest(dir, manifest)
|
|
153
153
|
:bootstrapped
|
|
154
154
|
else
|
|
155
|
-
warn "[SECURITY] Unknown overlay file '#{basename}' not in manifest. Skipping."
|
|
155
|
+
Rubik::Log.warn(:overlay, "[SECURITY] Unknown overlay file '#{basename}' not in manifest. Skipping.")
|
|
156
156
|
:rejected
|
|
157
157
|
end
|
|
158
158
|
end
|
|
@@ -208,7 +208,7 @@ module Rubik
|
|
|
208
208
|
if proc_handler.arity == 1
|
|
209
209
|
proc_handler.call(args)
|
|
210
210
|
elsif proc_handler.arity == 2
|
|
211
|
-
warn "[rubik] overlay command invoked without a dispatch CommandContext" unless ctx || ENV["RUBIK_TEST"]
|
|
211
|
+
Rubik::Log.warn(:overlay, "[rubik] overlay command invoked without a dispatch CommandContext") unless ctx || ENV["RUBIK_TEST"]
|
|
212
212
|
sealed_ctx = if ctx.is_a?(Rubik::REPL::SynthesizedCommandContext)
|
|
213
213
|
ctx
|
|
214
214
|
else
|
|
@@ -245,7 +245,7 @@ module Rubik
|
|
|
245
245
|
out_ctx = if ctx
|
|
246
246
|
ctx
|
|
247
247
|
elsif shell.respond_to?(:command_context)
|
|
248
|
-
warn "[rubik] overlay command invoked without a dispatch CommandContext" unless ENV["RUBIK_TEST"]
|
|
248
|
+
Rubik::Log.warn(:overlay, "[rubik] overlay command invoked without a dispatch CommandContext") unless ENV["RUBIK_TEST"]
|
|
249
249
|
shell.command_context
|
|
250
250
|
else
|
|
251
251
|
shell.output
|
|
@@ -292,7 +292,7 @@ module Rubik
|
|
|
292
292
|
# A malformed schema silently claiming "no arguments"
|
|
293
293
|
# hides real overlay bugs; keep loading (the tool is
|
|
294
294
|
# hash-verified) but say so.
|
|
295
|
-
warn "[rubik] overlay tool '#{name}' has a malformed '# Schema:' header; treating as no-arg schema"
|
|
295
|
+
Rubik::Log.warn(:overlay, "[rubik] overlay tool '#{name}' has a malformed '# Schema:' header; treating as no-arg schema")
|
|
296
296
|
{}
|
|
297
297
|
end
|
|
298
298
|
else
|
|
@@ -423,7 +423,7 @@ module Rubik
|
|
|
423
423
|
{ ok: true, path: file_path, name: clean_name, scope: scope }
|
|
424
424
|
rescue StandardError => e
|
|
425
425
|
# Audit 1: surfaced to the caller as ok:false; tool kind logs under RUBIK_DEBUG.
|
|
426
|
-
warn "[WARN] [OVERLAY] Failed to save #{kind.label} '#{name}' to #{file_path}: #{e.class}: #{e.message}" if kind.debug_warn && ENV["RUBIK_DEBUG"]
|
|
426
|
+
Rubik::Log.warn(:overlay, "[WARN] [OVERLAY] Failed to save #{kind.label} '#{name}' to #{file_path}: #{e.class}: #{e.message}") if kind.debug_warn && ENV["RUBIK_DEBUG"]
|
|
427
427
|
{ ok: false, error: e.message }
|
|
428
428
|
end
|
|
429
429
|
|
|
@@ -470,10 +470,10 @@ module Rubik
|
|
|
470
470
|
if yield(name, code, meta[:scope])
|
|
471
471
|
loaded << name
|
|
472
472
|
elsif kind.warn_on_unusable
|
|
473
|
-
warn "[OVERLAY] Custom #{kind.label} '#{name}' from #{file_path} did not evaluate to a usable tool."
|
|
473
|
+
Rubik::Log.warn(:overlay, "[OVERLAY] Custom #{kind.label} '#{name}' from #{file_path} did not evaluate to a usable tool.")
|
|
474
474
|
end
|
|
475
475
|
rescue StandardError => e
|
|
476
|
-
warn "[OVERLAY] Failed to load custom #{kind.label} '#{name}' from #{file_path}: #{e.class}: #{e.message}"
|
|
476
|
+
Rubik::Log.warn(:overlay, "[OVERLAY] Failed to load custom #{kind.label} '#{name}' from #{file_path}: #{e.class}: #{e.message}")
|
|
477
477
|
end
|
|
478
478
|
loaded
|
|
479
479
|
end
|
|
@@ -516,7 +516,7 @@ module Rubik
|
|
|
516
516
|
|
|
517
517
|
case manifest_state(dir)
|
|
518
518
|
when :corrupt
|
|
519
|
-
warn "[SECURITY] Corrupt manifest in #{dir}; skipping #{files.size} overlay(s)."
|
|
519
|
+
Rubik::Log.warn(:overlay, "[SECURITY] Corrupt manifest in #{dir}; skipping #{files.size} overlay(s).")
|
|
520
520
|
[]
|
|
521
521
|
when :missing
|
|
522
522
|
if @overlay_guard.bootstrap_opt_in?
|
|
@@ -527,8 +527,8 @@ module Rubik
|
|
|
527
527
|
{ name: File.basename(f, ".rb"), scope: scope, path: f, integrity: integrity }
|
|
528
528
|
end
|
|
529
529
|
if bootstrapped.positive?
|
|
530
|
-
warn "[BOOTSTRAP] First scan of #{dir}: recorded #{bootstrapped} overlay(s) into .manifest.json; " \
|
|
531
|
-
|
|
530
|
+
Rubik::Log.warn(:overlay, "[BOOTSTRAP] First scan of #{dir}: recorded #{bootstrapped} overlay(s) into .manifest.json; " \
|
|
531
|
+
"unknown files will be rejected from now on.")
|
|
532
532
|
end
|
|
533
533
|
entries
|
|
534
534
|
else
|
|
@@ -536,8 +536,8 @@ module Rubik
|
|
|
536
536
|
# sentinel dosyalar görünür tek satırlık bildirimle atlanır.
|
|
537
537
|
gated = files.count { |f| sentinel_file?(f) }
|
|
538
538
|
if gated.positive?
|
|
539
|
-
warn "[BOOTSTRAP] #{gated} unrecorded sentinel overlay(s) in #{dir} were skipped; " \
|
|
540
|
-
|
|
539
|
+
Rubik::Log.warn(:overlay, "[BOOTSTRAP] #{gated} unrecorded sentinel overlay(s) in #{dir} were skipped; " \
|
|
540
|
+
"first-time acceptance requires RUBIK_BOOTSTRAP_OVERLAYS=1.")
|
|
541
541
|
end
|
|
542
542
|
files.map { |f| { name: File.basename(f, ".rb"), scope: scope, path: f, integrity: verify_integrity(f, dir) } }
|
|
543
543
|
end
|
|
@@ -554,7 +554,7 @@ module Rubik
|
|
|
554
554
|
File.file?(path) && sentinel_content?(File.binread(path))
|
|
555
555
|
rescue StandardError => e
|
|
556
556
|
# Audit 1: unreadable => fail-closed (not a sentinel), but traceable.
|
|
557
|
-
warn "[WARN] [OVERLAY] sentinel check failed for #{path}: #{e.class}: #{e.message}" if ENV["RUBIK_DEBUG"]
|
|
557
|
+
Rubik::Log.warn(:overlay, "[WARN] [OVERLAY] sentinel check failed for #{path}: #{e.class}: #{e.message}") if ENV["RUBIK_DEBUG"]
|
|
558
558
|
false
|
|
559
559
|
end
|
|
560
560
|
|
|
@@ -97,7 +97,7 @@ module Rubik
|
|
|
97
97
|
@instances.each do |mgr|
|
|
98
98
|
mgr.kill_all
|
|
99
99
|
rescue StandardError => e
|
|
100
|
-
warn "[TaskManager] at_exit kill_all failed: #{e.class}: #{e.message}"
|
|
100
|
+
Rubik::Log.warn(:runtime, "[TaskManager] at_exit kill_all failed: #{e.class}: #{e.message}")
|
|
101
101
|
end
|
|
102
102
|
end
|
|
103
103
|
end
|
data/lib/rubik/sandbox/runner.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative "../log"
|
|
3
4
|
require_relative "driver"
|
|
4
5
|
require_relative "driver/process"
|
|
5
6
|
require_relative "../security/errors"
|
|
@@ -57,7 +58,7 @@ module Rubik
|
|
|
57
58
|
begin
|
|
58
59
|
cleanup.call
|
|
59
60
|
rescue StandardError => e
|
|
60
|
-
warn "[WARN] Sandbox::Runner cleanup failed: #{e.message}"
|
|
61
|
+
Rubik::Log.warn(:sandbox, "[WARN] Sandbox::Runner cleanup failed: #{e.message}")
|
|
61
62
|
end
|
|
62
63
|
end
|
|
63
64
|
end
|
|
@@ -86,8 +87,8 @@ module Rubik
|
|
|
86
87
|
# previously-merged union (which would leave stale dirs allowed).
|
|
87
88
|
raw_allowed = Rubik::Storage::Layout.config_get(@config, "workspace.allowed_external_dirs", [])
|
|
88
89
|
unless raw_allowed.is_a?(Array)
|
|
89
|
-
warn "[SANDBOX] workspace.allowed_external_dirs must be an Array (got #{raw_allowed.class}); " \
|
|
90
|
-
|
|
90
|
+
Rubik::Log.warn(:sandbox, "[SANDBOX] workspace.allowed_external_dirs must be an Array (got #{raw_allowed.class}); " \
|
|
91
|
+
"treating as empty — the config is authoritative, so stale dirs are revoked.")
|
|
91
92
|
raw_allowed = []
|
|
92
93
|
end
|
|
93
94
|
baseline = @baseline_allowed_dirs || []
|
|
@@ -163,7 +164,7 @@ module Rubik
|
|
|
163
164
|
return false if cfg_val == false || cfg_val.to_s.downcase == "false"
|
|
164
165
|
|
|
165
166
|
unless cfg_val.nil?
|
|
166
|
-
warn "[SANDBOX] Unparseable sandbox.allow_network value '#{cfg_val}'; defaulting to fail-closed (false)"
|
|
167
|
+
Rubik::Log.warn(:sandbox, "[SANDBOX] Unparseable sandbox.allow_network value '#{cfg_val}'; defaulting to fail-closed (false)")
|
|
167
168
|
return false
|
|
168
169
|
end
|
|
169
170
|
end
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require "json"
|
|
4
4
|
require "time"
|
|
5
5
|
require "fileutils"
|
|
6
|
+
require_relative "../log"
|
|
6
7
|
require_relative "../platform"
|
|
7
8
|
require_relative "redactor"
|
|
8
9
|
|
|
@@ -65,7 +66,7 @@ module Rubik
|
|
|
65
66
|
# Unconditional: an audit trail failing silently is indistinguishable
|
|
66
67
|
# from an operator's intentional disable — the one warn in the guard
|
|
67
68
|
# that must not hide behind RUBIK_DEBUG.
|
|
68
|
-
warn "[WARN] Failed to write audit log #{@audit_log_path}: #{e.message}"
|
|
69
|
+
Rubik::Log.warn(:security, "[WARN] Failed to write audit log #{@audit_log_path}: #{e.message}")
|
|
69
70
|
end
|
|
70
71
|
end
|
|
71
72
|
end
|